oweals/busybox.git
15 years agoash: add/improve comments, no code changes
Denis Vlasenko [Tue, 31 Mar 2009 19:36:58 +0000 (19:36 -0000)]
ash: add/improve comments, no code changes

15 years agoash: fix $IFS handling in read. closes bug 235
Denis Vlasenko [Tue, 31 Mar 2009 19:18:17 +0000 (19:18 -0000)]
ash: fix $IFS handling in read. closes bug 235

15 years agohush: fix wait builtin
Denis Vlasenko [Tue, 31 Mar 2009 17:24:49 +0000 (17:24 -0000)]
hush: fix wait builtin

function                                             old     new   delta
builtin_wait                                         174     275    +101
sigwaitinfo                                            -      48     +48
__GI_sigwaitinfo                                       -      48     +48
check_and_run_traps                                  133     169     +36
checkjobs                                            349     380     +31
hush_main                                            971     991     +20
static.zero_timespec                                   -       8      +8
run_list                                            2010    2016      +6
file_get                                             254     260      +6
static.zero_ts                                         8       -      -8
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 6/0 up/down: 304/-8)            Total: 296 bytes

15 years agolibbb: fix typo in comment
Denis Vlasenko [Tue, 31 Mar 2009 13:14:18 +0000 (13:14 -0000)]
libbb: fix typo in comment

15 years agohush: don't lie in comment
Denis Vlasenko [Tue, 31 Mar 2009 13:13:17 +0000 (13:13 -0000)]
hush: don't lie in comment

15 years agohush: fix comments, no code changes
Denis Vlasenko [Tue, 31 Mar 2009 13:05:32 +0000 (13:05 -0000)]
hush: fix comments, no code changes

15 years agohush: make ^C work again, ^Z probably isn't working
Denis Vlasenko [Tue, 31 Mar 2009 12:41:52 +0000 (12:41 -0000)]
hush: make ^C work again, ^Z probably isn't working

function                                             old     new   delta
file_get                                             219     254     +35
check_and_run_traps                                  122     133     +11
run_list                                            2001    2010      +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 55/0)               Total: 55 bytes

15 years agohush: do not reset sighaldlers after fork - instead, prevent them from doing any...
Denis Vlasenko [Tue, 31 Mar 2009 12:03:40 +0000 (12:03 -0000)]
hush: do not reset sighaldlers after fork - instead, prevent them from doing any harm
 if they will be called. saves many sigaction calls on every fork.

function                                             old     new   delta
hush_main                                            887     971     +84
sigexit                                               54      65     +11
run_list                                            2006    2001      -5
maybe_set_sighandler                                  76      50     -26
set_fatal_sighandler                                 186       -    -186
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/2 up/down: 95/-217)          Total: -122 bytes

15 years agohush: rework signal and trap handling. Some smaller bits are TODO,
Denis Vlasenko [Tue, 31 Mar 2009 11:22:57 +0000 (11:22 -0000)]
hush: rework signal and trap handling. Some smaller bits are TODO,
 expect minor breakage

function                                             old     new   delta
set_fatal_sighandler                                  12     186    +174
check_and_run_traps                                    -     122    +122
maybe_set_sighandler                                   -      76     +76
hush_main                                            831     887     +56
sigtimedwait                                           -      50     +50
__GI_sigtimedwait                                      -      50     +50
hush_exit                                             49      93     +44
set_mode                                             749     777     +28
pseudo_exec_argv                                     131     151     +20
static.zero_ts                                         -       8      +8
expand_variables                                    1962    1970      +8
builtin_wait                                         172     174      +2
set_misc_sighandler                                   12       -     -12
set_jobctrl_sighandler                                12       -     -12
handler_ctrl_c                                        16       -     -16
builtin_set_mode                                      28       -     -28
handle_trap                                           97       -     -97
handler_ctrl_z                                       107       -    -107
builtin_trap                                         545     438    -107
run_list                                            2149    2006    -143
------------------------------------------------------------------------------
(add/remove: 5/6 grow/shrink: 7/2 up/down: 638/-522)          Total: 116 bytes

15 years agoimplement `unset` semantics as required by POSIX
Mike Frysinger [Mon, 30 Mar 2009 06:50:54 +0000 (06:50 -0000)]
implement `unset` semantics as required by POSIX

15 years agofix DOC build output to be like kbuild standard
Mike Frysinger [Mon, 30 Mar 2009 05:26:34 +0000 (05:26 -0000)]
fix DOC build output to be like kbuild standard

