From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 References: In-Reply-To: From: Skip Tavakkolian Date: Sun, 31 Jan 2016 06:58:45 +0000 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a1145886e359507052a9bcd17 Subject: Re: [9fans] rc exec error behaviour Topicbox-Message-UUID: 808f9cc6-ead9-11e9-9d60-3106f5b1d025 --001a1145886e359507052a9bcd17 Content-Type: text/plain; charset=UTF-8 Sign me up for testing. On Sat, Jan 30, 2016, 5:16 PM Prof Brucee wrote: > Any objections to me rewriting rc in go without all known bugs? > On 31/01/2016 3:36 AM, 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? >> >> -- >> cinap >> >> --001a1145886e359507052a9bcd17 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sign me up for testing.

= On Sat, Jan 30, 2016, 5:16 PM=C2=A0Prof Brucee <prof.brucee@gmail.com> wrote:

Any objections to me rewriting rc in go w= ithout all known bugs?

On 31/01/2016 3:36 AM, <cinap_lenrek@felloff.net> = wrote:
in the rc she= ll, when one has exec statement and the exec fails, rc tries to
continue interpreting statements after the exec which fails with a strange<= br> 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 eff= ects
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 o= n
failure. are there any objections to this?

--
cinap

--001a1145886e359507052a9bcd17--