9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9fans@9fans.net
Subject: [9fans] rc exec error behaviour
Date: Sat, 30 Jan 2016 17:31:27 +0100	[thread overview]
Message-ID: <b1fd655ff9a9d0d298d145d845b234f9@felloff.net> (raw)

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



             reply	other threads:[~2016-01-30 16:31 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-30 16:31 cinap_lenrek [this message]
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
2016-02-03  0:48 sl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b1fd655ff9a9d0d298d145d845b234f9@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).