Skip to content

Commit

Permalink
fix Issue 16580 - spawnShell segfaults on macOS
Browse files Browse the repository at this point in the history
- partially Revert "Merge pull request dlang#4493 from schveiguy/fixcycles2"
- recreate processinit (and import it from std.process)
  to call std.process shared ctor w/o creating a cycle
- keep it separate from phobosinit to not drag std.encoding
  into any binary using std.process
  • Loading branch information
MartinNowak committed Oct 4, 2016
1 parent e3f842d commit ebbdf21
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ EXTRA_MODULES_INTERNAL := $(addprefix \
std/internal/digest/, sha_SSSE3 ) $(addprefix \
std/internal/math/, biguintcore biguintnoasm biguintx86 \
gammafunction errorfunction) $(addprefix std/internal/, \
cstring phobosinit unicode_tables scopebuffer\
cstring phobosinit processinit unicode_tables scopebuffer\
unicode_comp unicode_decomp unicode_grapheme unicode_norm) \
$(addprefix std/internal/test/, dummyrange) \
$(addprefix std/experimental/ndslice/, internal) \
Expand Down
10 changes: 0 additions & 10 deletions std/internal/phobosinit.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@
+/
module std.internal.phobosinit;

version(OSX)
{
extern(C) void std_process_shared_static_this();

shared static this()
{
std_process_shared_static_this();
}
}

shared static this()
{
import std.encoding : EncodingScheme;
Expand Down
22 changes: 22 additions & 0 deletions std/internal/processinit.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Written in the D programming language.

/++
The only purpose of this module is to do the static construction for
std.process in order to eliminate cyclic construction errors.
Copyright: Copyright 2011 -
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: Jonathan M Davis and Kato Shoichi
Source: $(PHOBOSSRC std/internal/_processinit.d)
+/
module std.internal.processinit;

version(OSX)
{
extern(C) void std_process_shared_static_this();

shared static this()
{
std_process_shared_static_this();
}
}
1 change: 1 addition & 0 deletions std/process.d
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ version (Windows)

import std.range.primitives;
import std.stdio;
import std.internal.processinit;
import std.internal.cstring;


Expand Down
1 change: 1 addition & 0 deletions win32.mak
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ SRC_STD_C_FREEBSD= \
SRC_STD_INTERNAL= \
std\internal\cstring.d \
std\internal\phobosinit.d \
std\internal\processinit.d \
std\internal\unicode_tables.d \
std\internal\unicode_comp.d \
std\internal\unicode_decomp.d \
Expand Down
1 change: 1 addition & 0 deletions win64.mak
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ SRC_STD_C_FREEBSD= \
SRC_STD_INTERNAL= \
std\internal\cstring.d \
std\internal\phobosinit.d \
std\internal\processinit.d \
std\internal\unicode_tables.d \
std\internal\unicode_comp.d \
std\internal\unicode_decomp.d \
Expand Down

0 comments on commit ebbdf21

Please sign in to comment.