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
Denys Vlasenko
72089cf6b4
config: deindent all help texts
...
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-21 09:50:55 +02:00
Denys Vlasenko
4eed2c6c50
Update menuconfig items with approximate applet sizes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Denys Vlasenko
a8cf9c5a3f
libbb: new function bb_getgroups() - allocating wrapper around getgroups()
...
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-07-04 18:56:45 +02:00
Denys Vlasenko
265062d59d
shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_foo
...
This makes hash and ash more symmetrical wrt config menu and config
options.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10 15:13:30 +01:00
Denys Vlasenko
0b8835861b
Make it possible to select "sh" and "bash" aliases without selecting ash or hush
...
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-12-23 16:56:43 +01:00
Denys Vlasenko
15fb91cefb
test: make [ and [[ forms individually selectable
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 18:31:48 +01:00
Denys Vlasenko
af3f420116
Convert all coreutils/* applets to "new style" applet definitions
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 14:46:56 +01:00
Denys Vlasenko
42eeb255c1
test: fix compile error in last commit
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02 02:35:13 +02:00
Denys Vlasenko
de89205bdf
test: memory leak: free group id list
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02 01:49:13 +02:00
Denys Vlasenko
de5edadee2
special-case {true,false,test} --help
...
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>
2015-04-21 16:00:41 +02:00
Denys Vlasenko
98654b995b
test: fix mishandling of "test '(' = '('" and similar
...
function old new delta
test_main 246 350 +104
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-01 14:16:28 +02:00
Denys Vlasenko
60cb48ca50
whitespace cleanup. no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Denys Vlasenko
07fcaab595
test: "test !" was accessing argv past NULL - fix it. Closes 4832
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08 03:50:01 +01:00
Pere Orga
34425389e0
move help text from include/usage.src.h to coreutils/*.c
...
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31 14:43:25 +02:00
Denys Vlasenko
86cf0364bd
printenv: fix environ == NULL segfault
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08 12:44:02 +01:00
Denys Vlasenko
27c6c00a7c
test: add examples when "%s: unknown operand" happens
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-20 03:43:20 +01:00
Denys Vlasenko
fb132e4737
whitespace cleanup
...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Denys Vlasenko
0ef64bdb40
*: make GNU licensing statement forms more regular
...
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-08-16 20:14:46 +02:00
Denys Vlasenko
2f32bf8be6
remove defconfig. Now "make defconfig" simply uses defaults from Config.in
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Denys Vlasenko
e4070cb0d7
partially migrate coreutils to Config.src and Kbuild.src
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 19:59:49 +02:00
Denys Vlasenko
3e47cfec90
test: "" is not a valid number. Closes bug 1915
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-03 01:47:04 +02:00
Denys Vlasenko
c541a8955d
test: use index_in_strings
...
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-09-12 22:41:57 +02:00
Denys Vlasenko
d23f64eba7
test: fix "test !" and "test abc -a !". closes bug 465
...
function old new delta
nexpr 826 840 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-17 00:59:26 +02:00
Denys Vlasenko
82a6fb3ea6
ash: fix . builtin
...
Also, move [[ ]] comment to test.c and expand it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-14 19:42:12 +02:00
Denys Vlasenko
16635cc2e0
test, tcpsvd, tcpsvd: shrink
...
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>
2009-06-13 22:49:08 +02:00
Bernhard Reutner-Fischer
6c4dadefb6
- update my name. No obj-code changes ;)
2008-09-25 12:13:34 +00:00
Denis Vlasenko
bd28f6bf7f
test: fix parser to prefer binop over unop, as coreutils does.
...
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-19 08:15:13 +00:00
Denis Vlasenko
a60f84ebf0
*: rename ATTRIBUTE_XXX to just XXX.
2008-07-05 09:18:54 +00:00
Denis Vlasenko
77ad97f199
more -Wall warning fixes from Cristian Ionescu-Idbohrn.
...
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-05-13 02:27:31 +00:00
Denis Vlasenko
5d89fbaa2e
*: remove remaining instances of ".data" hack
2008-04-22 00:08:27 +00:00
Denis Vlasenko
574f2f4394
*: add optimization barrier to all "G trick" locations
2008-02-27 18:41:59 +00:00
Denis Vlasenko
1e2a7e4ed1
test: fix mishandling of 'test ! arg1 op arg2 more args'; add testsuite
2008-02-09 05:48:42 +00:00
Denis Vlasenko
6672c8e480
test: stop using lots of bss.
...
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-30 07:29:05 +00:00
Bernhard Reutner-Fischer
a702457eac
- remove most of the forward declarations. No obj-code changes.
2007-11-16 12:20:30 +00:00
Denis Vlasenko
fc5d15912c
test: correct confusing placement of "const"
2007-09-21 17:58:43 +00:00
Denis Vlasenko
dc757aa16c
introduce and use bb_basename()
...
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-30 08:04:05 +00:00
Denis Vlasenko
80b8b39899
Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms <wharms@bfs.de>)
2007-06-25 10:55:35 +00:00
Denis Vlasenko
88308fec80
test: suppress gcc warning
...
telnetd: do not use suferfluous static variable.
2007-06-25 10:35:11 +00:00
Denis Vlasenko
b304eadca8
test: shrink a bit
...
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-21 13:35:52 +00:00
Bernhard Reutner-Fischer
be99243945
- fix test -f ./exists
...
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-15 10:36:49 +00:00
Bernhard Reutner-Fischer
fdcbc4e709
- fix testing primary expressions like '"-u" = "-u"'
2007-06-12 13:21:08 +00:00
Denis Vlasenko
dc4ab54ea7
test: fix thinko in previous commit
2007-06-08 07:59:54 +00:00
Denis Vlasenko
89bca27158
test: recognize /path/to/[ case too
2007-06-08 07:33:45 +00:00
Bernhard Reutner-Fischer
e8b2bd4d47
- fix wrong not operator which was essentially ignored. got introduced in r18282
...
http://busybox.net/lists/busybox/2007-June/027652.html
2007-06-06 19:27:58 +00:00
Denis Vlasenko
fe3e1776ad
test: close bug 1371
...
test: plug a memory leak
2007-05-27 03:39:50 +00:00
Denis Vlasenko
b6adbf1be2
usage.c: remove reference to busybox.h
...
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
dcf4de20a1
test: code size saving, no logic changes
...
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-05-01 20:07:29 +00:00
Denis Vlasenko
99912ca733
audit small applets and mark some of them as NOFORK.
...
Put big scary warnings in relevant places.
2007-04-10 15:43:37 +00:00
Denis Vlasenko
729bd9e0b0
test: comment out unused code
...
udpsvd: fake it compile
tcpsvd: more optimal memorizing of IP's for -C
2007-04-02 12:37:28 +00:00