15 years agoupdate `trap` poisx link
Mike Frysinger [Mon, 30 Mar 2009 03:50:07 +0000 (03:50 -0000)]
update `trap` poisx link

15 years agodo not automatically display job information when the shell is not interactive
Mike Frysinger [Mon, 30 Mar 2009 00:19:30 +0000 (00:19 -0000)]
do not automatically display job information when the shell is not interactive

15 years agoenable trap tests
Mike Frysinger [Sun, 29 Mar 2009 23:49:46 +0000 (23:49 -0000)]
enable trap tests

15 years agofirst pass at `trap` support in hush
Mike Frysinger [Sun, 29 Mar 2009 23:49:37 +0000 (23:49 -0000)]
first pass at `trap` support in hush

15 years agomodutils: dont pass NULL options to init_module()
Denis Vlasenko [Sun, 29 Mar 2009 17:25:14 +0000 (17:25 -0000)]
modutils: dont pass NULL options to init_module()

15 years agobuild system: hdparm -d is not that dangerous, remove warning
Denis Vlasenko [Sun, 29 Mar 2009 17:13:20 +0000 (17:13 -0000)]
build system: hdparm -d is not that dangerous, remove warning

15 years agosendmail: add more example in usage text
Denis Vlasenko [Sun, 29 Mar 2009 16:53:25 +0000 (16:53 -0000)]
sendmail: add more example in usage text

15 years agomodule loading for 2.4: use fd-based io instead of FILE based;
Denis Vlasenko [Sun, 29 Mar 2009 16:38:59 +0000 (16:38 -0000)]
module loading for 2.4: use fd-based io instead of FILE based;
 use xlseek and xread; simpler check for ELF signature.

   text    data     bss     dec     hex filename
 824460     476    7616  832552   cb428 busybox_old
 824333     476    7616  832425   cb3a9 busybox_unstripped

15 years agoadd test cases for `trap` ... but disabled for now until trap support is committed
Mike Frysinger [Sun, 29 Mar 2009 09:54:40 +0000 (09:54 -0000)]
add test cases for `trap` ... but disabled for now until trap support is committed

15 years agosysctl: move code around to get rid of forward references.
Denis Vlasenko [Sun, 29 Mar 2009 02:23:16 +0000 (02:23 -0000)]
sysctl: move code around to get rid of forward references.
 (incidentally it helps gcc to make code smaller)

15 years agosysctl: fix broken -p [file] - close bug 231
Denis Vlasenko [Sun, 29 Mar 2009 02:22:19 +0000 (02:22 -0000)]
sysctl: fix broken -p [file] - close bug 231

15 years agomark msh as deprecated
Mike Frysinger [Sun, 29 Mar 2009 00:52:41 +0000 (00:52 -0000)]
mark msh as deprecated

15 years agouse bb_strtou() in umask/wait and check errno to see if there was a problem rather...
Mike Frysinger [Sun, 29 Mar 2009 00:50:30 +0000 (00:50 -0000)]
use bb_strtou() in umask/wait and check errno to see if there was a problem rather than using endp

15 years agomake sure we check job status whenever updating the prompt
Mike Frysinger [Sun, 29 Mar 2009 00:45:26 +0000 (00:45 -0000)]
make sure we check job status whenever updating the prompt

15 years agotest for invalid named variables
Mike Frysinger [Sat, 28 Mar 2009 21:06:38 +0000 (21:06 -0000)]
test for invalid named variables

15 years agodo not let handle_dollar() accept vars that start with a digit
Mike Frysinger [Sat, 28 Mar 2009 21:06:22 +0000 (21:06 -0000)]
do not let handle_dollar() accept vars that start with a digit

15 years agoimplement `wait` builtin
Mike Frysinger [Sat, 28 Mar 2009 20:01:58 +0000 (20:01 -0000)]
implement `wait` builtin

15 years agoremove ((expr)) bash'ism
Denis Vlasenko [Sat, 28 Mar 2009 19:31:34 +0000 (19:31 -0000)]
remove ((expr)) bash'ism

15 years agorandomconfig fix
Denis Vlasenko [Sat, 28 Mar 2009 19:22:08 +0000 (19:22 -0000)]
randomconfig fix

