NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/37493 (/bin/sh exits if shift fails, but shouldn't)
The following reply was made to PR bin/37493; it has been noted by GNATS.
From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/37493 (/bin/sh exits if shift fails, but shouldn't)
Date: Mon, 22 Feb 2016 01:17:40 +0700
I think this PR can be closed. Nothing has changed in the
past 7 years (nothing in sh anyway), and POSIX (now) says explicitly...
(relating to shift)
EXIT STATUS
If the n operand is invalid or is greater than "$#", this may be
considered a syntax error and a non-interactive shell may exit;
if the shell does not exit in this case, a non-zero exit status
shall be returned. Otherwise, zero shall be returned.
which explicitly makes what NetBSD's /bin/sh (and other shells) does
acceptable (it also makes what bash, etc, do acceptable).
That is, no portable sh script can assume that a shift with a count
greater than the number of available args will leave the shell running
afterwards.
So, as there is no real requirement to change this, and it hasn't been
changed already, I think the PR can just go away.
kre
Home |
Main Index |
Thread Index |
Old Index