Commit Graph

10273 Commits

Author SHA1 Message Date
Denys Vlasenko
a99aa6e9c4 readlink: support -n, -v, -s and -q too if support for -f is requested
function                                             old     new   delta
readlink_main                                        104     135     +31
packed_usage                                       26322   26321      -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 31/-1)              Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-12 13:16:21 +02:00
Denys Vlasenko
641dd7b080 ash: revert over-zealous usage of FAST_FUNC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-11 19:30:19 +02:00
Denys Vlasenko
77539190ab added comments about [[ ]] to ash and hush. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-10 14:09:48 +02:00
Denys Vlasenko
9ca656b149 hush: add HUSH_BASH_COMPAT, make [[ special handling depend on it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-10 13:39:35 +02:00
Denys Vlasenko
1d77db8459 telnetd: more compact version of the fix for stray open fds
function                                             old     new   delta
telnetd_main                                        1520    1527      +7
make_new_session                                     510     416     -94
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-94)             Total: -87 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-10 13:38:08 +02:00
Denys Vlasenko
a4bcbd0e04 telnetd: properly close fds in child
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 23:01:24 +02:00
Denys Vlasenko
9d617c44d2 hush: specially handle [[ - suppress globbing & multiword expansion
It's a bashism, but is surprisingly easy to do and costs very little code.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 18:40:52 +02:00
Denys Vlasenko
2634bf366b randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 18:40:07 +02:00
Denys Vlasenko
38d9072b2c diff: tiny compat tweak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-09 12:55:13 +02:00
Denys Vlasenko
764b2f0ec0 hush: drop REDIRECT_INVALID; other minor tweaks
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07 16:05:04 +02:00
Denys Vlasenko
df5131cf3d hush: fix a segfault in export builtin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07 16:04:17 +02:00
Denys Vlasenko
8f24f9812d stop using non-standard macro, use WEXITSTATUS instead
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07 16:02:00 +02:00
Denys Vlasenko
d6b05eb9c2 hush: make builtins work in pipes (eval ... | ...) on NOMMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-06 20:59:55 +02:00
Denys Vlasenko
62152da892 ifupdown: if $PATH is not set, do not set it to "" in children
Also random code shrink:

function                                             old     new   delta
set_environ                                          328     330      +2
static.label_buf                                       4       -      -4
startup_PATH                                           4       -      -4
my_environ                                             4       -      -4
ifupdown_main                                       2148    2134     -14
setlocalenv                                          117      90     -27
get_var                                              139     112     -27
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 1/3 up/down: 2/-80)             Total: -78 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 21:53:11 +02:00
Denys Vlasenko
035b4d77dc ftpd: allow multiple -S options to increase verbosity too, like -v
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 20:42:40 +02:00
Denys Vlasenko
71016baf55 printf: accept negative numbers for %x; sh: overflowed numbers are 0
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 16:24:29 +02:00
Denys Vlasenko
0f952c249e inetd: comment why we redirect stderr to network
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 15:35:36 +02:00
Denys Vlasenko
53f1791212 *: reduce #ifdef forest
Remove unnecessary #if statements from the "more", "script", and
"scriptreplay" commands.  Bloatcheck says 0 bytes changed.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 14:55:26 +02:00
Denys Vlasenko
d5f1b1bbe0 *: add FAST_FUNC to function ptrs where it makes sense
function                                             old     new   delta
evalcommand                                         1195    1209     +14
testcmd                                                -      10     +10
printfcmd                                              -      10     +10
echocmd                                                -      10     +10
func_exec                                            270     276      +6
echo_dg                                              104     109      +5
store_nlmsg                                           85      89      +4
pseudo_exec_argv                                     195     198      +3
dotcmd                                               287     290      +3
machtime_stream                                       29      31      +2
discard_stream                                        24      26      +2
argstr                                              1299    1301      +2
killcmd                                              108     109      +1
evalfor                                              226     227      +1
daytime_stream                                        43      44      +1
run_list                                            2544    2543      -1
lookupvar                                             62      61      -1
ipaddr_modify                                       1310    1309      -1
...
parse_stream                                        2254    2245      -9
evalpipe                                             356     347      -9
collect_if                                           210     197     -13
read_opt                                             869     851     -18
handle_dollar                                        681     658     -23
print_addrinfo                                      1342    1303     -39
iterate_on_dir                                       156      59     -97
print_route                                         1709    1609    -100
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767)       Total: -693 bytes
   text    data     bss     dec     hex filename
 841748     467    7872  850087   cf8a7 busybox_old
 841061     467    7872  849400   cf5f8 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 12:06:05 +02:00
Denys Vlasenko
8507e1f109 ftpd: fix a case when with -w unknown commands are ignored with no error code
Signed-off-by: Stefan Seyfried <seife@suse.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-04 19:03:20 +02:00
Bernhard Reutner-Fischer
a43972cb0f rename CONFIG_FEATURE_TAR_GZIP
CONFIG_FEATURE_TAR_GZIP was renamed to CONFIG_FEATURE_SEAMLESS_GZ.
  Adjust testsuite accordingly.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-06-03 20:35:26 +02:00
Denys Vlasenko
dc2bbb9669 tweak docs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 15:19:03 +02:00
Denys Vlasenko
0821801349 hush: document a TODO in export builtin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 14:43:56 +02:00
Denys Vlasenko
6f22624a91 hush: fix a case when backgrounded cmd makes shell hang
Signed-off-by: Bayram Kurumahmut <kbayram@ubicom.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 14:37:30 +02:00
Denys Vlasenko
295fef80bc hush: add support for local builtin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-03 12:47:26 +02:00
Mike Frysinger
98f74034cd bloat-o-meter: touchup argv handling
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reported-by: Matt Mackall <mpm@selenic.com>
2009-06-01 16:37:27 -04:00
Mike Frysinger
5177e28e9c bloat-o-meter: fix tab/space mixing
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 16:34:11 -04:00
Mike Frysinger
eab40e5885 hush_test: stop mixing tabs/spaces for indentation
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 16:33:05 -04:00
Mike Frysinger
a1e5ebe9bd gitignore: add debugging related files
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
6a46ab8b8f hush: unify syntax_error_unterm_{ch,str} a bit
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
ef3e7fdd3b hush: push down expansion var in handle_dollar()
Declare the variable in the scope it is used rather than the entire
function scope so it's obvious it is only used there.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
dc3bc40578 hush: add support for special vars in braces
Some people like to use ${?} rather than $?, so make sure we support all
the special single char vars that use this form.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
ff64fb9e31 hush_test: filter test output to avoid C lib differences
The getopt function in some C libraries wraps the option in single quotes
while others do not.  Avoid the issue by running sed on the output and
strip all quotes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Mike Frysinger
f524b6c87f lineedit: fix warning about unused label when VI editing is disabled
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-06-01 14:16:43 -04:00
Denys Vlasenko
28a105d867 nc, hush: cosmetic cleanups, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-01 11:26:30 +02:00
Denys Vlasenko
4b7db4f2ca read_key: drop optimization where we read 3 bytes at once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-29 10:39:06 +02:00
Denys Vlasenko
171932d7ca hust: trivial simplification in builtin_type
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 17:07:22 +02:00
Denys Vlasenko
e640cb4ad1 hush: fix bug 353 (wrong handling of \x in assignments)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 16:49:11 +02:00
Denys Vlasenko
5d7cca2090 hush: optimize type builtin a bit more
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 09:58:43 +02:00
Denys Vlasenko
dd6b211921 hush: optimize type builtin a bit
function                                             old     new   delta
builtin_type                                         130     125      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 09:45:50 +02:00
Mike Frysinger
b9f2bb36ea only build common libarchive objs when needed
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-28 00:47:14 -04:00
Denys Vlasenko
f3cbfc0e2c modprobe: fix more bugs in modprobe -r
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 03:54:29 +02:00
Denys Vlasenko
398c659970 cpio.tests: fix false positive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 02:03:29 +02:00
Mike Frysinger
93cadc2fdd hush: implement type
Implement support for the POSIX `type` command.  Only POSIX stuff is
supported here, no bash extensions like -p or -P.

In the process, split the $PATH searching code out of builtin_source() and
into its own find_in_path() function so we don't duplicate it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-27 17:06:25 -04:00
Denys Vlasenko
673e945052 hush: remove outdated TODO and superfluous macro; fix compile breakage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-27 14:39:35 +02:00
David Krakov
29ec116037 POSIX conformance documentation for busybox
Attached a start for POSIX conformance documentation for busybox (see
TODO file and discussion last week).
A table of all options as defined by POSIX and as implemented by
busybox (see for a FreeBSD example
http://people.freebsd.org/~schweikh/posix-utilities.html).

Only the tools that are stand-alone applets are documented (not ash
built-ins as 'read'), as there are multiple shells.
When there are two versions (echo) the stand-alone version was
checked. I think this may be the wrong way to go, as most users will
probably use the built-in version - but which shell?

The table was auto-generated by running, for each POSIX utility,
latest git allyesconfig* "busybox <tool> --help" and parsing the
output, and comparing that to tool options extracted from its man page
at http://www.opengroup.org/onlinepubs/9699919799/.
This means that it the usage string is not correct, the table is also
wrong. I noticed that for 'kill', for example, the usage string does
not mention the -s, -q, -o options.
For each option is set whether it exists in busybox and if it is, is
it compliant to the standard. Of course, checking compliance can only
be done manually - a process which will probably take some time (see
'cat' for example).

I didn't post the auto-generation script (python, ugly) because the
table will now change manually; I can post it if there is anyone
interested.

As for the tools not implemented by busybox at all, I think most of
them are indeed fairly esotetic. Some I was suprised to see missing
are link, file, newgrp, unlink.

* Well, almost allyesconfig - but nothing very POSIX-y was disabled.

Signed-off-by: David Krakov <krakov@gmail.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-26 19:42:34 -04:00
Denys Vlasenko
68759edb6e hush: tweak comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-26 14:39:41 +02:00
Denys Vlasenko
e2df5f46d0 hush: rename last_waitpid_was_0 to we_have_children
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-26 14:34:10 +02:00
Denys Vlasenko
140def848c modprobe: fix modprobe -r. closes bug 315
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-26 12:48:34 +02:00
Denys Vlasenko
8d7be232a3 hush: fix SIGCHLD counting code, but keep it disabled for now.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-25 16:38:32 +02:00