oweals/busybox.git
10 years agoudhcpc: make hostname sanitization optional. Closes 3979
Denys Vlasenko [Sun, 15 Jun 2014 22:17:00 +0000 (00:17 +0200)]
udhcpc: make hostname sanitization optional. Closes 3979

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosyslogd: Unify unlink/truncate + unlock log-rotation logic
Joshua Judson Rosen [Tue, 20 May 2014 05:02:20 +0000 (01:02 -0400)]
syslogd: Unify unlink/truncate + unlock log-rotation logic

Always unlink + reopen, rather than sometimes using ftruncate();
using a single code-path reduces the opportunity for either
mistakes or duplicate code.

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosyslogd: remember to un-writelock log-files even when called with "-b 0"
Joshua Judson Rosen [Tue, 20 May 2014 05:02:19 +0000 (01:02 -0400)]
syslogd: remember to un-writelock log-files even when called with "-b 0"

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosyslogd: avoid spurious ftrunctate() calls for "-b 0"
Joshua Judson Rosen [Tue, 20 May 2014 05:02:18 +0000 (01:02 -0400)]
syslogd: avoid spurious ftrunctate() calls for "-b 0"

Forgetting to re-set log_file->size after truncating to zero
discards log-data for the next 1 second following an oversize-induced purge,
when we shouldn't necessarily throw that data away.

Signed-off-by: Joshua Judson Rosen <jrosen@harvestai.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe-small: fix safe_strncpy truncating last char of module name
Denys Vlasenko [Mon, 26 May 2014 13:01:13 +0000 (15:01 +0200)]
modprobe-small: fix safe_strncpy truncating last char of module name

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoAdd conditional support for -v / --verbose
Denys Vlasenko [Mon, 19 May 2014 14:23:50 +0000 (16:23 +0200)]
Add conditional support for -v / --verbose

With FEATURE_VERBOSE off, practically no size change.
With it on:

function                                             old     new   delta
remove_file                                          493     556     +63
install_main                                         719     765     +46
bb_make_directory                                    383     419     +36
rmdir_main                                           162     191     +29
copy_file                                           1516    1544     +28
mv_main                                              502     525     +23
cmp_main                                             677     693     +16
bbconfig_config_bz2                                 5264    5279     +15
mkdir_main                                           158     168     +10
install_longopts                                      66      76     +10
rm_main                                              167     175      +8
nexpr                                                840     846      +6
scan_tree                                            275     280      +5
fsck_main                                           1807    1811      +4
ed_main                                             2541    2545      +4
expand_one_var                                      1574    1575      +1
swap_on_off_main                                     420     418      -2
parse_command                                       1443    1440      -3
redirect                                            1279    1274      -5
do_load                                              946     918     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 16/4 up/down: 304/-38)          Total: 266 bytes

Based on the patch by Igor Živković.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogetty: explain when setsid() fails. no code changes
Denys Vlasenko [Sat, 10 May 2014 22:00:52 +0000 (00:00 +0200)]
getty: explain when setsid() fails. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoMerge branch 'master' of git+ssh://vda@busybox.net/var/lib/git/busybox
Denys Vlasenko [Sat, 10 May 2014 22:00:51 +0000 (00:00 +0200)]
Merge branch 'master' of git+ssh://vda@busybox.net/var/lib/git/busybox

10 years agotrylink: emit names of linked executables
Denys Vlasenko [Sat, 3 May 2014 14:35:15 +0000 (16:35 +0200)]
trylink: emit names of linked executables

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowhich: rewrite
Tito Ragusa [Sat, 3 May 2014 14:34:36 +0000 (16:34 +0200)]
which: rewrite

function                                             old     new   delta
which_main                                           237     212     -25

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotrylink: emit names of linked executables
Denys Vlasenko [Sat, 3 May 2014 14:35:15 +0000 (16:35 +0200)]
trylink: emit names of linked executables

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowhich: rewrite
Timo Teräs [Sat, 3 May 2014 14:34:36 +0000 (16:34 +0200)]
which: rewrite

function                                             old     new   delta
which_main                                           237     212     -25

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: rename execable -> executable. No code changes
Denys Vlasenko [Fri, 2 May 2014 15:15:58 +0000 (17:15 +0200)]
libbb: rename execable -> executable. No code changes

