summaryrefslogtreecommitdiff
path: root/libbb
AgeCommit message (Collapse)Author
2023-05-28libbb/dump: code shrinkDenys Vlasenko
function old new delta .rodata 105252 105246 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-27libbb/dump: make xxd_displayoff member conditional on xxdDenys Vlasenko
With xxd not selected: function old new delta display 1459 1444 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26libbb/dump: correct handling of 1-byte signed int formatDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26libbb/dump: use fputs_stdout where appropriateDenys Vlasenko
function old new delta display 1485 1483 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26od, hexdump: byte 0x11 is "dc1" not "dcl"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26libbb/dump: conditionalize code used only by xxd and odDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-25od: stop printing extra trailing spacesDenys Vlasenko
function old new delta .rodata 104598 104613 +15 display 1475 1485 +10 od_main 549 556 +7 rewrite 971 967 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 32/-4) Total: 28 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-25od: for !DESKTOP, match output more closely to GNU coreutils 9.1, implement -sDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-12lineedit: fix crash when icanon set with -echoAkos Somfai
When icanon is set with -echo (e.g. ssh from an emacs shell) then S.state will remain null but later it will be deferenced causing ash to crash. Fix: additional check on state. Signed-off-by: Akos Somfai <akos.somfai@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-10appletlib: fix "warning: unused variable applet_no"Tomas Paukrt
Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-10ash: fix sleep built-in not running INT trap immediately on ^CDenys Vlasenko
function old new delta sleep_for_duration 169 149 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-06libbb: consolidate NOMMU fix of restoring high bit in argv[0][0]Denys Vlasenko
function old new delta fork_or_rexec 46 56 +10 bootchartd_main 1087 1079 -8 cpio_main 674 661 -13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 10/-21) Total: -11 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-03-29lineedit: fix matching of directories when searching PATHRon Yorston
Commit 8baa643a3 (lineedit: match local directories when searching PATH) included subdirectories of the current directory in the search when tab-completing commands. Unfortunately a short time later commit 1d180cd74 (lineedit: use strncmp instead of is_prefixed_with (we know the length)) broke this feature by returning an incorrect length for the array of paths. Fix the length and reinstate matching of subdirectories. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-03-29libbb/sha: do not read shaNI variable twice, and factor out its settingDenys Vlasenko
My gcc inlines both calls, so instead of "-20 bytes" I get only this: function old new delta sha256_begin 84 83 -1 sha1_begin 114 111 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-4) Total: -4 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-03-29libbb/sha: fix sha-NI instruction detectionDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-01-26shell: fix SIGWINCH and SIGCHLD (in hush) interrupting line input, closes 15256Denys Vlasenko
function old new delta record_pending_signo 32 63 +31 lineedit_read_key 231 224 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 31/-7) Total: 24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-01-03shell: fix compile failures in some configsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-01-02libbb/loop: fix compile failure (name collision)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-12-13libbb: shrink del_loop()Denys Vlasenko
function old new delta del_loop 52 49 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-12-13loop: restore the correct return vaule of set_loop()Denys Vlasenko
It is only used by mount's error path, though... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-12-13loop: optionally use ioctl(LOOP_CONFIGURE) to set up loopdevsDenys Vlasenko
LOOP_CONFIGURE is added to Linux 5.8 function old new delta NO_LOOP_CONFIGURE (old code): set_loop 784 782 -2 LOOP_CONFIGURE: set_loop 784 653 -131 TRY_LOOP_CONFIGURE: set_loop 784 811 +27 Based on a patch by Xiaoming Ni <nixiaoming@huawei.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-12-13loop: refactor: extract subfunction set_loopdev_params()Xiaoming Ni
Extract subfunction set_loop_info() from set_loop() function old new delta set_loop 760 784 +24 Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-12-12loop: simplify code of LOOP_SET_FD failureXiaoming Ni
function old new delta set_loop 790 760 -30 Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-12-12loop: refactor: extract subfunction get_next_free_loop()Xiaoming Ni
Extract subfunction get_next_free_loop() from set_loop() Also fix miss free(try) when stat(try) and mknod fail function old new delta set_loop 807 790 -17 Fixes: 3448914e8cc5 ("mount,losetup: use /dev/loop-control is it exists") Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-11-15loop: fix a race when a free loop device is snatchedXiaoming Ni
When /dev/loop-control exists and *device is empty, the mount may fail if a concurrent mount is running. function old new delta set_loop 809 807 -2 Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-30libbb: mark stack in assembly files read-onlyLudwig Nussel
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-30fix [ --help ] and [[ --help ]]Denys Vlasenko
function old new delta show_usage_if_dash_dash_help 72 79 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-27ash: optional sleep builtinShawn Landden
function old new delta sleepcmd - 10 +10 builtintab 352 360 +8 .rodata 105264 105271 +7 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 25/0) Total: 25 bytes Signed-off-by: Shawn Landden <shawnlandden@tutanota.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-22libbb: make '--help' handling more consistentRon Yorston
Running an applet with '--help' as its only argument is treated as a special case. If additional arguments follow '--help' the behaviour is inconsistent: - applets which call single_argv() print help and do nothing else; - applets which call getopt() report "unrecognized option '--help'" and print help anyway; - expr says "expr: syntax error" and doesn't print help; - printenv silently ignores '--help', prints any other variables and doesn't print help; - realpath says "--help: No such file or directory", prints the path of any other files and doesn't print help. If the first argument is '--help' ignore any other arguments and print help. This is more consistent and most likely what the user wanted. See also commit 6bdfbc4cb (libbb: fix '--help' handling in FEATURE_SH_NOFORK=y). function old new delta show_usage_if_dash_dash_help 75 69 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-6) Total: -6 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-07-03lineedit: get PWD from ashRon Yorston
The line editing code and ash disagree when the current directory is changed to a symbolic link: ~ $ mkdir real ~ $ ln -s real link ~ $ cd link ~/real $ pwd /home/rmyf36/link Note the prompt says we're in ~/real. Bash does: [rmy@random ~]$ cd link [rmy@random link]$ pwd /home/rmyf36/link Ash uses the name supplied by the user while the line editing code calls getcwd(3). The discrepancy can be avoided by fetching the value of PWD from ash. Hush calls getcwd(3) when the directory is changed so there's no disagreement with the line editing code. There is no standard how shells should handle cd'ing into symlinks. function old new delta parse_and_put_prompt 838 869 +31 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-06-26ash,hush: use HOME for tab completion and promptsRon Yorston
ash and hush correctly use the value of HOME for tilde expansion. However the line editing code in libbb obtains the user's home directory by calling getpwuid(). Thus tildes in tab completion and prompts may be interpreted differently than in tilde expansion. When the line editing code is invoked from a shell make it use the shell's interpretation of tilde. This is similar to how GNU readline and bash collaborate. function old new delta get_homedir_or_NULL 29 72 +43 optschanged 119 126 +7 hush_main 1204 1211 +7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 57/0) Total: 57 bytes v2: Always check for HOME before trying the password database: this is what GNU readline does. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-06-26libbb: restore special handling of nomsg errorsRon Yorston
The functions bb_perror_nomsg() and bb_perror_nomsg_and_die() are used to print error messages where no specific information is available. For example: $ busybox mktemp -p / mktemp: (null): Permission denied mktemp(3) doesn't tell us the name of the file it tried to create. However, printing '(null)' is a regression introduced by commit 6937487be (libbb: reduce the overhead of single parameter bb_error_msg() calls). Restore the previous behaviour by reverting the changes to the two functions mentioned: $ busybox mktemp -p / mktemp: Permission denied function old new delta bb_perror_nomsg_and_die 7 14 +7 bb_perror_nomsg 7 14 +7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 14/0) Total: 14 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-05-01style fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-18libbb/sha1: update config help text with new performance numbersDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-12libbb/sha256: explicitly use sha256rnds2's %xmm0 (MSG) argumentDenys Vlasenko
Else, the code seemingly does not use MSG. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-11whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-11libbb/sha1: revert last commit: pshufb is a SSSE3 insn, can't use itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-11libbb/sha1: shrink unrolled x86-64 codeDenys Vlasenko
function old new delta sha1_process_block64 3481 3384 -97 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-10libbb/sha: improve commentsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-09whitespace fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-09libbb/sha256: code shrink in x86 assemblyDenys Vlasenko
function old new delta sha256_process_block64_shaNI 32-bit 676 673 -3 sha256_process_block64_shaNI 64-bit 680 677 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-09libbb/sha256: code shrink in 64-bit x86Denys Vlasenko
function old new delta sha256_process_block64_shaNI 701 680 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-09libbb/sha256: code shrink in 32-bit x86Denys Vlasenko
function old new delta sha256_process_block64_shaNI 697 676 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-09libbb/sha256: code shrink in 32-bit x86Denys Vlasenko
function old new delta sha256_process_block64_shaNI 713 697 -16 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-08libbb/sha1: shrink x86 hardware accelerated hashing (32-bit)Denys Vlasenko
function old new delta sha1_process_block64_shaNI 511 507 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-08libbb/sha1: shrink x86 hardware accelerated hashing (32-bit)Denys Vlasenko
function old new delta sha1_process_block64_shaNI 517 511 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-08libbb/sha1: shrink x86 hardware accelerated hashingDenys Vlasenko
function old new delta sha1_process_block64_shaNI 32-bit 524 517 -7 sha1_process_block64_shaNI 64-bit 510 508 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-08libbb/sha1: shrink unrolled x86-64 codeDenys Vlasenko
function old new delta sha1_process_block64 3482 3481 -1 .rodata 108460 108412 -48 ------------------------------------------------------------------------------ (add/remove: 1/4 grow/shrink: 0/2 up/down: 0/-49) Total: -49 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-07libbb/sha1: shrink and speed up unrolled x86-64 codeDenys Vlasenko
function old new delta sha1_process_block64 3514 3482 -32 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-06*: slap on a few ALIGN_PTR where appropriateDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>