Denis Vlasenko
c0ea82a457
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
2009-03-23 06:33:37 +00:00
Mike Frysinger
ddbee974b4
move parse_stream out of ENABLE_HUSH_TICK to avoid implicit decl/build error
2009-03-22 22:48:41 +00:00
Denis Vlasenko
57abf9e947
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
2009-03-22 19:00:05 +00:00
Denis Vlasenko
3fd1046300
timeout: fix parsing of -t NUM on MMU
2009-03-22 14:49:00 +00:00
Denis Vlasenko
424f79b48f
hush: rearrange functions to reduce amount of forward references.
...
Minimal code changes.
2009-03-22 14:23:34 +00:00
Denis Vlasenko
e1300f6fc7
hush: fix segv at repeated "set -- a b c" + "shift"
2009-03-22 11:41:18 +00:00
Denis Vlasenko
786ce17d6d
hush: fix strcpy of potentially overlapping strings
2009-03-21 21:51:11 +00:00
Denis Vlasenko
ccff0b962c
msh testsuite: fix false positive, tweak run stript
2009-03-21 19:58:58 +00:00
Denis Vlasenko
3a014b85dc
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
2009-03-21 19:11:23 +00:00
Denis Vlasenko
05af832097
cpio: more compat: -0 and -L options
...
function old new delta
cpio_main 1417 1473 +56
2009-03-20 23:01:48 +00:00
Denis Vlasenko
83518d18a3
Compatibility fixes:
...
grep: support -z
find: support --mindepth
together +45 bytes
cpio: support -p (configurable, +230 bytes)
libbb: tweaks for cpio
2009-03-20 22:17:13 +00:00
Denis Vlasenko
0b28103cc7
cd: "support" -v by ignoring it
2009-03-20 14:04:00 +00:00
Denis Vlasenko
feecc7b74e
hush: tweak testsuite
2009-03-20 12:12:33 +00:00
Denis Vlasenko
a8b6dff97f
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
2009-03-20 12:05:14 +00:00
Denis Vlasenko
5368ad53e9
ash: expand comment
2009-03-20 10:20:08 +00:00
Denis Vlasenko
11fb7cf5af
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
2009-03-20 10:13:08 +00:00
Denis Vlasenko
1bb3d7e450
ash: add missing comma in debug scaffolding
2009-03-20 07:45:36 +00:00
Denis Vlasenko
b9e70ddf2d
ash: fix a case where we close wrong descriptor; add debug hack for that
2009-03-20 01:24:08 +00:00
Denis Vlasenko
f173395c4a
ash: DEBUG should be 0 :)
2009-03-19 23:21:55 +00:00
Denis Vlasenko
b21f379639
ash: fix TRACE commands
2009-03-19 23:09:58 +00:00
Denis Vlasenko
653d8e79b2
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
2009-03-19 21:59:35 +00:00
Denis Vlasenko
731de5ce76
doc update
2009-03-19 13:42:05 +00:00
Denis Vlasenko
4b875708c1
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
2009-03-19 13:30:04 +00:00
Denis Vlasenko
0354aba9a1
df: fix FEATURE_DF_FANCY=off, FEATURE_HUMAN_READABLE=on case.
2009-03-19 03:56:20 +00:00
Denis Vlasenko
7f88e34e1a
ash: tentatively fix bug 189.
2009-03-19 03:36:18 +00:00
Denis Vlasenko
5981ba5843
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
2009-03-19 02:35:44 +00:00
Denis Vlasenko
5c2b81470d
ash: fix "ash -c 'exec 1>&0'" complaining that fd 0 is busy
2009-03-19 01:59:59 +00:00
Denis Vlasenko
c1969f69b1
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
2009-03-18 22:39:34 +00:00
Denis Vlasenko
cbb4e61dd5
httpd: add comment explaining why SERVER_NAME etc is not set.
2009-03-18 20:00:46 +00:00
Denis Vlasenko
9f57cf6604
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
2009-03-18 17:32:44 +00:00
Denis Vlasenko
fce4a9454c
ftpd: add some comments
2009-03-18 16:02:54 +00:00
Denis Vlasenko
e3b840ce98
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
2009-03-18 14:25:28 +00:00
Denis Vlasenko
5b492ee876
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
2009-03-18 14:12:22 +00:00
Denis Vlasenko
1432cb4bd9
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
2009-03-18 00:45:00 +00:00
Denis Vlasenko
3a7a1eba2e
ftpd: document NLST format
2009-03-17 13:03:06 +00:00
Denis Vlasenko
1a82555108
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
2009-03-17 12:40:34 +00:00
Denis Vlasenko
edb0de4283
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
2009-03-17 12:23:24 +00:00
Denis Vlasenko
e6c94a611a
ftpd: tweak timeout code
2009-03-17 05:11:51 +00:00
Denis Vlasenko
99d71da1cf
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
2009-03-16 23:06:23 +00:00
Denis Vlasenko
074c9036b2
ftpd: fix thinko: set_nport takes port in network order
2009-03-16 21:01:41 +00:00
Denis Vlasenko
fbf5846ce1
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
2009-03-16 20:54:45 +00:00
Denis Vlasenko
43bb7bba3b
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
2009-03-16 19:54:06 +00:00
Denis Vlasenko
20c8216897
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
2009-03-16 16:19:53 +00:00
Denis Vlasenko
f2160b6a09
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
2009-03-16 14:53:54 +00:00
Denis Vlasenko
7a6766428e
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
2009-03-15 22:20:31 +00:00
Denis Vlasenko
9210a36495
tr: support -C as synonym to -c
2009-03-15 16:41:55 +00:00
Denis Vlasenko
fc58ba1298
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
2009-03-15 15:54:58 +00:00
Denis Vlasenko
823f10b8f0
sha: merge K[] for sha256 and 512
...
function old new delta
sha_K - 640 +640
sha256_process_block64 440 425 -15
sha512_process_block128 1336 1283 -53
K512_lo 320 - -320
K256 320 - -320
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 0/2 up/down: 640/-708) Total: -68 bytes
2009-03-15 04:56:51 +00:00
Denis Vlasenko
8ec8d5e3db
sha: fix thinko in sha512; add FAST_FUNC to sha1/sha256
...
function old new delta
sha512_process_block128 1334 1336 +2
sha1_hash 112 111 -1
sha256_process_block64 446 440 -6
sha1_process_block64 494 484 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-17) Total: -15 bytes
2009-03-15 02:56:00 +00:00
Denis Vlasenko
e9afc468fa
sha: merge sha1/sha256 handling (they are similar enough for this),
...
shrink sha215 code
function old new delta
sha1_end 129 142 +13
sha1_process_block64 486 494 +8
sha256_begin 37 44 +7
sha1_begin 49 56 +7
sha1_hash 108 112 +4
...
sha512_end 204 184 -20
sha512_process_block128 1405 1334 -71
sha256_process_block64 520 446 -74
sha256_end 147 - -147
sha512_hash 297 130 -167
sha256_hash 260 - -260
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 11/9 up/down: 59/-752) Total: -693 bytes
2009-03-15 02:28:05 +00:00