English speakers complained that it sounded awfully broken.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: fix empty PATH components handling
Denys Vlasenko [Fri, 2 May 2014 15:08:29 +0000 (17:08 +0200)]
libbb: fix empty PATH components handling

function                                             old     new   delta
find_execable                                         81      86      +5
exists_execable                                       71      66      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agortcwake: fix incorrect (reversed) rtc/sys adjuestment; code shrink
Denys Vlasenko [Fri, 2 May 2014 10:46:15 +0000 (12:46 +0200)]
rtcwake: fix incorrect (reversed) rtc/sys adjuestment; code shrink

function                                             old     new   delta
rtcwake_main                                         482     462     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: fix thinko in rtc_xopen()
Denys Vlasenko [Fri, 2 May 2014 07:07:16 +0000 (09:07 +0200)]
libbb: fix thinko in rtc_xopen()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: make rtc_xopen try harder on EBUSY
Denys Vlasenko [Fri, 2 May 2014 07:05:03 +0000 (09:05 +0200)]
libbb: make rtc_xopen try harder on EBUSY

function                                             old     new   delta
rtc_xopen                                             77     139     +62

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoFix compile failures
Denys Vlasenko [Fri, 2 May 2014 05:18:55 +0000 (07:18 +0200)]
Fix compile failures

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agocrond: implement "SHELL=prog" in crontab. Export LOGNAME as POSIX wants
Denys Vlasenko [Wed, 30 Apr 2014 15:38:27 +0000 (17:38 +0200)]
crond: implement "SHELL=prog" in crontab. Export LOGNAME as POSIX wants

function                                             old     new   delta
fork_job                                             343     456    +113
load_crontab                                         688     777     +89
crond_main                                          1456    1434     -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 202/-22)           Total: 180 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agocrond: simplify logging code
Denys Vlasenko [Wed, 30 Apr 2014 12:49:52 +0000 (14:49 +0200)]
crond: simplify logging code

Slight change in behavior: now -l 5 will enable the same messages
formerly only enabled for -d 5. (Old behavior was non-sensical).

function                                             old     new   delta
reopen_logfile_to_stderr                               -      34     +34
log8                                                   -      26     +26
log7                                                   -      26     +26
log5                                                   -      26     +26
load_crontab                                         706     688     -18
rescan_crontab_dir                                   157     137     -20
crond_main                                          1486    1456     -30
fork_job                                             389     343     -46
crondlog                                             108      38     -70
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 0/5 up/down: 112/-184)          Total: -72 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: make syslog level for bb_error_msg's configurable. use it in crond
Denys Vlasenko [Wed, 30 Apr 2014 12:48:28 +0000 (14:48 +0200)]
libbb: make syslog level for bb_error_msg's configurable. use it in crond

function                                             old     new   delta
bb_verror_msg                                        380     386      +6
syslog_level                                           -       1      +1
crondlog                                             165     108     -57

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agocrond: tweak help text, make course less cryptic
Denys Vlasenko [Wed, 30 Apr 2014 12:47:28 +0000 (14:47 +0200)]
crond: tweak help text, make course less cryptic

function                                             old     new   delta
packed_usage                                       29736   29740      +4
crond_main                                          1485    1486      +1
load_crontab                                         712     706      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe-small: (un)load all modules which match the alias, not only first one
Denys Vlasenko [Mon, 21 Apr 2014 14:59:36 +0000 (16:59 +0200)]
modprobe-small: (un)load all modules which match the alias, not only first one

Closes 627 and 7034.

Commonly seen case is (un)loading of an alias
which matches ata_generic and a more specific ata module.

For example:

modprobe [-r] pci:v00008086d00007010sv00000000sd00000000bc01sc01i80
(ata_generic and pata_acpi)

modprobe [-r] pci:v00001106d00000571sv00001509sd00009022bc01sc01i8a
(ata_generic and pata_via)

