Subject: Re: Segfault on broken shebangs in .do files

From: goredo <[email-masked]>
Date: Thu, 14 Oct 2021 11:16:04 +0000 (UTC)

You're right I cannot portably reproduce the error. For my MWE, I also see a proper error message.

I can, however reproduce the error with a particular file in a particular project. This is the message:
```
err  nandnor/genexp: fork/exec /home/mraitza/docs/phd/diss/exps/nandnor/genexp.do: exec format error
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x52266c]

goroutine 19 [running]:
main.runScript.func5.1(0xc00011c000, 0xa6, 0xc00009e12b, 0xc0000be098, 0xc0000be0b0, 0xc0000be0c8, 0xc0000d8600, 0x2e, 0x7fff8d73a8cd, 0x6, ...)
        go.cypherpunks.ru/goredo/run.go:459 +0x1ec
main.runScript.func5(0xc00011c000, 0xa6, 0xc000118000, 0xc0000ba3a0, 0xc0000c26c0, 0xc0000f4f00, 0x3e, 0xc0000be0b0, 0xc00009e590, 0xc0000c0600, ...)
        go.cypherpunks.ru/goredo/run.go:542 +0xdd3
created by main.runScript
        go.cypherpunks.ru/goredo/run.go:403 +0x1db2
```

And the offending file genexp.do:
```
# [[file:nandnor.org::+begin_src shell :tangle genexp.do :tangle-mode (identity #o755) :shebang "#!/bin/sh"][No heading:2]]
#!/bin/sh
d=../basiccmos/wcd
mkdir -p "$d"
cp 3nandnor.py "$d"
redo "$d"/4.inputs.props
ln -sf 4.inputs.props "$d"/3nandnor.props
cp ../4inputs-ndet-power-template.net "$d"/3nandnor.template.net
# No heading:2 ends here
```

So it may have to do with path lengths and such things. Copying the file to some other place already destroyed the effect.