public inbox for goredo-devel@lists.cypherpunks.ru
Atom feed
* Segfault on broken shebangs in .do files
@ 2021-10-14  7:18 goredo
  2021-10-14 10:35 ` Sergey Matveev
  0 siblings, 1 reply; 4+ messages in thread
From: goredo @ 2021-10-14  7:18 UTC (permalink / raw)
  To: goredo-devel

Hi,

when executing .do files, i.e., a shell script that is executable, redo dies ungracefully when the shebang line is broken. I had a different comment in the first line in the file.

–Michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Segfault on broken shebangs in .do files
  2021-10-14  7:18 Segfault on broken shebangs in .do files goredo
@ 2021-10-14 10:35 ` Sergey Matveev
  2021-10-14 11:16   ` goredo
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Matveev @ 2021-10-14 10:35 UTC (permalink / raw)
  To: goredo-devel

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

Greetings!

*** goredo [2021-10-14 07:18]:
>when executing .do files, i.e., a shell script that is executable, redo dies ungracefully when the shebang line is broken. I had a different comment in the first line in the file.

Unfortunately either I do not understand the problem, or I can not
reproduce unexpected behaviour. I tried to "redo f.do", where f.do is
executable file with missing shebangs, shebangs leading to unexistent
files, with failing programs, and redo gives an ordinary error and bad
return code. Can you describe the problem more?

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: CF60 E89A 5923 1E76 E263  6422 AE1A 8109 E498 57EF

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Segfault on broken shebangs in .do files
  2021-10-14 10:35 ` Sergey Matveev
@ 2021-10-14 11:16   ` goredo
  2021-10-14 11:57     ` Sergey Matveev
  0 siblings, 1 reply; 4+ messages in thread
From: goredo @ 2021-10-14 11:16 UTC (permalink / raw)
  To: goredo-devel

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Segfault on broken shebangs in .do files
  2021-10-14 11:16   ` goredo
@ 2021-10-14 11:57     ` Sergey Matveev
  0 siblings, 0 replies; 4+ messages in thread
From: Sergey Matveev @ 2021-10-14 11:57 UTC (permalink / raw)
  To: goredo-devel

[-- Attachment #1: Type: text/plain, Size: 887 bytes --]

*** goredo [2021-10-14 11:16]:
>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

That definitely helped me to reproduce the problem! It happens when
stderr saving is active (-k, REDO_LOGS=1). Will fix in the following
release. Thank you!

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: CF60 E89A 5923 1E76 E263  6422 AE1A 8109 E498 57EF

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-14 12:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14  7:18 Segfault on broken shebangs in .do files goredo
2021-10-14 10:35 ` Sergey Matveev
2021-10-14 11:16   ` goredo
2021-10-14 11:57     ` Sergey Matveev