function                                             old     new   delta
process_module                                       615     728    +113
parse_module                                         309     395     +86
find_alias                                           621     653     +32
pathname_matches_modname                              78      79      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 232/0)             Total: 232 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: fix wrong delay value in one of the printed messages
Denys Vlasenko [Sun, 20 Apr 2014 11:04:23 +0000 (13:04 +0200)]
ntpd: fix wrong delay value in one of the printed messages

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: truly ignore high delay packet
Denys Vlasenko [Sat, 19 Apr 2014 17:00:16 +0000 (19:00 +0200)]
ntpd: truly ignore high delay packet

Before this cahnge, sometimes they were used after the next packet
from another peer was received, because we did updare some peer stats
from high delay packet before dropping it.

function                                             old     new   delta
recv_and_process_peer_pkt                            922     966     +44

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe-small: remove redundant aliases from modules.dep.bb
Denys Vlasenko [Sat, 19 Apr 2014 14:17:27 +0000 (16:17 +0200)]
modprobe-small: remove redundant aliases from modules.dep.bb

function                                             old     new   delta
parse_module                                         309     395     +86

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agomodprobe-small: fix help messages for aliased module-related applets
Denys Vlasenko [Sat, 19 Apr 2014 13:04:39 +0000 (15:04 +0200)]
modprobe-small: fix help messages for aliased module-related applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoadjtimex: make its help text and printed data a bit less cryptic
Denys Vlasenko [Thu, 17 Apr 2014 09:29:34 +0000 (11:29 +0200)]
adjtimex: make its help text and printed data a bit less cryptic

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb/obscure.c: code shrink. Suggested by Tito.
Denys Vlasenko [Wed, 16 Apr 2014 17:51:34 +0000 (19:51 +0200)]
libbb/obscure.c: code shrink. Suggested by Tito.

function                                             old     new   delta
string_checker                                        97      92      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: set $HOSTNAME is bash compat. Closes 7028
Denys Vlasenko [Tue, 15 Apr 2014 09:43:29 +0000 (11:43 +0200)]
ash,hush: set $HOSTNAME is bash compat. Closes 7028

function                                             old     new   delta
hush_main                                           1056    1128     +72
ash_main                                            1442    1487     +45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: provide usleep() fallback implementation
Bernhard Reutner-Fischer [Sun, 13 Apr 2014 14:37:57 +0000 (16:37 +0200)]
libbb: provide usleep() fallback implementation

POSIX.1-2008 removed the usleep function, provide a fallback
implementaion using the recommended nanosleep().

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoless: fix bugs discovered with "git log -p | less -m" on kernel tree
Denys Vlasenko [Mon, 7 Apr 2014 21:32:29 +0000 (23:32 +0200)]
less: fix bugs discovered with "git log -p | less -m" on kernel tree

function                                             old     new   delta
read_lines                                           685     733     +48

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: some simplifications
Denys Vlasenko [Sat, 5 Apr 2014 20:57:46 +0000 (22:57 +0200)]
vi: some simplifications

function                                             old     new   delta
file_insert                                          301     315     +14
init_text_buffer                                     179     171      -8
colon                                               2889    2878     -11
file_size                                             37       -     -37
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 14/-56)            Total: -42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: clear undo buffer when we change to another file
Denys Vlasenko [Thu, 3 Apr 2014 10:47:48 +0000 (12:47 +0200)]
vi: clear undo buffer when we change to another file

function                                             old     new   delta
init_text_buffer                                     156     190     +34
undo_push                                            360     382     +22
count_lines                                           74      72      -2
undo_pop                                             246     222     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 56/-26)             Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: undo code shrink
Denys Vlasenko [Wed, 2 Apr 2014 23:45:05 +0000 (01:45 +0200)]
vi: undo code shrink

function                                             old     new   delta
undo_push                                            414     395     -19
do_cmd                                              4803    4761     -42

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agovi: undo support for vi with intermediate queuing
Jody Bruchon [Wed, 2 Apr 2014 11:49:26 +0000 (13:49 +0200)]
vi: undo support for vi with intermediate queuing

