Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

merge stable #3793

Merged
merged 6 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mak/COPY
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ COPY=\
$(IMPDIR)\core\sys\openbsd\err.d \
$(IMPDIR)\core\sys\openbsd\execinfo.d \
$(IMPDIR)\core\sys\openbsd\pthread_np.d \
$(IMPDIR)\core\sys\openbsd\pwd.d \
$(IMPDIR)\core\sys\openbsd\stdlib.d \
$(IMPDIR)\core\sys\openbsd\string.d \
$(IMPDIR)\core\sys\openbsd\time.d \
Expand Down
1 change: 1 addition & 0 deletions mak/SRCS
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ SRCS=\
src\core\sys\openbsd\err.d \
src\core\sys\openbsd\execinfo.d \
src\core\sys\openbsd\pthread_np.d \
src\core\sys\openbsd\pwd.d \
src\core\sys\openbsd\stdlib.d \
src\core\sys\openbsd\string.d \
src\core\sys\openbsd\time.d \
Expand Down
19 changes: 19 additions & 0 deletions src/core/sys/openbsd/pwd.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* D header file for OpenBSD pwd.h.
*
* Copyright: Copyright © 2022, The D Language Foundation
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Brian Callahan
*/
module core.sys.openbsd.pwd;

version (OpenBSD):
extern (C):
nothrow:
@nogc:

public import core.sys.posix.pwd;
import core.sys.posix.sys.types : uid_t;

passwd* getpwnam_shadow(scope const char*);
passwd* getpwuid_shadow(uid_t);
2 changes: 1 addition & 1 deletion src/core/thread/context.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
* (See accompanying file LICENSE)
* Authors: Sean Kelly, Walter Bright, Alex Rønne Petersen, Martin Nowak
* Source: $(DRUNTIMESRC core/thread/package.d)
* Source: $(DRUNTIMESRC core/thread/context.d)
*/

module core.thread.context;
Expand Down
2 changes: 1 addition & 1 deletion src/rt/dmain2.d
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ extern (C) void _d_print_throwable(Throwable t)

void sink(in char[] buf) scope nothrow
{
fprintf(stderr, "%.*s", cast(int)buf.length, buf.ptr);
fwrite(buf.ptr, char.sizeof, buf.length, stderr);
}
formatThrowable(t, &sink);
}
22 changes: 17 additions & 5 deletions test/exceptions/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include ../common.mak

TESTS=stderr_msg unittest_assert invalid_memory_operation unknown_gc static_dtor \
future_message refcounted rt_trap_exceptions_drt catch_in_finally
future_message refcounted rt_trap_exceptions_drt catch_in_finally \
message_with_null

ifeq ($(OS)-$(BUILD),linux-debug)
TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions
Expand Down Expand Up @@ -77,13 +78,24 @@ $(ROOT)/catch_in_finally.done: STDERR_EXP="success."
$(ROOT)/rt_trap_exceptions.done: STDERR_EXP="object.Exception@src/rt_trap_exceptions.d(12): this will abort"
$(ROOT)/rt_trap_exceptions.done: STDERR_EXP2="src/rt_trap_exceptions.d:8 main"
$(ROOT)/assert_fail.done: STDERR_EXP="success."

$(ROOT)/message_with_null.done: STDERR_EXP=" world"

$(ROOT)/%.done: $(ROOT)/%
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS) 2>$(ROOT)/$*.stderr || true
cat $(ROOT)/$*.stderr
$(NEGATE) grep -qF $(STDERR_EXP) < $(ROOT)/$*.stderr
if [ ! -z $(STDERR_EXP2) ] ; then \
$(NEGATE) grep -qF $(STDERR_EXP2) < $(ROOT)/$*.stderr; \

@if $(NEGATE) grep -qF $(STDERR_EXP) < $(ROOT)/$*.stderr ; then true ; else \
echo 'Searched for pattern $(STDERR_EXP), NEGATE = $(NEGATE)' ;\
tail --bytes=5000 $(ROOT)/$*.stderr ;\
exit 1 ;\
fi
@if [ ! -z $(STDERR_EXP2) ] ; then \
if $(NEGATE) grep -qF $(STDERR_EXP2) < $(ROOT)/$*.stderr ; then true ; else \
echo 'Searched for '$(STDERR_EXP2)' NEGATE = $(NEGATE)' ;\
tail --bytes=5000 $(ROOT)/$*.stderr ;\
exit 1 ;\
fi \
fi
@touch $@

Expand Down
6 changes: 6 additions & 0 deletions test/exceptions/src/message_with_null.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module message_with_null;

void main()
{
throw new Exception("hello\0 world!");
}