summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* win32: changes to stat(2) implementationFRP-4716-g31467ddfcRon Yorston2022-05-231-15/+22
| | | | | | | | | | | - Use repeated calls to readlink(2) rather than xmalloc_realpath() when asked to follow symlinks. - Drop the non-standard feature that caused readlink(2) to return only the target string length. This improves compatibility with BusyBox on Linux at a cost of 16-32 bytes.
* win32: code shrink fstat(2)Ron Yorston2022-05-231-11/+8
| | | | Reduce duplicated code. Saves 16-48 bytes.
* win32: let stat(2) return correct st_size for symlinkRon Yorston2022-05-221-5/+8
| | | | | | Previously stat(2) set st_size to the length of the canonicalised symlink target. Call readlink(2) to get the actual length of the target string.
* win32: code shrink readlink(2)Ron Yorston2022-05-221-32/+12
| | | | | | | Use PrintName rather than SubstituteName from the reparse data buffer. This avoids the need to normalise the name. Saves 240 bytes.
* win32: code shrink directory testsRon Yorston2022-05-221-15/+19
| | | | | | | | | | Add a function to check if a file is a directory and use it in various places. Replace some uses of S_ISDIR() with a test of the Windows file attributes. Saves 32-48 bytes.
* ash: code shrinkRon Yorston2022-05-201-46/+50
| | | | | | | | | | | Commit 6f8b2f450 (ash: forkshell code shrink) noted that certain global variables were being passed around in the forkshell structure unnecessarily. In fact, since the variables are global there's no need to pass them to the *_size()/*_copy() functions at all. This only saves 32 bytes of bloat (the compiler got there ahead of us) but it does make the code tidier.
* chattr,lsattr: improve help messagesRon Yorston2022-05-193-6/+26
| | | | | | List all attributes in the help from lsattr. Minor changes to attribute names in output.
* lsattr: distinguish between junctions and symlinksRon Yorston2022-05-193-3/+47
| | | | | Use the new st_tag member of struct stat to display whether a reparse point is a junction or a symlink.
* win32: return reparse tag in struct statRon Yorston2022-05-192-6/+15
| | | | | | | | If a file is a junction or symlink return its tag in the st_tag member of struct stat. get_symlink_data() and is_symlink() also return the tag or zero, as appropriate.
* chattr,lsattr: code shrinkRon Yorston2022-05-194-51/+20
| | | | | | | | Drop fgetsetflags() and move its functionality into chattr and lsattr. Raw file attributes are available from struct stat. In chattr don't compile code related to the unused (on Windows) OPT_SET option.
* 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>