function                                             old     new   delta
undo_push                                              -     411    +411
undo_pop                                               -     288    +288
do_cmd                                              4160    4426    +266
char_insert                                          363     483    +120
undo_queue_commit                                      -      61     +61
text_hole_delete                                     108     163     +55
string_insert                                         94     127     +33
colon                                               2864    2882     +18
yank_delete                                           92     101      +9
vi_main                                              273     280      +7
dot_scroll                                            88      93      +5
dot_right                                             29      34      +5
dot_prev                                              20      25      +5
dot_next                                              20      25      +5
dot_left                                              24      29      +5
dot_end                                               20      25      +5
dot_begin                                             20      25      +5
init_text_buffer                                     154     156      +2
text_hole_make                                       145     142      -3
file_insert                                          333     318     -15
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 15/2 up/down: 1305/-18)        Total: 1287 bytes

(without queuing it's ~870 bytes)

Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: specify '-nostldlib' when linking to .o files
Drew Moseley [Wed, 2 Apr 2014 10:12:46 +0000 (12:12 +0200)]
build system: specify '-nostldlib' when linking to .o files

For certain cross build scenarios the LD variable is overridden
to use the gcc executive to ensure all the target tuning parameters
are used.  In these cases, the executive errors out as shown below
but since this step is only linking to a .o file the standard libs
are not needed.

    $ make LD=gcc applets/built-in.o
      LD      applets/built-in.o
    /usr/bin/ld: cannot find -lgcc_s
    /usr/bin/ld: cannot find -lgcc_s
    collect2: ld returned 1 exit status
    make[1]: *** [applets/built-in.o] Error 1
    make: *** [applets_dir] Error 2

Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoswapon/swapoff: -a returns 0 on ignored errors
Tito Ragusa [Tue, 1 Apr 2014 07:51:27 +0000 (09:51 +0200)]
swapon/swapoff: -a returns 0 on ignored errors

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoswapon/swapoff: size reduction, cleanup, fixes, improvements
Tito Ragusa [Mon, 31 Mar 2014 14:39:26 +0000 (16:39 +0200)]
swapon/swapoff: size reduction, cleanup, fixes, improvements

1) real swapon/swapoff handles also devices on the commandline with -a;
2) xstat(device)  in  swap_enable_disable aborts on error when cycling through
   fstab so some devices  are not handled;
3) duplicated code for ENABLE_FEATURE_SWAPON_DISCARD and
   ENABLE_FEATURE_SWAPON_PRI was moved to functions.
4) silence some error messages with -a;
5) minor cleanups and code refactoring reduced the size as per bloat-check:
6) I also added support for /proc/swaps handling to swapoff:
"When the -a flag is given, swapping is disabled on all known  swap  devices
 and  files  (as  found  in  /proc/swaps  or /etc/fstab)."
So now swapoff first cycles through  /proc/swaps and then through fstab
to swapoff all devices.

function                                             old     new   delta
set_discard_flag                                       -     106    +106
swap_enable_disable                                  147     238     +91
set_priority_flag                                      -      79     +79
retrieve_file_data                                   470     467      -3
swap_on_off_main                                     638     418    -220
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/2 up/down: 276/-223)           Total: 53 bytes

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: fix a case where progress bar isn't updated if writes are very slow
Denys Vlasenko [Thu, 27 Mar 2014 15:50:29 +0000 (16:50 +0100)]
wget: fix a case where progress bar isn't updated if writes are very slow

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoadd discard option -d to swapon
Matt Whitlock [Sat, 22 Mar 2014 23:21:01 +0000 (19:21 -0400)]
add discard option -d to swapon

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofix interaction of -a and -p options in swapon
Matt Whitlock [Sat, 22 Mar 2014 23:10:08 +0000 (19:10 -0400)]
fix interaction of -a and -p options in swapon

Swap entries in /etc/fstab inherit the priority specified on the command line unless they have 'pri' in their mount options.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoavoid calling bb_strtou twice in MIN macro expansion
Matt Whitlock [Sat, 22 Mar 2014 22:54:24 +0000 (18:54 -0400)]
avoid calling bb_strtou twice in MIN macro expansion

Also, the maximum allowable value of swap priority is technically SWAP_FLAG_PRIO_MASK >> SWAP_FLAG_PRIO_SHIFT.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: add optional support for /etc/ntp.conf
Denys Vlasenko [Sun, 23 Mar 2014 14:06:38 +0000 (15:06 +0100)]
ntpd: add optional support for /etc/ntp.conf

