aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ash: restore special variables when replaced by localRon Yorston2022-05-181-0/+4
| | | | | | | | | | | | | Commit 3194a475d (ash: export certain variables to the environment immediately) caused the special variables BB_OVERRIDE_APPLETS, BB_SKIP_ANSI_EMULATION and BB_SYSTEMROOT to be exported to the environment. If one of these variables is replaced by a local variable its previous value should be re-exported on leaving the local context (function or simple command). (GitHub issue #256)
* jn: make junctions acceptable to WindowsRon Yorston2022-05-171-5/+9
| | | | | | | Junctions created by 'jn' contained incorrect data: the length of the target name was off-by-one. (GitHub issue #251)
* jn: new appletRon Yorston2022-05-165-1/+172
| | | | | | | | | | | | Add a Windows-specific applet to create a directory junction. Usage: jn DIR JUNC where DIR must be an existing directory on a local drive and JUNC must not currently exist. There isn't a simple WIN32 API to create directory junctions. The implementation of mklink in ReactOS provided useful inspiration.
* win32: try to get link count for directoriesRon Yorston2022-05-153-1/+36
| | | | | | | | | | | | | On Unix the link count of a directory reflects the number of subdirectories it contains. Enhance readdir(3) to return file types and use this to count subdirectories when stat(2) is called for a directory. As with other features that might slow down stat(2) this is controlled by the build-time setting FEATURE_EXTRA_FILE_DATA. (Commit d82db8e9a 'win32: make stat(2) fetch additional metadata'). (GitHub issue #254)
* win32: treat junctions as symlinksRon Yorston2022-05-141-6/+13
| | | | | | | | | | | | | | | | | Directory junctions were always followed to their target so they appeared to *be* directories. This resulted in counter-intuitive behaviour: - a directory junction could be removed with rmdir even though the directory wasn't empty; - 'rm -rf' on a directory junction deleted it but also deleted the contents of the linked directory. A better approximation is to treat directory junctions as symbolic links. (GitHub issue #254)
* Update default configurationRon Yorston2022-05-122-2/+6
|
* Merge branch 'busybox' into mergeRon Yorston2022-05-1220-37/+625
|\
| * top: code shrinkDenys Vlasenko2022-05-101-11/+9
| | | | | | | | | | | | | | function old new delta display_process_list 1186 1168 -18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top: code shrinkDenys Vlasenko2022-05-101-11/+14
| | | | | | | | | | | | | | function old new delta display_process_list 1191 1186 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top: fix display of large PID/PPIDDenys Vlasenko2022-05-101-2/+28
| | | | | | | | | | | | | | | | | | | | function old new delta display_process_list 1077 1191 +114 .rodata 104803 104807 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 118/0) Total: 118 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: do not hash in a constant string, it's not adding entropyDenys Vlasenko2022-05-031-8/+8
| | | | | | | | | | | | | | | | | | | | function old new delta seedrng_main 906 880 -26 .rodata 104899 104873 -26 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-52) Total: -52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: restore error check on fsyncDenys Vlasenko2022-05-021-9/+12
| | | | | | | | | | | | | | | | | | Or else security people will never stop nagging us. function old new delta seedrng_main 884 906 +22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: it's not a part of util-linux, move to miscutilsDenys Vlasenko2022-05-021-0/+0
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * init: do not set HOMEDenys Vlasenko2022-05-021-1/+5
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 104906 104899 -7 init_main 786 776 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-17) Total: -17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tsort: new appletDavid Leonard2022-05-023-1/+299
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta tsort_main - 578 +578 .rodata 104884 104906 +22 applet_names 2759 2765 +6 applet_main 1596 1600 +4 packed_usage 34290 34288 -2 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/1 up/down: 610/-2) Total: 608 bytes Signed-off-by: David Leonard <d+busybox@adaptive-enterprises.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * crond: implement support for setting PATH in crontab filesPaul Fox2022-05-021-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It's very inconvenient for a cron user not to be able to set a "personal" PATH for their cron jobs, as is possible with other crons function old new delta load_crontab 868 942 +74 .rodata 104878 104884 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 80/0) Total: 80 bytes Signed-off-by: Paul Fox <pgf@foxharp.boston.ma.us> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * style fixDenys Vlasenko2022-05-017-9/+9
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: manually inline seed_rngBernhard Reutner-Fischer2022-05-011-21/+15
| | | | | | | | | | | | | | | | | | | | We can now remove a separate buffer function old new delta seedrng_main 930 884 -46 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: shorten --help, assorted small cleanupsDenys Vlasenko2022-05-011-11/+10
| | | | | | | | | | | | | | function old new delta packed_usage 34295 34290 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: reduce MAX_SEED_LEN from 512 to 256Denys Vlasenko2022-05-011-1/+5
| | | | | | | | | | | | | | As proposed by Jason. getrandom() is more likely to block on reads larger than this. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: do not hash lengths, they are very predictableDenys Vlasenko2022-05-011-3/+5
| | | | | | | | | | | | | | function old new delta seedrng_main 982 930 -52 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: code shrinkDenys Vlasenko2022-05-011-8/+10
| | | | | | | | | | | | | | function old new delta seedrng_main 994 982 -12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: explain why we need locking and fsync'ingDenys Vlasenko2022-05-011-8/+18
| | | | | | | | | | | | | | | | | | | | Also, do not test for locking errors: on Linux, they do not happen. function old new delta .rodata 104900 104878 -22 seedrng_main 1022 994 -28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: remove redundant assignmentDenys Vlasenko2022-04-301-3/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: re-add fsync after unlink, and explain its purposeDenys Vlasenko2022-04-301-1/+12
| | | | | | | | | | | | | | function old new delta seedrng_main 1003 1022 +19 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: include fiel/dir names in error messagesDenys Vlasenko2022-04-301-3/+3
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 104898 104900 +2 seedrng_main 1011 1003 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-8) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: use more xfuncs where appropriateDenys Vlasenko2022-04-301-12/+12
| | | | | | | | | | | | | | | | function old new delta .rodata 104929 104898 -31 seedrng_main 1050 1011 -39 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: code shrinkDenys Vlasenko2022-04-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Struct initializers do this double init: ># util-linux/seedrng.c:88: struct pollfd random_fd = { movl $0, 132(%esp) #, random_fd movl $0, 136(%esp) #, random_fd ... ># util-linux/seedrng.c:88: struct pollfd random_fd = { movl %eax, 140(%esp) # _110, random_fd.fd movw $1, 144(%esp) #, random_fd.events and close(random_fd.fd) needs to pull the item from the stack: pushl 132(%esp) # random_fd.fd call close # function old new delta seedrng_main 1076 1050 -26 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: simplify read_new_seed() to not have error returnDenys Vlasenko2022-04-301-14/+17
| | | | | | | | | | | | | | gcc in fact detects this and does this transformation when generating code - no object code changes. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: prepare read_new_seed() to not need a "success" retvalDenys Vlasenko2022-04-301-10/+12
| | | | | | | | | | | | | | | | | | | | | | We do not expect /dev/[u]random to be not openable/readable. If they are, just bail out (something is obviously very wrong). function old new delta seedrng_main 1077 1076 -1 .rodata 104939 104929 -10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: do not try to continue on unexpected errors (just exit)Denys Vlasenko2022-04-301-38/+16
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 104946 104938 -8 seedrng_main 1225 1077 -148 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-156) Total: -156 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ifplugd: split -a into -a and -A, latter disables upping in iface creationDenys Vlasenko2022-04-301-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -a meant both "don't up iface before each link detection" and "don't up iface when it newly appears". But they are not the same. I have a dock station where eth1 appears when I attach the notebook to it (looks like it's hanging off a USB bus). IOW: appearance of this interface is functionally equivalent to attaching ethernet cable. ifplugd meant to be able to *automatically* handle this case. Currently, with -a, it couldn't: newly appearing iface stayed down, user had to manually up it. function old new delta packed_usage 34253 34296 +43 .rodata 104876 104877 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 44/0) Total: 44 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: chdir to the SEED_DIRECTORY - avoid concat_path_file'sDenys Vlasenko2022-04-271-9/+9
| | | | | | | | | | | | | | function old new delta seedrng_main 1273 1225 -48 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: shorten stringsDenys Vlasenko2022-04-271-11/+11
| | | | | | | | | | | | | | function old new delta .rodata 104894 104876 -18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: remove unnecessary zero-filling of local variablesDenys Vlasenko2022-04-271-8/+11
| | | | | | | | | | | | | | function old new delta seedrng_main 1292 1273 -19 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: remove unnecessary zero-filling of local variablesDenys Vlasenko2022-04-271-5/+5
| | | | | | | | | | | | | | function old new delta seedrng_main 1323 1292 -31 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: shrink --help textDenys Vlasenko2022-04-271-3/+3
| | | | | | | | | | | | | | function old new delta packed_usage 34280 34253 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: fix fallout from nth_string() robustification, closes 14726Denys Vlasenko2022-04-271-1/+13
| | | | | | | | | | | | | | function old new delta parse_common 187 228 +41 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * kbuild: Prefer -Oz over -OsBernhard Reutner-Fischer2022-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -Oz Optimize aggressively for size rather than speed. with gcc-12 so far (i think only https://gcc.gnu.org/PR32803 and 103773 ) "shorter load imm on x86_64": (add/remove: 0/0 grow/shrink: 4/1670 up/down: 6/-13196) Total: -13190 bytes text data bss dec hex filename 975753 4227 1816 981796 efb24 busybox_old 962442 4227 1816 968485 ec725 busybox_unstripped with clang-15: (add/remove: 394/34 grow/shrink: 161/1856 up/down: 18644/-98946)Total: -80302 bytes text data bss dec hex filename 1120994 16066 1696 1138756 116044 busybox_old 1040689 16026 1696 1058411 10266b busybox_unstripped Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: prune header includesJason A. Donenfeld2022-04-241-14/+0
| | | | | | | | | | | | | | | | | | Remove redundant includes. We have platform specific handling in libbb.h and platform.h so we can handle quirks in a central place. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: code-golf even smallerJason A. Donenfeld2022-04-241-28/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we're passing 0 as the timeout, we don't need safe_poll. Remove cleanup at end of program, since OS does that, which lets us simplify control flow. Factor repeated function calls into ternary loop. function old new delta seedrng_main 1061 1459 +398 seed_from_file_if_exists 468 - -468 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 398/-468) Total: -70 bytes text data bss dec hex filename 1052781 16515 1816 1071112 105808 busybox_old 1052711 16515 1816 1071042 1057c2 busybox_unstripped Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * kbuild: fix building sha256Bernhard Reutner-Fischer2022-04-212-8/+1
| | | | | | | | | | | | | | | | | | | | | | Pass down the correct EXTRA_CFLAGS to the compiler driver when building assembler source. Otherwise building busybox for a multilib other than the default failed to link since hash_md5_sha256_x86-64_shaNI.o and hash_md5_sha_x86-64_shaNI.o were built for the default arch which might not what we requested in the EXTRA_CFLAGS. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * vi: fix backspace over tab in commandsRon Yorston2022-04-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Colon and search commands are entered on the status line. Since the cursor position wasn't being tracked backspacing over a tab resulted in a mismatch between the actual and apparent content of the command. function old new delta get_input_line 178 180 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 2/0) Total: 2 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: compress format strings with %s argumentsJason A. Donenfeld2022-04-201-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Avoid an xstrdup call with seed_dir. - Compress format strings with %s arguments. - Open /dev/urandom for add entropy ioctl rather than /dev/random, so that /dev/random is only used for the already-sightly-flawed poll() check for creditability. function old new delta seedrng_main 948 958 +10 seed_from_file_if_exists 410 417 +7 .rodata 108338 108206 -132 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 17/-132) Total: -115 bytes text data bss dec hex filename 975829 4227 1816 981872 efb70 busybox_old 975714 4227 1816 981757 efafd busybox_unstripped Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: avoid needless runtime strlen() callJason A. Donenfeld2022-04-201-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Avoid needless runtime strlen() call, bloating binary. - Replace failed seed string with series of nulls. function old new delta .rodata 108350 108338 -12 static.seedrng_prefix 26 - -26 seedrng_main 1000 948 -52 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-90) Total: -90 bytes text data bss dec hex filename 975919 4227 1816 981962 efbca busybox_old 975829 4227 1816 981872 efb70 busybox_unstripped Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: use predefined strings where possibleJason A. Donenfeld2022-04-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use predefined strings where possible. - Open /dev/random with O_RDONLY for ioctl(). function old new delta seed_from_file_if_exists 413 410 -3 .rodata 108407 108350 -57 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-60) Total: -60 bytes text data bss dec hex filename 975979 4227 1816 982022 efc06 busybox_old 975919 4227 1816 981962 efbca busybox_unstripped Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: further reduce sizeJason A. Donenfeld2022-04-201-55/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove all games with errno to further reduce code size. - Combine error messages that don't benefit from being separated. - Lock directory fd instead of separate file. function old new delta static.longopts 38 26 -12 seed_from_file_if_exists 426 413 -13 packed_usage 34519 34480 -39 .rodata 108484 108407 -77 seedrng_main 1088 1000 -88 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-229) Total: -229 bytes text data bss dec hex filename 976208 4227 1816 982251 efceb busybox_old 975979 4227 1816 982022 efc06 busybox_unstripped Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: remove some global variablesJason A. Donenfeld2022-04-201-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove global variables and pass dfd by value, opened once instead of twice, which shaves off some more bytes. function old new delta seedrng_main 1086 1088 +2 seed_dir 8 - -8 non_creditable_seed 8 - -8 lock_file 8 - -8 creditable_seed 8 - -8 seed_from_file_if_exists 456 426 -30 ------------------------------------------------------------------------------ (add/remove: 0/4 grow/shrink: 1/1 up/down: 2/-62) Total: -60 bytes text data bss dec hex filename 976236 4227 1848 982311 efd27 busybox_old 976208 4227 1816 982251 efceb busybox_unstripped Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: hoist bb_strtoul out of min/maxJason A. Donenfeld2022-04-201-14/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Hoist bb_strtoul out of min/max to prevent quadruple evaluation. - Don't use separate variables for boottime/realtime. - Make use of ENABLE_FEATURE_CLEAN_UP where appropriate. - Order hash initialization after lock taking per Bernhard's taste. - Add comment description of theory of operation. function old new delta seed_from_file_if_exists 533 456 -77 seedrng_main 1218 1086 -132 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-209) Total: -209 bytes text data bss dec hex filename 976445 4227 1848 982520 efdf8 busybox_old 976236 4227 1848 982311 efd27 busybox_unstripped Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * seedrng: use libbb functionsJason A. Donenfeld2022-04-201-89/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make extensive use of libbb.h functions, which simplify a lot of code and reduce binary size considerably. - Use the already existing PID_FILE_PATH variable. function old new delta seed_from_file_if_exists 697 533 -164 .rodata 108665 108484 -181 seedrng_main 1463 1218 -245 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-590) Total: -590 bytes text data bss dec hex filename 977035 4227 1848 983110 f0046 busybox_old 976445 4227 1848 982520 efdf8 busybox_unstripped Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>