aboutsummaryrefslogtreecommitdiff
path: root/util-linux (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeRon Yorston2023-04-171-2/+3
|\
| * mkfs_vfat: do not generate same volume_id when run in rapid successionDenys Vlasenko2023-04-101-2/+3
| | | | | | | | | | | | | | function old new delta mkfs_vfat_main 1502 1523 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | runuser,drop: drop runuser, tweak dropRon Yorston2023-03-191-164/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the runuser applet, leaving only drop. Move drop from util-linux to miscutils. A command of the form 'drop -c command' causes the BusyBox shell to be used, just like 'drop' without any arguments. A simple OpenSSH configuration with 'drop.exe' as DefaultShell and no DefaultShellArguments now works both for interactive login and to run a command. This is useful for older versions of OpenSSH which don't support DefaultShellArguments. Saves 208-232 bytes.
* | runuser,drop: code shrinkRon Yorston2023-03-191-13/+7
| | | | | | | | | | | | | | | | | | Make quote_arg() always return an allocated string so we can free it unconditionally. Always use argv[1] as the first part of the command string. Saves 48 bytes.
* | runuser: add 'drop' as an alias for runuserRon Yorston2023-03-161-22/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'drop' alias for 'runuser' relaxes a number of constraints that were introduced for compatibility: - It works even if the current process doesn't have elevated privileges. - It isn't necessary to specify the name of the user. - Any command can be invoked, not just the BusyBox shell. - If the command doesn't specify a path 'drop' will first look for a BusyBox applet then search PATH. Adds 320-336 when built along with runuser. (GitHub issue #240)
* | runuser: new appletRon Yorston2023-03-131-0/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a cut down, Windows-specific implementation of `runuser` from util-linux. This allows elevated privileges to be dropped when running in an SSH session. It also works when using `su` or starting busybox-w32 'as administrator'. There are complications: - The method used to drop privileges leaves the access token in the TokenIsElevated state. Detecting this is likely to be fragile. - The unprivileged shell is started by CreateProcessAsUserA(). In older versions of Windows this has to be loaded dynamically. Adds about 900 bytes. (GitHub issue #240)
* | win32: add support for virtual terminal inputRon Yorston2023-03-051-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alter certain applets to support virtual terminal input, if enabled. In many places this is achieved by building previously excluded upstream terminal-handling code. The busybox-w32 implementation of termios(3) functions does nothing if virtual terminal input is disabled, so it can be invoked regardless. Some applet-specific terminal-handling code is also required. This affects less, more, vi and command line editing in the shell. (The `more` applet isn't enabled in the default configuration.) This series of patches adds about 1.7KB to the binaries.
* | Merge branch 'busybox' into mergeRon Yorston2023-01-053-9/+13
|\|
| * xxd: use bb_simple_perror_msg... where appropriateDenys Vlasenko2023-01-031-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xxd: fix use of non-initialized dataDenys Vlasenko2023-01-021-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * more: accept and ignore -eNatanael Copa2022-12-141-1/+2
| | | | | | | | | | | | | | | | Accept and ignore -e which is specified in POSIX. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/more.html Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xxd: fix typo in trivial usageBrandon Maier2022-12-081-1/+1
| | | | | | | | | | Signed-off-by: Brandon Maier <brandon.maier@collins.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Remove "select PLATFORM_LINUX"Denys Vlasenko2022-11-2924-28/+0
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Fix non-Linux buildsSamuel Thibault2022-11-2924-0/+28
| | | | | | | | | | | | | | | | | | | | | | Various tools are Linuxish and should thus only attempted to build on Linux only. Some features are also Linux-only. Also, libresolv is used on all GNU platforms, notably GNU/Hurd and GNU/kfreeBSD. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fbset: support setting pixel clock rateDario Binacchi2022-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | Only in case the FEATURE_FBSET_FANCY configuration is enabled. function old new delta fbset_main 733 766 +33 Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fbset: abort on not handled optionsDario Binacchi2022-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all options are actually implemented. In this case, return a message and an error code to make it clear that the requested command has not been executed. function old new delta .rodata 105200 105224 +24 fbset_main 747 733 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 24/-14) Total: 10 bytes Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | getopt: use name supplied with '-n' to report errorRon Yorston2022-11-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows: $ getopt -o a -n my_script -- -z getopt: unknown option -- z On Linux: $ getopt -o a -n my_script -- -z my_script: unknown option -- z The difference arises because the Mingw-w64 implementation of getopt(3) uses __argv[0] to report errors, not the first element of the argument array passed to it. Make __argv[0] point to the name supplied with the '-n' option to match behaviour when glibc getopt(3) is used. (GitHub issue #274)
* | xxd: avoid use of uninitialised variableRon Yorston2022-10-121-0/+4
| | | | | | | | | | | | | | If xxd is run with '-r' but no '-s' the value of opt_s passed to reverse() is uninitialised. This patch has been submitted upstream but hasn't been applied yet.
* | Merge branch 'busybox' into mergeRon Yorston2022-10-121-25/+89
|\|
| * xxd -r: handle offsetsDenys Vlasenko2022-08-221-8/+50
| | | | | | | | | | | | | | | | | | | | function old new delta xxd_main 1076 1439 +363 .rodata 105239 105251 +12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 375/0) Total: 375 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xxd -r: without -p, stop at more than one whitespace, closes 14786Denys Vlasenko2022-08-221-17/+39
| | | | | | | | | | | | | | function old new delta xxd_main 888 1076 +188 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * seedrng: it's not a part of util-linux, move to miscutilsDenys Vlasenko2022-05-021-239/+0
| | | | | | | | 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>
| * 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>
| * 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>
| * 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>