function                                             old     new   delta
add_peers                                              -      98     +98
packed_usage                                       29470   29511     +41
ntp_init                                             407     428     +21
pw_encrypt                                            14      27     +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 173/0)             Total: 173 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodocs/new-applet-HOWTO.txt: tweak a bit
Denys Vlasenko [Mon, 17 Mar 2014 14:06:29 +0000 (15:06 +0100)]
docs/new-applet-HOWTO.txt: tweak a bit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: fix a bad check for uclibc >= 0.9.31
Denys Vlasenko [Sun, 16 Mar 2014 19:53:40 +0000 (20:53 +0100)]
libbb: fix a bad check for uclibc >= 0.9.31

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodocs: update new-applet-HOWTO.txt
Bartosz Golaszewski [Wed, 12 Mar 2014 21:43:50 +0000 (22:43 +0100)]
docs: update new-applet-HOWTO.txt

This patch adds some information about the gen_build_files.sh script and how
it allows to keep the Kbuild, Config.in etc. declarations in .c files.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash: make "locak VAR" unset VAR (bash does that)
Denys Vlasenko [Sun, 16 Mar 2014 17:41:11 +0000 (18:41 +0100)]
ash: make "locak VAR" unset VAR (bash does that)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoscript: make it work even if fd 0 is closed
Denys Vlasenko [Sun, 16 Mar 2014 11:34:53 +0000 (12:34 +0100)]
script: make it work even if fd 0 is closed

Testcase:
script -q -c "echo hey" /dev/null 0>&-

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: for "find", use POSIX not operator (!) instead of -not
Denys Vlasenko [Sun, 16 Mar 2014 11:05:58 +0000 (12:05 +0100)]
build system: for "find", use POSIX not operator (!) instead of -not

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosu: add a delay if the password is incorrect
Romain Naour [Sun, 16 Mar 2014 10:18:19 +0000 (11:18 +0100)]
su: add a delay if the password is incorrect

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: fix a thinko about 2^64-1 factorization
Denys Vlasenko [Sat, 15 Mar 2014 08:25:46 +0000 (09:25 +0100)]
ash,hush: fix a thinko about 2^64-1 factorization

function                                             old     new   delta
next_random                                          113     119      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohush: make "true" built-in
Denys Vlasenko [Fri, 14 Mar 2014 11:43:57 +0000 (12:43 +0100)]
hush: make "true" built-in

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agorandom: cosmetic tweaks in debug code
Denys Vlasenko [Thu, 13 Mar 2014 12:03:27 +0000 (13:03 +0100)]
random: cosmetic tweaks in debug code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: improve randomness of $RANDOM, add easy-ish way to test it
Denys Vlasenko [Thu, 13 Mar 2014 11:52:43 +0000 (12:52 +0100)]
ash,hush: improve randomness of $RANDOM, add easy-ish way to test it

function                                             old     new   delta
next_random                                           68     113     +45
change_random                                        103     121     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: trim help text
Denys Vlasenko [Fri, 7 Mar 2014 13:41:53 +0000 (14:41 +0100)]
shuf: trim help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: do not use strings for -i RANGE case
Denys Vlasenko [Fri, 7 Mar 2014 13:32:39 +0000 (14:32 +0100)]
shuf: do not use strings for -i RANGE case

function                                             old     new   delta
shuf_main                                            482     496     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: improve help text
Bartosz Golaszewski [Fri, 7 Mar 2014 13:07:35 +0000 (14:07 +0100)]
shuf: improve help text

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: fix a segfault on 'shuf -e'
Bartosz Golaszewski [Fri, 7 Mar 2014 10:46:03 +0000 (11:46 +0100)]
shuf: fix a segfault on 'shuf -e'

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agouse [s]rand(), not [s]random()
Denys Vlasenko [Wed, 5 Mar 2014 17:58:15 +0000 (18:58 +0100)]
use [s]rand(), not [s]random()

rand() is the most standard C library function,
and on uclibc they are the same. I guess
they are the same in most todays' libc...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: new applet
Denys Vlasenko [Wed, 5 Mar 2014 17:56:20 +0000 (18:56 +0100)]
shuf: new applet

