www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16580] New: [REG 2.072.0-b1] spawnShell segfaults on macOS

https://issues.dlang.org/show_bug.cgi?id=16580

          Issue ID: 16580
           Summary: [REG 2.072.0-b1] spawnShell segfaults on macOS
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: doob me.com

The following code:

import std.process;

void main()
{
    spawnShell("ls");
}

Compiling and running that with DMD 2.072.0-b1 results in a segmentation fault.
I suspect it's std.process.environ that returns null, due to environPtr not
being initialized due to std_process_shared_static_this not being called [1].

Running inside a debugger:

(lldb) target create "main"
Current executable set to 'main' (x86_64).
(lldb) r
Process 6457 launched: '/Users/jacob/development/d/dlang/dmd/src/main' (x86_64)
Process 6457 stopped

main`D3std7process7environFNbNdNeZxPPa + 14, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=1, address=0x0)

main`D3std7process7environFNbNdNeZxPPa:
->  0x100046a8a <+14>: movq   (%rcx), %rax
    0x100046a8d <+17>: popq   %rbp
    0x100046a8e <+18>: retq
    0x100046a8f <+19>: nop
(lldb) bt

main`D3std7process7environFNbNdNeZxPPa + 14, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=1, address=0x0)


63

main`D3std7process16spawnProcessImplFNexAAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigxAaZC3std7process3Pid
+ 677

main`D3std7process10spawnShellFNexAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigxAaAyaZC3std7process3Pid
+ 320


main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40

main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36

main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45

main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36





[1] https://github.com/dlang/phobos/blob/master/std/process.d#L135-L138

--
Oct 03 2016