15 years agoupdate the normally disabled debug code around the syntax() func to use new maybe_die()
Mike Frysinger [Sat, 28 Mar 2009 19:09:04 +0000 (19:09 -0000)]
update the normally disabled debug code around the syntax() func to use new maybe_die()

15 years agorandomtest fixes
Denis Vlasenko [Sat, 28 Mar 2009 19:08:23 +0000 (19:08 -0000)]
randomtest fixes

15 years agoadd hush tests for parameter expansion
Mike Frysinger [Sat, 28 Mar 2009 18:55:34 +0000 (18:55 -0000)]
add hush tests for parameter expansion

15 years agoimplement most POSIX parameter expansions (~+500bytes)
Mike Frysinger [Sat, 28 Mar 2009 18:55:03 +0000 (18:55 -0000)]
implement most POSIX parameter expansions (~+500bytes)

15 years agomake sure we exit based on test failure rather than always exiting with 0
Mike Frysinger [Sat, 28 Mar 2009 15:43:47 +0000 (15:43 -0000)]
make sure we exit based on test failure rather than always exiting with 0

15 years agosplit up feature todo by posix/bash
Mike Frysinger [Sat, 28 Mar 2009 13:59:26 +0000 (13:59 -0000)]
split up feature todo by posix/bash

15 years agounify `set` handling with command line processing, fixup `set` argv processing so...
Mike Frysinger [Sat, 28 Mar 2009 13:44:51 +0000 (13:44 -0000)]
unify `set` handling with command line processing, fixup `set` argv processing so it doesnt clobber argv when setting options, and barf on unhandled set options

15 years agohandle the "-s" command line option that POSIX requires
Mike Frysinger [Sat, 28 Mar 2009 13:02:11 +0000 (13:02 -0000)]
handle the "-s" command line option that POSIX requires

15 years agorename "-f" (fake) option to "-n" to match POSIX
Mike Frysinger [Sat, 28 Mar 2009 12:57:54 +0000 (12:57 -0000)]
rename "-f" (fake) option to "-n" to match POSIX

15 years agotweak format modifier in debug code to fixup gcc warning
Mike Frysinger [Sat, 28 Mar 2009 12:43:53 +0000 (12:43 -0000)]
tweak format modifier in debug code to fixup gcc warning

15 years agoconvert some of the ENABLE_FEATURE_EDITING from CPP if to C if
Mike Frysinger [Sat, 28 Mar 2009 12:24:44 +0000 (12:24 -0000)]
convert some of the ENABLE_FEATURE_EDITING from CPP if to C if