function                                             old     new   delta
shuf_main                                              -     478    +478
packed_usage                                       29571   29719    +148
applet_names                                        2460    2465      +5
applet_main                                         1428    1432      +4
applet_nameofs                                       714     716      +2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/0 up/down: 637/0)             Total: 637 bytes

Based on the code by Bartosz Golaszewski <bartekgola@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoman: default to ascii
Denys Vlasenko [Mon, 3 Mar 2014 14:13:37 +0000 (15:13 +0100)]
man: default to ascii

Default to ascii instead of latin1. Otherwise man pages can be displayed
incorrectly. E.g. bullets show as "<B7>".

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoip link: add support for "address ETHADDR". Closes 4862
Denys Vlasenko [Sat, 1 Mar 2014 16:38:41 +0000 (17:38 +0100)]
ip link: add support for "address ETHADDR". Closes 4862

function                                             old     new   delta
do_iplink                                           2175    2289    +114

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agounlzma: add comments about possible bug from BZ 2689
Denys Vlasenko [Fri, 28 Feb 2014 14:42:10 +0000 (15:42 +0100)]
unlzma: add comments about possible bug from BZ 2689

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agounlzma: move some variables in "more local" scope
Denys Vlasenko [Fri, 28 Feb 2014 14:05:43 +0000 (15:05 +0100)]
unlzma: move some variables in "more local" scope

No code changes as verified by objdump

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpc: ignore NAKs from "wrong" servers. Closes 4267
Denys Vlasenko [Thu, 27 Feb 2014 17:15:50 +0000 (18:15 +0100)]
udhcpc: ignore NAKs from "wrong" servers. Closes 4267

function                                             old     new   delta
udhcpc_main                                         2716    2814     +98

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agols: make "ls -s DIR" show total too. Clases 4946
Denys Vlasenko [Thu, 27 Feb 2014 14:40:26 +0000 (15:40 +0100)]
ls: make "ls -s DIR" show total too. Clases 4946

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoxargs: fix compilation breakage
Denys Vlasenko [Thu, 27 Feb 2014 14:02:36 +0000 (15:02 +0100)]
xargs: fix compilation breakage

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogrep: fix -w match if first match isn't a word, but second is. Closes 4520
Denys Vlasenko [Thu, 27 Feb 2014 13:56:12 +0000 (14:56 +0100)]
grep: fix -w match if first match isn't a word, but second is. Closes 4520

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoxargs: add support for -I and -i. Closes 493
Denys Vlasenko [Thu, 27 Feb 2014 10:17:06 +0000 (11:17 +0100)]
xargs: add support for -I and -i. Closes 493

function                                             old     new   delta
process_stdin_with_replace                             -     195    +195
xmalloc_substitute_string                              -     145    +145
xargs_main                                           808     884     +76
count_strstr                                           -      45     +45
packed_usage                                       29580   29571      -9
parse_params                                        1445    1416     -29
func_exec                                            285     138    -147
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 1/3 up/down: 461/-185)          Total: 276 bytes
   text    data     bss     dec     hex filename
 922156     932   17692  940780   e5aec busybox_old
 922440     932   17692  941064   e5c08 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofind: code shrink
Denys Vlasenko [Wed, 26 Feb 2014 14:27:10 +0000 (15:27 +0100)]
find: code shrink

function                                             old     new   delta
func_exec                                            306     285     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agonc: fix option bit positions. Closes 6926
Denys Vlasenko [Wed, 26 Feb 2014 12:58:59 +0000 (13:58 +0100)]
nc: fix option bit positions. Closes 6926

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohwclock: fix setting of tz_minuteswest. Closes 5414
Denys Vlasenko [Tue, 25 Feb 2014 16:52:10 +0000 (17:52 +0100)]
hwclock: fix setting of tz_minuteswest. Closes 5414

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: remove a dead link from Config help text
Denys Vlasenko [Tue, 25 Feb 2014 16:31:22 +0000 (17:31 +0100)]
build system: remove a dead link from Config help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodu, copy_file: fix file matching on cramfs. Closes 5456
Denys Vlasenko [Tue, 25 Feb 2014 14:27:58 +0000 (15:27 +0100)]
du, copy_file: fix file matching on cramfs. Closes 5456

