summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-02-15applets/usage_pod.c: placate gccDenys Vlasenko
"error: format not a string literal and no format arguments" Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-07Makefile.flags: fix the OS detection for libresolvMartin Kaiser
054493350 ("Do not add -lresolv on non-Linux systems") adds a condition to link with libresolv only on linux systems. The check requires that CONFIG_UNAME_OSNAME equals Linux. This works only if the uname applet is enabled. Otherwise, CONFIG_UNAME_OSNAME is empty, regardless of the platform. By default, CONFIG_UNAME_OSNAME is the output of uname -o. For most linux systems, uname -o returns "GNU/Linux" and the check fails. In this case, linking a static busybox fails because of missing symbols from libresolv. networking/lib.a(nslookup.o): In function `add_query': nslookup.c:789: undefined reference to `__res_mkquery' networking/lib.a(nslookup.o): In function `parse_reply': nslookup.c:355: undefined reference to `ns_initparse' nslookup.c:361: undefined reference to `ns_parserr' nslookup.c:404: undefined reference to `ns_name_uncompress' nslookup.c:418: undefined reference to `ns_get16' nslookup.c:419: undefined reference to `ns_name_uncompress' .. nslookup.c:456: undefined reference to `ns_get16' ... nslookup.c:469: undefined reference to `ns_name_uncompress' ... nslookup.c:489: undefined reference to `ns_get32' ... collect2: error: ld returned 1 exit status This patch uses the output of $CC -dumpmachine to detect the target platform for which we compile. Both gcc and clang support -dumpmachine. Like the original patch, we link against libresolv only if our target platform is linux-based. Fixes: 054493350 ("Do not add -lresolv on non-Linux systems") Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2021-02-03libbb: introduce and use fputs_stdoutRon Yorston
function old new delta fputs_stdout - 12 +12 zxc_vm_process 7237 7230 -7 yes_main 85 78 -7 write_block 380 373 -7 wrapf 305 298 -7 strings_main 437 430 -7 show_bridge 353 346 -7 rev_main 384 377 -7 put_prompt_custom 58 51 -7 put_cur_glyph_and_inc_cursor 168 161 -7 print_numbered_lines 152 145 -7 print_named_ascii 130 123 -7 print_name 135 128 -7 print_login_issue 386 379 -7 print_ascii 208 201 -7 powertop_main 1249 1242 -7 od_main 1789 1782 -7 logread_main 518 511 -7 head_main 804 797 -7 display_process_list 1319 1312 -7 cut_main 1002 995 -7 bb_dump_dump 1550 1543 -7 bb_ask_noecho 393 386 -7 baseNUM_main 702 695 -7 expand_main 755 745 -10 dumpleases_main 497 487 -10 write1 12 - -12 putcsi 37 23 -14 print_login_prompt 55 41 -14 paste_main 525 511 -14 cat_main 440 426 -14 print_it 245 230 -15 print_addrinfo 1188 1171 -17 print_rule 770 750 -20 print_linkinfo 842 822 -20 httpd_main 791 771 -20 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/34 up/down: 12/-341) Total: -329 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-03libbb: code shrink fgets_strRon Yorston
Use a NULL value of maxsz_p to indicate to xmalloc_fgets_internal() that the caller doesn't care about the maximum size of the buffer. This allows the default maximum size to be set once in xmalloc_fgets_internal() instead of separately in each caller. function old new delta xmalloc_fgets_internal 273 287 +14 xmalloc_fgets_str 30 9 -21 xmalloc_fgetline_str 33 12 -21 xmalloc_fgets_str_len 38 10 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 14/-70) Total: -56 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-02nl: ensure '-b n' option displays file contentRon Yorston
The command 'nl -b n' should output no line numbers, just some spaces as a placeholder followed by the actual file content. Add tests for line numbering by cat and nl. The correct results were obtained from coreutils. function old new delta print_numbered_lines 152 157 +5 .rodata 182456 182453 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 5/-3) Total: 2 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-02cryptpw: typo in usage messageRon Yorston
'[-p N]' should be '[-P N]' in the trivial usage message. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-02vi: fix range selection by forward character motionRon Yorston
Selection of ranges for change/delete/yank by forward character motion commands (SPACE or 'l') was incorrect. The range was always one character whereas vi allows the size of the range to be specified. Fix this by executing the motion command the required number of times. There is a complication when the range is at the end of a line. We need to distinguish between a range which excludes the last character and one which includes it. This requires comparing the actual range with that expected from the command count. (With the additional quirk that a command count of zero is equivalent to a command count of one.) function old new delta find_range 587 619 +32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-02libbb: code shrink and speed up index_in_strings()Ron Yorston
Rewrite index_in_strings() to replace calls to strcmp()/strlen(). With this change searching for valid names in the applet_names array (for example) is 40% faster. The code has to assume the strings aren't sorted, so will always scan the entire array when presented with an invalid name. function old new delta index_in_strings 63 56 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-7) Total: -7 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-02libbb: code shrink and speed up find_applet_by_name()Ron Yorston
find_applet_by_name() determines the appropriate range of applet indices to check for the given name and performs a linear search in applet_names[]. Revise the code so the index of the upper bound of the range, 'max', isn't calculated. Instead check the value of the first non-matching character to see if we've reached the end of the range. This new code speeds up the time to find a valid applet name by 6% and halves the time to detect that a given name is invalid. The average time to detect an invalid name is now the same as for a valid one. function old new delta find_applet_by_name 155 133 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-22) Total: -22 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-02awk: allow printf('%c') to output NUL, closes 13486Ron Yorston
Treat the output of printf as binary rather than a null-terminated string so that NUL characters can be output. This is considered to be a GNU extension, though it's also available in mawk and FreeBSD's awk. function old new delta evaluate 3487 3504 +17 awk_printf 504 519 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-02traceroute: fix option parsingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-14update_passwd: fix context variableBernd Kuhls
Commit https://git.busybox.net/busybox/commit/libbb/update_passwd.c?id=2496616b0a8d1c80cd1416b73a4847b59b9f969a changed the variable used from context to seuser but forgot this change resulting in build errors detected by buildroot autobuilders: http://autobuild.buildroot.net/results/b89/b89b7d0f0601bb706e76cea31cf4e43326e5540c//build-end.log libbb/update_passwd.c:51:11: error: 'context' undeclared (first use in this function); did you mean 'ucontext'? freecon(context); Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-09ash: match bash behavior for ${empty_var/*/repl}Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-09ash: fix ${unset_var/pattern/repl}Denys Vlasenko
function old new delta subevalvar 1349 1353 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-06bc: code shrinkDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-05pmap: fix column width, closes 13431Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix for the FEATURE_UTMP on the FreeBSDAlex Samorukov
FreeBSD is not using <utmp.h> and does not define _PATH_UTMPX. Tested with busybox applets depending on FEATURE_UTMP (e.g. who, users, etc) Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04bc: ^C on input line exits (unlike ^C during calculations, which does not)Denys Vlasenko
function old new delta xc_read_line 353 344 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix mail compilation on the FreeBSDAlex Samorukov
FreeBSD using procctl instead of Linux prctl Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix traceroute applet on the FreeBSDAlex Samorukov
This patch addressing 2 issues: 1. Replacing source/dest with uh_sport/uh_dport. It seems that uh_* members are defined on both Linux and BSD, so no #ifdef here 2. Use SOL_IPV6 instead of SOL_RAW on the FreeBSD to fix IPV6_CHECKSUM setsockopt Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix ping build on the FreeBSDAlex Samorukov
- Define iphdr structure to build busybox/ping - Add missing includes Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix ntpd compilcation on the FreeBSDAlex Samorukov
FreeBSD using different constant names, defining them inline Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix mknod compilation on the FreeBSDAlex Samorukov
<sys/sysmacros.h> is linux-only FreeBSD defines makedev in sys/types.h already included in the libbb.h. Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix missing "crypt.h" compilation error on the FreeBSDAlex Samorukov
FreeBSD does not use crypt.h, but unistd.h which is already included Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix klogd applet compilation on the FreeBSDAlex Samorukov
FreeBSD also using /dev/klog, see syslogd(8) Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix httpd compilation on the FreeBSDAlex Samorukov
FreeBSD is not exporting s6_addr32 by default, but has it. Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Fix bb_setpgrp weapper on the FreeBSDAlex Samorukov
FreeBSD uses setpgrp(pid_t, pid_t) This patch makes crond.c and probably others compilable Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04Do not add -lresolv on non-Linux systemsAlex Samorukov
On FreeBSD getaddrinfo and friends are part of libc. Other OS-es will also have own dependencies Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04ash: improve --helpDenys Vlasenko
function old new delta packed_usage 33504 33499 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04hush: code shrinkDenys Vlasenko
function old new delta hush_main 1071 1066 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5) Total: -5 bytes text data bss dec hex filename 1020110 559 5020 1025689 fa699 busybox_old 1020037 559 5020 1025616 fa650 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-03nuke: default to NDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-03ash: code shrinkDenys Vlasenko
function old new delta ash_main 1218 1202 -16 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-03ash: make a strdup copy of $HISTFILE for line editingDenys Vlasenko
Otherwise if $HISTFILE is unset or reassigned, bad things can happen. function old new delta ash_main 1210 1218 +8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01udhcpc: Add support to change default interface nameAndre Kalb
Signed-off-by: Andre Kalb <Andre.Kalb@sma.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01tls: code shrinkDenys Vlasenko
function old new delta curve25519 881 832 -49 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01tar: add TODO about a bug with non-writable directories on extractDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-31nslookup: do not print "No answer" for NODATA replies, closes 13006Denys Vlasenko
Only print when there was no answer at all. function old new delta send_queries 1834 1813 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-30libbb: introduce and use xgettimeofday(), do not truncate 64-bit time_t in ↵Denys Vlasenko
shells function old new delta xgettimeofday - 11 +11 get_local_var_value 280 281 +1 svlogd_main 1323 1322 -1 change_epoch 67 66 -1 timestamp_and_log 461 458 -3 hwclock_main 301 298 -3 fmt_time_bernstein_25 135 132 -3 step_time 331 326 -5 script_main 1207 1202 -5 machtime 34 28 -6 curtime 61 54 -7 ts_main 423 415 -8 nmeter_main 761 751 -10 gettime1900d 67 46 -21 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/12 up/down: 12/-73) Total: -61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-30libbb/procps: smaller global data for username/groupname cacheDenys Vlasenko
function old new delta get_cached 101 133 +32 cache_user_group - 4 +4 get_cached_username 17 14 -3 username 8 - -8 groupname 8 - -8 clear_username_cache 65 47 -18 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 1/2 up/down: 36/-37) Total: -1 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-30*: use fopen helpers where appropriateDenys Vlasenko
function old new delta finalize 348 343 -5 parse_resolvconf 306 299 -7 list_i2c_busses_and_exit 495 483 -12 bootchartd_main 1091 1076 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-39) Total: -39 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29httpd: fix offset for sendfileMaxim Storchak
If the Range: header is not present it the request, the offset passed to sendfile is wrong, and httpd falls back to the read-write loop. function old new delta send_file_and_exit 857 865 +8 handle_incoming_and_exit 2239 2230 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 8/-9) Total: -1 bytes Signed-off-by: Maxim Storchak <m.storchak@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29bc,dc: make BC_LINE_LENGTH/DC_LINE_LENGTH more compatible with GNUDenys Vlasenko
function old new delta xc_vm_init 640 682 +42 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29Start 1.34.0 development cycleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29Bump version to 1.33.01_33_0Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29libiproute: band-aid for old uclibc missing IFA_FLAGSDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29modprobe-small: convert to new recursive_action() APIDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29bc: placate gcc (it thinks 's' can be uninitialized here)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-27hush: make comment more clearDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-27man: implement SECTION parametersDenys Vlasenko
function old new delta man_main 807 942 +135 is_section_name - 52 +52 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 187/0) Total: 187 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>