15 years agostop lying about [[ test support
Mike Frysinger [Sat, 28 Mar 2009 12:21:57 +0000 (12:21 -0000)]
stop lying about [[ test support

15 years agomkfs.vfat: fix a problem with over-estimating FAT size
Denis Vlasenko [Sat, 28 Mar 2009 12:17:20 +0000 (12:17 -0000)]
mkfs.vfat: fix a problem with over-estimating FAT size

15 years agomake lash deprecation more prominent
Mike Frysinger [Sat, 28 Mar 2009 12:12:58 +0000 (12:12 -0000)]
make lash deprecation more prominent

15 years agomkfs.vfat: mkdosfs compat with choosing clyster size
Denis Vlasenko [Sat, 28 Mar 2009 03:22:08 +0000 (03:22 -0000)]
mkfs.vfat: mkdosfs compat with choosing clyster size

15 years agomkfs.vfat: more of pointless tweaking
Denis Vlasenko [Sat, 28 Mar 2009 02:28:58 +0000 (02:28 -0000)]
mkfs.vfat: more of pointless tweaking

15 years agomkfs.vfat: small tweak to comments
Denis Vlasenko [Sat, 28 Mar 2009 02:18:49 +0000 (02:18 -0000)]
mkfs.vfat: small tweak to comments

15 years agomkdosfs (aka mkfs.vfat): new applet by Vladimir
Denis Vlasenko [Sat, 28 Mar 2009 02:13:01 +0000 (02:13 -0000)]
mkdosfs (aka mkfs.vfat): new applet by Vladimir

   text    data     bss     dec     hex filename
 821202     476    7616  829294   ca76e busybox_old
 823577     476    7616  831669   cb0b5 busybox_unstripped

15 years agols: warning fix
Denis Vlasenko [Fri, 27 Mar 2009 17:22:00 +0000 (17:22 -0000)]
ls: warning fix
rm: accept and ignore -v (verbose)

15 years agotail: fix tail +N syntax not working. Closes bug 221.
Denis Vlasenko [Fri, 27 Mar 2009 02:36:02 +0000 (02:36 -0000)]
tail: fix tail +N syntax not working. Closes bug 221.

15 years agoenable most job functions on no-mmu systems
Mike Frysinger [Thu, 26 Mar 2009 18:14:16 +0000 (18:14 -0000)]
enable most job functions on no-mmu systems

15 years agotftp: when we infer local name from remote (-r [/]path/path/file),
Denis Vlasenko [Wed, 25 Mar 2009 03:55:53 +0000 (03:55 -0000)]
tftp: when we infer local name from remote (-r [/]path/path/file),
 strip path. This mimics wget and is generally more intuitive.

15 years agodo not make startup banner depend on job support
Mike Frysinger [Mon, 23 Mar 2009 08:44:02 +0000 (08:44 -0000)]
do not make startup banner depend on job support

15 years agolibbb: revent previous version of "concurrent history updating"
Denis Vlasenko [Mon, 23 Mar 2009 06:33:37 +0000 (06:33 -0000)]
libbb: revent previous version of "concurrent history updating"
and replace it with one which does not "snoop" history written
by others. (1) it is what bug 185 needs, and (2) it is less bloaty:

function                                             old     new   delta
load_history                                           -     252    +252
read_line_input                                     3155    3287    +132
next_token                                           914     918      +4
qrealloc                                              36      33      -3
getoptscmd                                           713     708      -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 388/-8)            Total: 380 bytes

15 years agomove parse_stream out of ENABLE_HUSH_TICK to avoid implicit decl/build error
Mike Frysinger [Sun, 22 Mar 2009 22:48:41 +0000 (22:48 -0000)]
move parse_stream out of ENABLE_HUSH_TICK to avoid implicit decl/build error

15 years agolibbb: make history saving/loading concurrent-safe
Denis Vlasenko [Sun, 22 Mar 2009 19:00:05 +0000 (19:00 -0000)]
libbb: make history saving/loading concurrent-safe
* all history writers always append (not overwrite) history files
* they reload history if they detect that file length has changed since last
write
* they trim history file only when it grows 4 times longer than MAXLINES
* they do this atomically by creating new file and renaming it to old

Unfortunately, this comes at a price:

function                                             old     new   delta
load_history                                           -     346    +346
read_line_input                                     3155    3358    +203
new_line_input_t                                      17      31     +14
...irrelevant small jitter...
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/5 up/down: 573/-13)           Total: 560 bytes

15 years agotimeout: fix parsing of -t NUM on MMU
Denis Vlasenko [Sun, 22 Mar 2009 14:49:00 +0000 (14:49 -0000)]
timeout: fix parsing of -t NUM on MMU

15 years agohush: rearrange functions to reduce amount of forward references.
Denis Vlasenko [Sun, 22 Mar 2009 14:23:34 +0000 (14:23 -0000)]
hush: rearrange functions to reduce amount of forward references.
 Minimal code changes.

15 years agohush: fix segv at repeated "set -- a b c" + "shift"
Denis Vlasenko [Sun, 22 Mar 2009 11:41:18 +0000 (11:41 -0000)]
hush: fix segv at repeated "set -- a b c" + "shift"

15 years agohush: fix strcpy of potentially overlapping strings
Denis Vlasenko [Sat, 21 Mar 2009 21:51:11 +0000 (21:51 -0000)]
hush: fix strcpy of potentially overlapping strings

15 years agomsh testsuite: fix false positive, tweak run stript
Denis Vlasenko [Sat, 21 Mar 2009 19:58:58 +0000 (19:58 -0000)]
msh testsuite: fix false positive, tweak run stript

15 years agols: make readlink error to not disrupt output (try ls -l /proc/self/fd).
Denis Vlasenko [Sat, 21 Mar 2009 19:11:23 +0000 (19:11 -0000)]
ls: make readlink error to not disrupt output (try ls -l /proc/self/fd).
libbb: make xmalloc_readlink_or_warn warning more specific.

function                                             old     new   delta
xmalloc_readlink_or_warn                              33      61     +28
showfiles                                           1495    1460     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 28/-35)             Total: -7 bytes

15 years agocpio: more compat: -0 and -L options
Denis Vlasenko [Fri, 20 Mar 2009 23:01:48 +0000 (23:01 -0000)]
cpio: more compat: -0 and -L options

function                                             old     new   delta
cpio_main                                           1417    1473     +56

15 years agoCompatibility fixes:
Denis Vlasenko [Fri, 20 Mar 2009 22:17:13 +0000 (22:17 -0000)]
Compatibility fixes:

grep: support -z
find: support --mindepth
  together +45 bytes
cpio: support -p (configurable, +230 bytes)
libbb: tweaks for cpio

15 years agocd: "support" -v by ignoring it
Denis Vlasenko [Fri, 20 Mar 2009 14:04:00 +0000 (14:04 -0000)]
cd: "support" -v by ignoring it

15 years agohush: tweak testsuite
Denis Vlasenko [Fri, 20 Mar 2009 12:12:33 +0000 (12:12 -0000)]
hush: tweak testsuite

15 years agohush: fix bug 207 and "hush -c" parameter passing.
Denis Vlasenko [Fri, 20 Mar 2009 12:05:14 +0000 (12:05 -0000)]
hush: fix bug 207 and "hush -c" parameter passing.
 Now hush -c 'printf "%s\n" "$@"' (prints "\n")
 and hush -c 'printf "%s\n" "$@"' qwe asd (prints "asd\n")
 both work correctly

15 years agoash: expand comment
Denis Vlasenko [Fri, 20 Mar 2009 10:20:08 +0000 (10:20 -0000)]
ash: expand comment

15 years agohush: fix set [--] params. Closes bug 199.
Denis Vlasenko [Fri, 20 Mar 2009 10:13:08 +0000 (10:13 -0000)]
hush: fix set [--] params. Closes bug 199.

function                                             old     new   delta
builtin_set                                           55     194    +139
add_strings_to_strings                                 -     130    +130
add_string_to_strings                                110      26     -84
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 269/-84)           Total: 185 bytes

