aboutsummaryrefslogtreecommitdiff
path: root/coreutils/test.c
AgeCommit message (Collapse)Author
2017-07-31test: fix 4-argument caseDenys Vlasenko
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-21config: deindent all help textsDenys Vlasenko
Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18Update menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-04libbb: new function bb_getgroups() - allocating wrapper around getgroups()Denys Vlasenko
function old new delta bb_getgroups - 111 +111 nexpr 843 757 -86 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/1 up/down: 111/-86) Total: 25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_fooDenys Vlasenko
This makes hash and ash more symmetrical wrt config menu and config options. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-23Make it possible to select "sh" and "bash" aliases without selecting ash or hushDenys Vlasenko
The same can be done for msh, but we are probably better off just deleting it in a next versio or two. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23test: make [ and [[ forms individually selectableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23Convert all coreutils/* applets to "new style" applet definitionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02test: fix compile error in last commitDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02test: memory leak: free group id listDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-21special-case {true,false,test} --helpDenys Vlasenko
This also removes their help texts. function old new delta run_applet_no_and_exit 442 452 +10 packed_usage 30713 30625 -88 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-01test: fix mishandling of "test '(' = '('" and similarDenys Vlasenko
function old new delta test_main 246 350 +104 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14whitespace cleanup. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08test: "test !" was accessing argv past NULL - fix it. Closes 4832Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31move help text from include/usage.src.h to coreutils/*.cPere Orga
Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08printenv: fix environ == NULL segfaultDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-20test: add examples when "%s: unknown operand" happensDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-29whitespace cleanupDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06remove defconfig. Now "make defconfig" simply uses defaults from Config.inDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04partially migrate coreutils to Config.src and Kbuild.srcDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-03test: "" is not a valid number. Closes bug 1915Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-12test: use index_in_stringsDenys Vlasenko
function old new delta ops_texts - 124 +124 ops_table - 80 +80 display_process_list 1447 1448 +1 binop 525 523 -2 static.no_op 6 2 -4 check_operator 71 63 -8 ops 240 - -240 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 1/3 up/down: 205/-254) Total: -49 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-17test: fix "test !" and "test abc -a !". closes bug 465Denys Vlasenko
function old new delta nexpr 826 840 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-14ash: fix . builtinDenys Vlasenko
Also, move [[ ]] comment to test.c and expand it Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-13test, tcpsvd, tcpsvd: shrinkDenys Vlasenko
function old new delta nexpr 825 826 +1 tcpudpsvd_main 1830 1822 -8 test_main 257 247 -10 binop 584 525 -59 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 1/-77) Total: -76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-09-25- update my name. No obj-code changes ;)Bernhard Reutner-Fischer
2008-07-19test: fix parser to prefer binop over unop, as coreutils does.Denis Vlasenko
remove bogus workaround in main(). rename atrocious variables/functions. much expand testsuite. libbb: fix --help to not affect "test --help" function old new delta run_applet_no_and_exit 421 440 +19 nexpr 817 825 +8 static.no_op - 6 +6 test_main 397 257 -140 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 2/1 up/down: 104/-211) Total: -107 bytes
2008-07-05*: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko
2008-05-13more -Wall warning fixes from Cristian Ionescu-Idbohrn.Denis Vlasenko
This time it resulted in small code changes: function old new delta nexpr 820 828 +8 tail_main 1200 1202 +2 wrapf 166 167 +1 parse_mount_options 227 209 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 11/-18) Total: -7 bytes
2008-04-22*: remove remaining instances of ".data" hackDenis Vlasenko
2008-02-27*: add optimization barrier to all "G trick" locationsDenis Vlasenko
2008-02-09test: fix mishandling of 'test ! arg1 op arg2 more args'; add testsuiteDenis Vlasenko
2007-11-30test: stop using lots of bss.Denis Vlasenko
function old new delta test_main 425 456 +31 t_lex 69 73 +4 syntax 100 104 +4 ptr_to_statics 8 12 +4 t_wp_op 4 - -4 t_wp 4 - -4 ngroups 4 - -4 group_array 4 - -4 binop 590 585 -5 oexpr 104 97 -7 aexpr 101 94 -7 nexpr 831 820 -11 leaving 156 - -156 ------------------------------------------------------------------------------ (add/remove: 0/5 grow/shrink: 4/4 up/down: 43/-202) Total: -159 bytes text data bss dec hex filename 775098 929 9084 785111 bfad7 busybox_old 775107 933 8908 784948 bfa34 busybox_unstripped
2007-11-16- remove most of the forward declarations. No obj-code changes.Bernhard Reutner-Fischer
2007-09-21test: correct confusing placement of "const"Denis Vlasenko
2007-06-30introduce and use bb_basename()Denis Vlasenko
function old new delta bb_basename - 26 +26 sv_main 1226 1225 -1 passwd_main 1985 1983 -2 showdirs 482 478 -4 sendCgi 1811 1807 -4 make_device 1354 1350 -4 handleIncoming 2443 2439 -4 func_name 82 78 -4 service_name 2292 2285 -7 main 909 901 -8 cmp_main 555 547 -8 test_main 434 422 -12 act 228 216 -12 find_pair 180 164 -16 rmmod_main 298 280 -18 find_pid_by_name 156 134 -22 modprobe_main 1606 1576 -30 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/16 up/down: 26/-156) Total: -130 bytes text data bss dec hex filename 734933 3028 14400 752361 b7ae9 busybox_old 734801 3028 14400 752229 b7a65 busybox_unstripped
2007-06-25Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms ↵Denis Vlasenko
<wharms@bfs.de>)
2007-06-25test: suppress gcc warningDenis Vlasenko
telnetd: do not use suferfluous static variable.
2007-06-21test: shrink a bitDenis Vlasenko
function old new delta test_main 5 434 +429 bb_test 473 - -473 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 429/-473) Total: -44 bytes text data bss dec hex filename 735073 3028 14408 752509 b7b7d busybox_old 735029 3028 14408 752465 b7b51 busybox_unstripped
2007-06-15- fix test -f ./existsBernhard Reutner-Fischer
Note that test -f ./exists -a "-u" = "-u" doesn't work and did not work even before r18282, so this is a breakage not caused by me..
2007-06-12- fix testing primary expressions like '"-u" = "-u"'Bernhard Reutner-Fischer
2007-06-08test: fix thinko in previous commitDenis Vlasenko
2007-06-08test: recognize /path/to/[ case tooDenis Vlasenko
2007-06-06- fix wrong not operator which was essentially ignored. got introduced in r18282Bernhard Reutner-Fischer
http://busybox.net/lists/busybox/2007-June/027652.html
2007-05-27test: close bug 1371Denis Vlasenko
test: plug a memory leak
2007-05-26usage.c: remove reference to busybox.hDenis Vlasenko
*: s/include "busybox.h"/include "libbb.h"
2007-05-01test: code size saving, no logic changesDenis Vlasenko
ps: fix warning, make a bit smaller kill -l: make smaller & know much more signals function old new delta get_signum 121 153 +32 kill_main 826 843 +17 get_signame 44 36 -8 signals 252 224 -28 .rodata 131955 131923 -32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/3 up/down: 49/-68) Total: -19 bytes
2007-04-10audit small applets and mark some of them as NOFORK.Denis Vlasenko
Put big scary warnings in relevant places.
2007-04-02test: comment out unused codeDenis Vlasenko
udpsvd: fake it compile tcpsvd: more optimal memorizing of IP's for -C