9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] rc exec error behaviour
@ 2016-01-30 16:31 cinap_lenrek
  2016-01-31  1:16 ` Prof Brucee
  2016-02-22  0:19 ` erik quanstrom
  0 siblings, 2 replies; 29+ messages in thread
From: cinap_lenrek @ 2016-01-30 16:31 UTC (permalink / raw)
  To: 9fans

in the rc shell, when one has exec statement and the exec fails, rc tries to
continue interpreting statements after the exec which fails with a strange
EOF error because in the process of preparing filedescriptors for exec,
the very fd thats used to read the script was closed.

burnzez provided an example of this like:

term% rc -c 'exec doesnotexist; echo test'
doesnotexist: './doesnotexist' directory entry not found
test
rc: /rc/lib/rcmain:29: token EOF: syntax error

the manpage does not explicitely specify what should happen when exec fails.

i did try to have rc open the . script as OCEXEC and that fixed the
problem, but it wont work for any other redirections and will have side effects
as the close-on-exec flag is a propery of the channel and not of the file
descriptor slot. so imagine stuff like . /fd/0...

i think it would me most resonable to just have rc exit with error status on
failure. are there any objections to this?

--
cinap



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

end of thread, other threads:[~2016-02-22  0:19 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-30 16:31 [9fans] rc exec error behaviour cinap_lenrek
2016-01-31  1:16 ` Prof Brucee
2016-01-31  4:20   ` lucio
2016-01-31  6:58   ` Skip Tavakkolian
2016-02-01  0:52     ` Sean Hinchee
2016-02-01  4:06       ` erik quanstrom
2016-02-01  4:29         ` lucio
2016-02-01 17:01           ` Richard Miller
2016-02-01 18:35             ` lucio
2016-02-02  1:29               ` Prof Brucee
2016-02-02 10:53                 ` Richard Miller
2016-02-02 12:36                   ` Aram Hăvărneanu
2016-02-02 12:53                     ` hiro
2016-02-02 13:23                     ` David du Colombier
2016-02-02 15:46                       ` lucio
2016-02-02 16:02                         ` David du Colombier
2016-02-02 16:46                         ` Skip Tavakkolian
2016-02-02 16:52                           ` Skip Tavakkolian
2016-02-02 17:11                             ` sl
2016-02-03  0:37                               ` Sean Hinchee
2016-02-03  0:48                                 ` Kurt H Maier
2016-02-02 17:24                             ` sl
2016-02-02 17:33                             ` Wes Kussmaul
2016-02-01 20:33             ` [9fans] plan9/arm in Go 1.7? (was: rc exec error behaviour) Skip Tavakkolian
2016-02-01 20:45               ` David du Colombier
2016-02-02  4:16         ` [9fans] rc exec error behaviour Lyndon Nerenberg
2016-02-02  4:21           ` Prof Brucee
2016-02-02  4:24             ` Lyndon Nerenberg
2016-02-22  0:19 ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).