15 years agoash: add missing comma in debug scaffolding
Denis Vlasenko [Fri, 20 Mar 2009 07:45:36 +0000 (07:45 -0000)]
ash: add missing comma in debug scaffolding

15 years agoash: fix a case where we close wrong descriptor; add debug hack for that
Denis Vlasenko [Fri, 20 Mar 2009 01:24:08 +0000 (01:24 -0000)]
ash: fix a case where we close wrong descriptor; add debug hack for that

15 years agoash: DEBUG should be 0 :)
Denis Vlasenko [Thu, 19 Mar 2009 23:21:55 +0000 (23:21 -0000)]
ash: DEBUG should be 0 :)

15 years agoash: fix TRACE commands
Denis Vlasenko [Thu, 19 Mar 2009 23:09:58 +0000 (23:09 -0000)]
ash: fix TRACE commands

15 years agoash: make evaltree save/restore int suppression depth.
Denis Vlasenko [Thu, 19 Mar 2009 21:59:35 +0000 (21:59 -0000)]
ash: make evaltree save/restore int suppression depth.
 Hopefully this fixes bug 189. Not confirmed by users yet.

function                                             old     new   delta
evaltree                                             809     842     +33
evalvar                                             1374    1376      +2

15 years agodoc update
Denis Vlasenko [Thu, 19 Mar 2009 13:42:05 +0000 (13:42 -0000)]
doc update

15 years agoash: in dotrap(), do not clear gotsig[] for SIGINT if there is no handler
Denis Vlasenko [Thu, 19 Mar 2009 13:30:04 +0000 (13:30 -0000)]
ash: in dotrap(), do not clear gotsig[] for SIGINT if there is no handler
 for it, otherwise raise interrupt gets confused later.
 The rest are readability fixes.

function                                             old     new   delta
evaltreenr                                           817     818      +1
evaltree                                             817     818      +1
evalstring                                            88      89      +1
cmdloop                                              420     419      -1
evalskip                                               4       1      -3
breakcmd                                              84      81      -3
ash_main                                            1382    1379      -3
evalloop                                             183     177      -6
evalfor                                              231     225      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/6 up/down: 3/-22)             Total: -19 bytes

15 years agodf: fix FEATURE_DF_FANCY=off, FEATURE_HUMAN_READABLE=on case.
Denis Vlasenko [Thu, 19 Mar 2009 03:56:20 +0000 (03:56 -0000)]
df: fix FEATURE_DF_FANCY=off, FEATURE_HUMAN_READABLE=on case.

