[Issue 16580] New: [REG 2.072.0-b1] spawnShell segfaults on macOS

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Oct 3 04:21:45 PDT 2016


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 at puremagic.com
          Reporter: doob at 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
* thread #1: tid = 0x293696, 0x0000000100046a8a
main`D3std7process7environFNbNdNeZxPPa + 14, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100046a8a main`D3std7process7environFNbNdNeZxPPa + 14
main`D3std7process7environFNbNdNeZxPPa:
->  0x100046a8a <+14>: movq   (%rcx), %rax
    0x100046a8d <+17>: popq   %rbp
    0x100046a8e <+18>: retq
    0x100046a8f <+19>: nop
(lldb) bt
* thread #1: tid = 0x293696, 0x0000000100046a8a
main`D3std7process7environFNbNdNeZxPPa + 14, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000100046a8a main`D3std7process7environFNbNdNeZxPPa + 14
    frame #1: 0x0000000100047423 main`D3std7process9createEnvFxHAyaAyabZPxPa +
63
    frame #2: 0x0000000100046d35
main`D3std7process16spawnProcessImplFNexAAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigxAaZC3std7process3Pid
+ 677
    frame #3: 0x00000001000479a8
main`D3std7process10spawnShellFNexAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigxAaAyaZC3std7process3Pid
+ 320
    frame #4: 0x00000001000018c3 main`_Dmain + 195 at process.d:1021
    frame #5: 0x000000010001e45c
main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
    frame #6: 0x000000010001e388
main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36
    frame #7: 0x000000010001e401
main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45
    frame #8: 0x000000010001e388
main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36
    frame #9: 0x000000010001e2ee main`_d_run_main + 498
    frame #10: 0x0000000100001982 main`main + 34
    frame #11: 0x00007fff8a3d25ad libdyld.dylib`start + 1
    frame #12: 0x00007fff8a3d25ad libdyld.dylib`start + 1

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

--


More information about the Digitalmars-d-bugs mailing list