function                                             old     new   delta
is_in_ino_dev_hashtable                               88     108     +20
add_to_ino_dev_hashtable                             150     142      -8
reset_ino_dev_hashtable                               84      75      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 20/-17)              Total: 3 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: trivial code shrink
Denys Vlasenko [Tue, 25 Feb 2014 14:09:01 +0000 (15:09 +0100)]
libbb: trivial code shrink

function                                             old     new   delta
reset_ino_dev_hashtable                               84      74     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosysctl: do not error out showing write-only data. Closes 6386
Denys Vlasenko [Mon, 24 Feb 2014 16:28:43 +0000 (17:28 +0100)]
sysctl: do not error out showing write-only data. Closes 6386

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: fix comment
Denys Vlasenko [Mon, 24 Feb 2014 16:20:40 +0000 (17:20 +0100)]
wget: fix comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: add commented-out code to use ssl_helper instead of openssl
Denys Vlasenko [Sun, 23 Feb 2014 22:39:47 +0000 (23:39 +0100)]
wget: add commented-out code to use ssl_helper instead of openssl

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agonetworking/ssl_helper: experimental matrixssl-based ssl helper
Denys Vlasenko [Sun, 23 Feb 2014 22:31:13 +0000 (23:31 +0100)]
networking/ssl_helper: experimental matrixssl-based ssl helper

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: add support for https using "openssl s_client" as a helper
Denys Vlasenko [Sat, 22 Feb 2014 13:12:29 +0000 (14:12 +0100)]
wget: add support for https using "openssl s_client" as a helper

www.kernel.org started redirecting http:// to https://
making https support mandatory for any auto build scripts.

function                                             old     new   delta
wget_main                                           2631    2971    +340
parse_url                                            409     471     +62
.rodata                                           115607  115626     +19
P_HTTPS                                                -       6      +6
P_HTTP                                                 -       5      +5
P_FTP                                                  -       4      +4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 3/0 up/down: 436/0)             Total: 436 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoImprove examples/var_service READMEs
Denys Vlasenko [Fri, 21 Feb 2014 11:55:43 +0000 (12:55 +0100)]
Improve examples/var_service READMEs

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoKbuild: move CONFIG_PAM to general configuration
Bartosz Golaszewski [Tue, 11 Feb 2014 20:31:42 +0000 (21:31 +0100)]
Kbuild: move CONFIG_PAM to general configuration

Currently CONFIG_PAM depends on CONFIG_LOGIN, but is used by the httpd applet too.

This patch moves said option to general configuration, thus allowing to
compile httpd with PAM support independently from login.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpc: fix BPF filter. Hopefully fixes the root cause of 4598 and 6746
Denys Vlasenko [Wed, 19 Feb 2014 13:17:11 +0000 (14:17 +0100)]
udhcpc: fix BPF filter. Hopefully fixes the root cause of 4598 and 6746

Use a *signed* large positive value in BPF filter to indicate success.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoifplugd: code shrink
Denys Vlasenko [Mon, 10 Feb 2014 08:44:25 +0000 (09:44 +0100)]
ifplugd: code shrink

function                                             old     new   delta
ifplugd_main                                        1161    1144     -17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohtpd: trivial simplification in random interval selection
Denys Vlasenko [Sun, 9 Feb 2014 14:35:04 +0000 (15:35 +0100)]
htpd: trivial simplification in random interval selection

function                                             old     new   delta
poll_interval                                         57      52      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: don't die if crypt() returns NULL
Denys Vlasenko [Sun, 9 Feb 2014 13:38:03 +0000 (14:38 +0100)]
libbb: don't die if crypt() returns NULL

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosendmail: use FQDN in default envelope sender
Kaarle Ritvanen [Sun, 9 Feb 2014 08:49:36 +0000 (09:49 +0100)]
sendmail: use FQDN in default envelope sender

RFC 5321 requires the return path to be supplied with a proper domain
name.

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpc: in comments, explain the kind of raw socket we create
Denys Vlasenko [Fri, 7 Feb 2014 16:38:52 +0000 (17:38 +0100)]
udhcpc: in comments, explain the kind of raw socket we create

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogrep: properly handle grep -w "^str" in !EXTRA_COMPAT case too
Bartosz Golaszewski [Fri, 7 Feb 2014 16:14:37 +0000 (17:14 +0100)]
grep: properly handle grep -w "^str" in !EXTRA_COMPAT case too