15 years agoash: tentatively fix bug 189.
Denis Vlasenko [Thu, 19 Mar 2009 03:36:18 +0000 (03:36 -0000)]
ash: tentatively fix bug 189.

15 years agoinit: test for vt terminal with VT_OPENQRY,
Denis Vlasenko [Thu, 19 Mar 2009 02:35:44 +0000 (02:35 -0000)]
init: test for vt terminal with VT_OPENQRY,
 assume that anything else is TERM=vt102, not TERM=linux.
 (Serial console test is less correct)
 Tentatively closes bug 195.

function                                             old     new   delta
init_main                                            946     919     -27

15 years agoash: fix "ash -c 'exec 1>&0'" complaining that fd 0 is busy
Denis Vlasenko [Thu, 19 Mar 2009 01:59:59 +0000 (01:59 -0000)]
ash: fix "ash -c 'exec 1>&0'" complaining that fd 0 is busy

15 years agols: make color-related code more readable. Fix a case when
Denis Vlasenko [Wed, 18 Mar 2009 22:39:34 +0000 (22:39 -0000)]
ls: make color-related code more readable. Fix a case when
 it was working non-deterministically.

function                                             old     new   delta
bold                                                   -      34     +34
showfiles                                           1508    1495     -13
fgcolor                                               50      34     -16
bgcolor                                               34       -     -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 34/-63)            Total: -29 bytes

15 years agohttpd: add comment explaining why SERVER_NAME etc is not set.
Denis Vlasenko [Wed, 18 Mar 2009 20:00:46 +0000 (20:00 -0000)]
httpd: add comment explaining why SERVER_NAME etc is not set.

15 years agoftpd: fix command fetching to not do it in 1-byte reads;
Denis Vlasenko [Wed, 18 Mar 2009 17:32:44 +0000 (17:32 -0000)]
ftpd: fix command fetching to not do it in 1-byte reads;
 fix command de-escaping. Tested to download files with embeeded \xff and LF.
libbb: tweaks for the above

function                                             old     new   delta
ftpd_main                                           2231    2321     +90
xmalloc_fgets_internal                               190     222     +32
xmalloc_fgets_str_len                                  -      27     +27
xmalloc_fgets_str                                      7      23     +16
xmalloc_fgetline_str                                  10      26     +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 181/0)             Total: 181 bytes

15 years agoftpd: add some comments
Denis Vlasenko [Wed, 18 Mar 2009 16:02:54 +0000 (16:02 -0000)]
ftpd: add some comments

15 years agoftpd: trim messages (but make sure they still make sense)
Denis Vlasenko [Wed, 18 Mar 2009 14:25:28 +0000 (14:25 -0000)]
ftpd: trim messages (but make sure they still make sense)
   text    data     bss     dec     hex filename
   4400       0       0    4400    1130 ftpd_old.o
   4346       0       0    4346    10fa ftpd.o

15 years agoftpd: do not use nasty tricks for re-execing if we are on MMU machine.
Denis Vlasenko [Wed, 18 Mar 2009 14:12:22 +0000 (14:12 -0000)]
ftpd: do not use nasty tricks for re-execing if we are on MMU machine.
On NOMMU, code is alomost the same, on MMU:

function                                             old     new   delta
handle_dir_common                                    223     390    +167
ftpd_main                                           2306    2231     -75
popen_ls                                             203       -    -203
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 167/-278)         Total: -111 bytes

15 years agoftpd: add support for MDTM, I see clients often use it,
Denis Vlasenko [Wed, 18 Mar 2009 00:45:00 +0000 (00:45 -0000)]
ftpd: add support for MDTM, I see clients often use it,
 it may allow client-side caching.

function                                             old     new   delta
ftpd_main                                           2232    2306     +74
gmtime_r                                               -      19     +19
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 93/0)               Total: 93 bytes

15 years agoftpd: document NLST format
Denis Vlasenko [Tue, 17 Mar 2009 13:03:06 +0000 (13:03 -0000)]
ftpd: document NLST format

15 years agoftpd: instead of wordy HELP, implement useful, and smaller, FEAT.
Denis Vlasenko [Tue, 17 Mar 2009 12:40:34 +0000 (12:40 -0000)]
ftpd: instead of wordy HELP, implement useful, and smaller, FEAT.
 (HELP is still "supported" as an alias to FEAT)

   text    data     bss     dec     hex filename
 807331     468    7856  815655   c7227 busybox_old
 807246     468    7856  815570   c71d2 busybox_unstripped

