busybox/coreutils
Denys Vlasenko 78b1b1b07a test: fix 4-argument case
Upstream dash commit:

    Date: Sun, 13 Jul 2008 19:20:10 +0800
    Fixed 3,4-argument cases for test per POSIX

    ----- Forwarded message from Gerrit Pape <pape@smarden.org> -----

    Subject: Bug#455828: dash: 4-argument test "test \( ! -e \)" yields an error
    Date: Fri, 28 Dec 2007 08:53:29 +0000
    From: Gerrit Pape <pape@smarden.org>
    To: Vincent Lefevre <vincent@vinc17.org>, 455828@bugs.debian.org

    On Thu, Dec 27, 2007 at 06:23:20PM +0100, Vincent Lefevre wrote:
    > On 2007-12-27 16:00:06 +0000, Gerrit Pape wrote:
    > > On Wed, Dec 12, 2007 at 02:18:47AM +0100, Vincent Lefevre wrote:
    > > > According to POSIX[*], "test \( ! -e \)" is a 4-argument test and is
    > > > here equivalent to "test ! -e". But dash (like ksh93 and bash) yields
    > > > an error:
    > > >
    > > > $ test \( ! -e \) || echo $?
    > > > test: 1: closing paren expected
    > > > 2
    > > > $ test ! -e || echo $?
    > > > 1
    > >
    > > Hi Vincent,
    > >
    > > the -e switch to test takes an argument, a pathname.
    >
    > According to POSIX, in both above examples, "-e" is *not* a switch,
    > just a string.
    >
    >   test \( ! -e \)
    >
    > means: return true if the string "-e" is empty, otherwhise return false.
    > The error in dash is that it incorrectly thinks that "-e" is a switch in
    > this context.

    I see, you're right.  Thanks, Gerrit.

    ----- End forwarded message -----

    This patch hard-codes the 3,4-argument cases in the way required by
    POSIX.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

function                                             old     new   delta
test_main                                            370     421     +51

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-31 19:21:51 +02:00
..
libcoreutils libbb: more compact API for bb_parse_mode() 2015-10-07 17:55:33 +02:00
basename.c basename: do not use argc 2017-07-21 18:41:46 +02:00
cat.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
chgrp.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
chmod.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
chown.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
chroot.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
cksum.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
comm.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
Config.src config: deindent all help texts 2017-07-21 09:50:55 +02:00
cp.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
cut.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
date.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
dd.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
df.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
dirname.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
dos2unix.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
du.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
echo.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
env.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
expand.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
expr.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
factor.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
false.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
fold.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
fsync.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
head.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
hostid.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
id_test.sh id: coreutils compat by Tito + test script 2008-10-29 00:27:31 +00:00
id.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
install.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
Kbuild.src shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_foo 2017-01-10 15:13:30 +01:00
link.c tar: postpone creation of symlinks with "suspicious" targets. Closes 8411 2017-07-24 17:20:13 +02:00
ln.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
logname.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
ls.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
md5_sha1_sum.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
mkdir.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
mkfifo.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
mknod.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
mktemp.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
mv.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
nice.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
nl.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
nohup.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
nproc.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
od_bloaty.c od_bloaty: fix floating point output 2017-07-19 13:12:02 +02:00
od.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
paste.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
printenv.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
printf.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
pwd.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
readlink.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
realpath.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
rm.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
rmdir.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
seq.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
shred.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
shuf.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
sleep.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
sort.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
split.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
stat.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
stty.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
sum.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
sync.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
tac.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
tail.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
tee.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
test_ptr_hack.c *: make GNU licensing statement forms more regular 2010-08-16 20:14:46 +02:00
test.c test: fix 4-argument case 2017-07-31 19:21:51 +02:00
timeout.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
touch.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
tr.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
true.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
truncate.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
tty.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
uname.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
uniq.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
unlink.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
usleep.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
uudecode.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
uuencode.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
wc.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
who.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
whoami.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
yes.c config: deindent all help texts 2017-07-21 09:50:55 +02:00