From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] rc exec error behaviour
Date: Sun, 21 Feb 2016 16:19:43 -0800 [thread overview]
Message-ID: <82486434a757e7c658914037a4ce106a@lilly.quanstro.net> (raw)
In-Reply-To: <b1fd655ff9a9d0d298d145d845b234f9@felloff.net>
On Sat Jan 30 08:33:54 PST 2016, cinap_lenrek@felloff.net wrote:
> 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?
i don't think that's the right thing to do. i think the specification is reasonable,
and what i'd like the shell to do on exec failure. i have a little hack that shows
it's feasable to recover, although i think the approach i'm taking really sucks. :-)
; 6.out
broken! exec x
undoableredir: close 3 /rc/lib/rcmain 512
undoableredir: close 4 /dev/cons 1076
x: '/bin/x' directory entry not found
exec fails
undoredir: open /rc/lib/rcmain → 3
undoredir: seek 512 /rc/lib/rcmain
undoredir: open /dev/cons → 4
undoredir: seek 1076 /dev/cons
unfortunately, this depends on fd2path which doesn't know the open
mode of the file in question. (so wierd, why doesn't it?) but /proc/$pid/fd
knows all about it. :-)
- erik
next prev parent reply other threads:[~2016-02-22 0:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-30 16:31 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 message]
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=82486434a757e7c658914037a4ce106a@lilly.quanstro.net \
--to=quanstro@quanstro.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).