function                                             old     new   delta
grep_file                                           1267    1288     +21

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosendmail: make -f optional, document its default value
Denys Vlasenko [Wed, 5 Feb 2014 14:01:39 +0000 (15:01 +0100)]
sendmail: make -f optional, document its default value

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpc: don't use BPF filter, users report problems (bugs 4598, 6746)
Denys Vlasenko [Mon, 3 Feb 2014 17:03:42 +0000 (18:03 +0100)]
udhcpc: don't use BPF filter, users report problems (bugs 4598, 6746)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoifupdown: support 'link' address family
Kaarle Ritvanen [Mon, 3 Feb 2014 14:56:20 +0000 (15:56 +0100)]
ifupdown: support 'link' address family

Does not configure anything. L2 configuration hook scripts should do
their job on receiving ADDRFAM=link. Configuration will be done only
once, irrespective of L3 protocols used.

Using the 'link' family in the interfaces file conforms to the Debian
implementation:

http://sources.debian.net/src/ifupdown/0.7.47.1/link.defn

function                                             old     new   delta
link_methods                                           -      12     +12
addr_link                                              -      12     +12
link_up_down                                           -       6      +6
static.addr_fams                                      12      16      +4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 1/0 up/down: 34/0)               Total: 34 bytes

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: fix use-after-free of ->user. Closes 6836
Denys Vlasenko [Mon, 3 Feb 2014 13:09:42 +0000 (14:09 +0100)]
wget: fix use-after-free of ->user. Closes 6836

function                                             old     new   delta
wget_main                                           2207    2223     +16
parse_url                                            339     353     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agocatv: suppress compiler warning
Denys Vlasenko [Mon, 3 Feb 2014 02:27:53 +0000 (03:27 +0100)]
catv: suppress compiler warning

The warning was:
warning: typedef 'BUG_const_mismatch' locally defined but not used [-Wunused-local-typedefs]

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agozcat: complain if input is not compressed
Denys Vlasenko [Sun, 2 Feb 2014 01:06:38 +0000 (02:06 +0100)]
zcat: complain if input is not compressed

function                                             old     new   delta
buffer_fill_and_print                                178     191     +13
varvalue                                             735     743      +8
bbunpack                                             747     755      +8
open_zipped                                           85      89      +4
xmalloc_open_zipped_read_close                        61      63      +2
get_addr_1                                           240     242      +2
fbsplash_main                                       1228    1230      +2
pstree_main                                          322     321      -1
builtin_type                                         121     119      -2
do_load                                              954     926     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 39/-31)              Total: 8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoappletlib: fix set-but-unused warning
Mike Frysinger [Fri, 31 Jan 2014 05:29:47 +0000 (00:29 -0500)]
appletlib: fix set-but-unused warning

When you build with FEATURE_INSTALLER disabled, you get a build
warning like so:

libbb/appletlib.c: In function 'busybox_main':
libbb/appletlib.c:691:7: warning: variable 'use_symbolic_links' set but
                                  not used [-Wunused-but-set-variable]
   int use_symbolic_links;
       ^

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agouname: fix up usage documentation
Mike Frysinger [Fri, 31 Jan 2014 05:28:42 +0000 (00:28 -0500)]
uname: fix up usage documentation

The -i/-o options were missing, and the -r/-s/-v options were
incorrectly labeled as "OS" instead of "kernel".

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agoinit: do not fail build if SIGPWR is not defined
Michael Tokarev [Wed, 29 Jan 2014 08:40:32 +0000 (12:40 +0400)]
init: do not fail build if SIGPWR is not defined

Apparently, some *BSD variants (and maybe some other OSes) does not define
SIGPWR signal.  So since commit 760fc6debcba8c, busybox fails to build on
such platforms.  Fix this.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: open_zipped() should not fail on non-compressed files
Denys Vlasenko [Mon, 27 Jan 2014 12:02:18 +0000 (13:02 +0100)]
libbb: open_zipped() should not fail on non-compressed files

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>