15 years agoftpd: implement -vv verbosity
Denis Vlasenko [Tue, 17 Mar 2009 12:23:24 +0000 (12:23 -0000)]
ftpd: implement -vv verbosity

function                                             old     new   delta
ftpd_main                                           2097    2190     +93
verbose_log                                            -      33     +33
cmdio_write_raw                                       12      34     +22
cmdio_write_ok                                        25      45     +20
cmdio_write_error                                     25      45     +20
cmdio_write                                           62      78     +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/0 up/down: 204/0)             Total: 204 bytes

15 years agoftpd: tweak timeout code
Denis Vlasenko [Tue, 17 Mar 2009 05:11:51 +0000 (05:11 -0000)]
ftpd: tweak timeout code

15 years agochat: update by Vladimir
Denis Vlasenko [Mon, 16 Mar 2009 23:06:23 +0000 (23:06 -0000)]
chat: update by Vladimir
 1) to treat timeout more correctly (timeout affects whole send command
    duration, not a single char);
 2) to recognize RECORD directive.

function                                             old     new   delta
chat_main                                           1246    1359    +113
exitcode                                               1       -      -1

15 years agoftpd: fix thinko: set_nport takes port in network order
Denis Vlasenko [Mon, 16 Mar 2009 21:01:41 +0000 (21:01 -0000)]
ftpd: fix thinko: set_nport takes port in network order

15 years agoftpd: dont use fdprintf for simple status messages
Denis Vlasenko [Mon, 16 Mar 2009 20:54:45 +0000 (20:54 -0000)]
ftpd: dont use fdprintf for simple status messages

function                                             old     new   delta
ftpd_main                                           2025    2055     +30
cmdio_write_ok                                        17      25      +8
cmdio_write_error                                     17      25      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 46/0)               Total: 46 bytes

15 years agoftpd: simplify PORT check by assuming IP = peer's IP.
Denis Vlasenko [Mon, 16 Mar 2009 19:54:06 +0000 (19:54 -0000)]
ftpd: simplify PORT check by assuming IP = peer's IP.
 Should be as safe as before this change.

function                                             old     new   delta
ftpd_main                                           2115    2025     -90

15 years agoftpd: add idle and absolute timeouts. This is a security issue,
Denis Vlasenko [Mon, 16 Mar 2009 16:19:53 +0000 (16:19 -0000)]
ftpd: add idle and absolute timeouts. This is a security issue,
 otherwise ftpd may end up hanging indefinitely.

function                                             old     new   delta
timeout_handler                                        -     110    +110
ftpd_main                                           2019    2115     +96
packed_usage                                       25662   25685     +23
handle_upload_common                                 306     322     +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 245/0)             Total: 245 bytes

15 years agoftpd: security tightened up:
Denis Vlasenko [Mon, 16 Mar 2009 14:53:54 +0000 (14:53 -0000)]
ftpd: security tightened up:
 PORT is not allowed on !IPv4
 PORT must have IP == peer's IP
 upload is allowed only into regular files

function                                             old     new   delta
ftpd_main                                           1815    2019    +204
handle_upload_common                                 260     306     +46
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 250/0)             Total: 250 bytes

15 years agoawk: fix compat issue found by gpm build
Denis Vlasenko [Sun, 15 Mar 2009 22:20:31 +0000 (22:20 -0000)]
awk: fix compat issue found by gpm build

function                                             old     new   delta
as_regex                                             105     131     +26
hash_find                                            247     233     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-14)             Total: 12 bytes

15 years agotr: support -C as synonym to -c
Denis Vlasenko [Sun, 15 Mar 2009 16:41:55 +0000 (16:41 -0000)]
tr: support -C as synonym to -c

15 years agoftpd: fix the bug where >2GB file ops report errors;
Denis Vlasenko [Sun, 15 Mar 2009 15:54:58 +0000 (15:54 -0000)]
ftpd: fix the bug where >2GB file ops report errors;
 make a few simplifications; add TODOs.

function                                             old     new   delta
port_or_pasv_was_seen                                  -      37     +37
get_remote_transfer_fd                               104     109      +5
handle_upload_common                                 265     260      -5
handle_dir_common                                    228     223      -5
popen_ls                                             211     203      -8
ftpd_main                                           1825    1815     -10
data_transfer_checks_ok                               37       -     -37
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/4 up/down: 42/-65)            Total: -23 bytes