aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | Makefile.flags: suppress clang warnings when cross-compilingRon Yorston2024-01-171-3/+3
| | | | | | | | | | | | | | | | Extend the changes introduced by commit b4ef2e3467 (Makefile.flags: suppress some clang-9 warnings) so they also cover the case where clang is used as a cross-compiler. Signed-off-by: Ron Yorston <rmy@pobox.com>
* | ash: further reduce forkshell relocation blockRon Yorston2024-01-161-17/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following on from commit c84b81ce4 (ash: reduce size of forkshell relocation block): - Store the flags to indicate if annotations should be freed in a separate array. This only affects builds with forkshell debug enabled. - Use a bitmap to indicate which pointers need relocation (instead of an array of bytes). This reduces the size of the forkshell data block by a few hundred bytes. Adds 32-64 bytes.
* | Annual update of copyright messageRon Yorston2024-01-151-1/+1
| |
* | ash: reduce size of forkshell relocation blockRon Yorston2024-01-151-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | The forkshell relocation block had one byte for each byte of the forkshell structure and funcblock. It's only necessary to allow one byte for each pointer. (One or two bits would be enough, but would make the code more complex.) The impact of this change depends on the data and whether the CPU is 32- or 64-bit. It typically saves a few Kbytes. Costs 16-52 bytes.
* | ash: code shrink forkshell debugRon Yorston2024-01-151-6/+0
| | | | | | | | | | | | | | | | Remove a check that there are no relocations for addresses in the funcstring block. At one point during development the relocation block had entries for that area, but not any more. This only affects non-default builds with forkshell debug enabled.
* | ash: add more checks to forkshell debugRon Yorston2024-01-141-15/+36
| | | | | | | | | | | | Rearrange the handling of pointer relocation during forkshell and add a couple of additional sanity checks. There's no functional change to non-debug builds.
* | ash: special case in creation of pipelineRon Yorston2024-01-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | When a pipeline is created the parent allocates an array of procstat structures sufficient for the number of members of the pipeline. The child processes, however, only see the number of processes created so far. Thus, the first child sees that a procstat array has been created but contains no processes. This resulted in an invalid pointer to the procstat array in the first child. This probably doesn't matter: if the number of processes is zero there should be no need to access the array. Set the pointer to NULL so if it is accessed we'll know about it.
* | lineedit: remove CRs from inputRon Yorston2024-01-121-2/+6
| | | | | | | | | | | | | | | | | | | | | | Commit 8ade494aeb (win32: add support for virtual terminal input) made some changes to how input is handled in the line editing code. In some circumstances (e.g. 'cat | sh -i') this results in input being read using fgets(3) rather than from the keyboard. Remove CRs from input in this case. Also, use fgets(3) if stdin is not a tty, but not stdout.
* | Update PDCursesRon Yorston2024-01-0616-278/+610
| |
* | time: enable '-f' optionRon Yorston2024-01-051-17/+6
| | | | | | | | | | | | | | The '-f' option allows the user to specify a format string to control which data is reported. Adds 224-240 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2024-01-056-48/+135
|\|
| * sed: check errors writing file with sed -iDominique Martinet2024-01-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sed would currently not error if write failed when modifying a file. This can be reproduced with the following 'script': $ sudo mount -t tmpfs tmpfs -o size=1M /tmp/m $ sudo chmod 777 /tmp/m $ echo foo > /tmp/m/foo $ dd if=/dev/zero of=/tmp/m/fill bs=4k dd: error writing '/tmp/m/fill': No space left on device 256+0 records in 255+0 records out 1044480 bytes (1.0 MB, 1020 KiB) copied, 0.00234567 s, 445 MB/s $ busybox sed -i -e 's/.*/bar/' /tmp/m/foo $ echo $? 0 $ cat /tmp/m/foo <empty> new behaviour: $ echo foo > /tmp/m/foo $ ./busybox sed -i -e 's/.*/bar/' /tmp/m/foo sed: write error $ echo $? 4 $ cat /tmp/m/foo foo function old new delta sed_main 754 801 +47 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 47/0) Total: 47 bytes text data bss dec hex filename 75727 2510 1552 79789 137ad busybox_old 75774 2510 1552 79836 137dc busybox_unstripped Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * time: implement %% and \escapes in -f FMTDenys Vlasenko2024-01-012-21/+55
| | | | | | | | | | | | | | function old new delta time_main 1217 1316 +99 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * time: fix max resident set size unitNatanael Copa2023-12-311-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ru_maxrss is already in Kbytes and not pages. function old new delta ptok 21 - -21 time_main 1261 1217 -44 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-65) Total: -65 bytes fixes: https://bugs.busybox.net/show_bug.cgi?id=15751 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix handling of empty fieldsDenys Vlasenko2023-12-312-16/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by M Rubon <rubonmtz@gmail.com>: Busybox awk handles references to empty (not provided in the input) fields differently during the first line of input, as compared to subsequent lines. $ (echo a ; echo b) | awk '$2 != 0' #wrong b No field $2 value is provided in the input. When awk references field $2 for the "a" line, it is seen to have a different behaviour than when it is referenced for the "b" line. Problem in BusyBox v1.36.1 embedded in OpenWrt 23.05.0 Same problem also in 21.02 versions of OpenWrt Same problem in BusyBox v1.37.0.git I get the correct expected output from Ubuntu gawk and Debian mawk, and from my fix. will@dev:~$ (echo a ; echo b) | awk '$2 != 0' #correct a b will@dev:~/busybox$ (echo a ; echo b ) | ./busybox awk '$2 != 0' #fixed a b I built and poked into the source code at editors/awk.c The function fsrealloc(int size) is core to allocating, initializing, reallocating, and reinitializing fields, both real input line fields and imaginary fields that the script references but do not exist in the input. When fsrealloc() needs more field space than it has previously allocated, it initializes those new fields differently than how they are later reinitialized for the next input line. This works fine for fields defined in the input, like $1, but does not work the first time when there is no input for that field (e.g. field $99) My one-line fix simply makes the initialization and clrvar() reinitialization use the same value for .type. I am not sure if there are regression tests to run, but I have not done those. I'm not sure if I understand why clrvar() is not setting .type to a default constant value, but in any case I have left that untouched. function old new delta ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * util-linux/lsusb.c: print manufacturer/product strings if availablePeter Korsgaard2023-12-131-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just listing the vendor/product IDs is not always very helpful, so add logic to print the manufacturer and product strings similar to the "big" usbutils versions. Not all devices provide sensible strings though. The usbutils version works around this by falling back to looking up the vendor/product IDs in the hwdb and using those strings instead, which is not an option here - Instead simply trim() the strings for readability. lsusb | sort Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 0bda:5539 Realtek Semiconductor Corp. Integrated_Webcam_HD Bus 001 Device 003: ID 0a5c:5842 Broadcom Corp. 58200 Bus 001 Device 030: ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP) Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 002: ID 0bda:5487 Realtek Semiconductor Corp. Dell dock Bus 006 Device 003: ID 0bda:5413 Realtek Semiconductor Corp. Dell dock Bus 006 Device 004: ID 413c:b06e Dell Computer Corp. Dell dock Bus 006 Device 005: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub Bus 006 Device 006: ID 0bda:402e Realtek Semiconductor Corp. USB Audio Bus 006 Device 007: ID 413c:1010 Dell Computer Corp. USB 2.0 Hub [MTT] Bus 006 Device 008: ID 413c:b06f Dell Computer Corp. Dell dock Bus 006 Device 009: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse Bus 006 Device 010: ID 413c:2110 Dell Computer Corp. Dell Wired Multimedia Keyboard Bus 006 Device 011: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub Bus 006 Device 012: ID 0451:3410 Texas Instruments, Inc. TUSB3410 Microcontroller Bus 007 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 007 Device 002: ID 0bda:0487 Realtek Semiconductor Corp. Dell dock Bus 007 Device 003: ID 0bda:0413 Realtek Semiconductor Corp. Dell dock Bus 007 Device 004: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter ./busybox lsusb | sort Bus 001 Device 001: ID 1d6b:0002 Linux 6.1.0-13-amd64 xhci-hcd xHCI Host Controller Bus 001 Device 002: ID 0bda:5539 CNFHH53Q0324300ACA10 Integrated_Webcam_HD Bus 001 Device 003: ID 0a5c:5842 Broadcom Corp 58200 Bus 001 Device 030: ID 8087:0aaa Bus 002 Device 001: ID 1d6b:0003 Linux 6.1.0-13-amd64 xhci-hcd xHCI Host Controller Bus 003 Device 001: ID 1d6b:0002 Linux 6.1.0-13-amd64 xhci-hcd xHCI Host Controller Bus 004 Device 001: ID 1d6b:0003 Linux 6.1.0-13-amd64 xhci-hcd xHCI Host Controller Bus 005 Device 001: ID 1d6b:0002 Linux 6.1.0-13-amd64 dummy_hcd Dummy host controller Bus 006 Device 001: ID 1d6b:0002 Linux 6.1.0-13-amd64 xhci-hcd xHCI Host Controller Bus 006 Device 002: ID 0bda:5487 Dell Inc. Dell dock Bus 006 Device 003: ID 0bda:5413 Dell Inc. Dell dock Bus 006 Device 004: ID 413c:b06e Dell dock Bus 006 Device 005: ID 0451:8142 Bus 006 Device 006: ID 0bda:402e Generic USB Audio Bus 006 Device 007: ID 413c:1010 USB 2.0 Hub [MTT] Bus 006 Device 008: ID 413c:b06f Dell dock Bus 006 Device 009: ID 046d:c016 Logitech Optical USB Mouse Bus 006 Device 010: ID 413c:2110 Dell Dell Wired Multimedia Keyboard Bus 006 Device 011: ID 0451:8142 Bus 006 Device 012: ID 0451:3410 Texas Instruments TUSB3410 Boot Device Bus 007 Device 001: ID 1d6b:0003 Linux 6.1.0-13-amd64 xhci-hcd xHCI Host Controller Bus 007 Device 002: ID 0bda:0487 Dell Inc. Dell dock Bus 007 Device 003: ID 0bda:0413 Dell Inc. Dell dock Bus 007 Device 004: ID 0bda:8153 Realtek USB 10/100/1000 LAN ./scripts/bloat-o-meter busybox_unstripped{_orig,} function old new delta trim - 101 +101 fileAction 338 431 +93 add_sysfs_prop - 70 +70 open_read_close - 54 +54 read_close - 35 +35 .rodata 3268 3294 +26 ------------------------------------------------------------------------------ (add/remove: 5/0 grow/shrink: 2/0 up/down: 379/0) Total: 379 bytes Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* | libbb: code shrink bb_get_last_path_component_strip()Ron Yorston2024-01-041-6/+4
| | | | | | | | | | Use the new function last_char_is_dir_sep() to save 16 bytes in bb_get_last_path_component_strip().
* | win32: fix detection of directories in stat(2)Ron Yorston2024-01-041-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of stat(2) detected whether a pathname ending with a directory separator was valid by checking for the error code ERROR_INVALID_NAME when GetFileAttributesExA() failed. This works if the path refers to an actual disk but not if it's on a share. In the latter case the glob '*/' incorrectly returned files that weren't directories. Add code to handle this case. Costs 16-32 bytes. (GitHub issue #381)
* | libbb: introduce last_char_is_dir_sep()Ron Yorston2024-01-043-2/+14
| | | | | | | | | | | | | | Add a convenience function to determine if the last character of a string is a directory separator. Adds 16-32 bytes.
* | win32: make the clang build less crashyRon Yorston2024-01-034-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | busybox-w32 binaries built using clang crashed so frequently that they were pretty much unusable. The main issue seems to be with assignments to the structures containing global variables which are used in most applets. Upstream commit 5156b2455 (Make const ptr assign as function call in clang) addresses this, but is insufficient for the build on Windows. Extend the idea to the ASSIGN_CONST_PTR() macro too. Costs 32-80 bytes in the gcc build.
* | build system: try harder to detect Windows hostsRon Yorston2024-01-021-3/+5
| | | | | | | | | | | | | | | | | | | | Commit 7390f29cf (build system: allow building with w64devkit) checked the target of the host compiler to determine if it was Windows. This relied on the target being a triple of the form *-*-mingw32. Some compilers have a target of the form *-*-windows-gnu. Allow for this too.
* | win32: code shrink procps_scan()Ron Yorston2023-12-311-2/+2
| | | | | | | | | | | | Use getpid() instead of GetProcessId(GetCurrentProcess()). Saves 16 bytes.
* | httpd: consistently leak memory, or notRon Yorston2023-12-311-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | create_detached_process() is only used when running a CGI script. Previously it leaked the return values from quote_arg() but freed the command line it built. Whether or not the CGI script is successfully run its parent process exits almost immediately, so there's no pressing need to free the memory. If FEATURE_CLEAN_UP is disabled (which it is by default) don't bother. Saves 16 bytes.
* | win32: fix clang error/warningRon Yorston2023-12-312-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | Since clang doesn't seem to know about ffs(3) make it use __builtin_ffs() instead. Fix a warning in process_escape() in winansi.c: result of comparison of constant -1 with expression of type 'WORD' (aka 'unsigned short') is always true. Change the error value returned by process_colour() from -1 to 0xffff. Costs 16 bytes.
* | ash: avoid crash when job table is emptyRon Yorston2023-12-251-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7b692ddf0 (ash: improved support for jobs built-in) didn't correctly initialise the pointer to the job table if it was empty. This resulted in the following crashing: sh -c "cat <(echo HelloWorld | rev)" Fix forkshell_copy() so the job table pointer is NULL if there are no jobs. Adds 16 bytes. (GitHub issue #379)
* | make: proper handling of build failure with '-k'Ron Yorston2023-12-222-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | When a build command fails and the '-k' option (continue on error) is in effect, no further commands should be executed for the current target. Also, the resulting diagnostic should be reported to stderr. As should the final 'not built due to errors' diagnostic. Adds 80 bytes. (pdpmake GitHub issue 35)
* | httpd: enable support for CGIRon Yorston2023-12-206-15/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upstream code uses fork/exec when running a CGI process. Emulate this by: - Spawning a child httpd process with the special '-I 0' option, along with the options provided on the server command line. This sets up the proper state then calls the cgi_handler() function. - The cgi_handler() function fixes the pipe file descriptors and starts another child process to run the CGI script. These processes are detached from the console on creation. When spawn() functions are run in P_DETACH mode they don't connect to the standard file descriptors. Normally this doesn't matter but the process which runs the CGI scripts needs to inherit the pipe endpoints. The create_detached_process() function handles this. See: https://github.com/rprichard/win32-console-docs/blob/master/README.md Adds about 2.9Kb to the size of the binary. (GitHub issue #266)
* | win32: code shrink execve(2) implementationRon Yorston2023-12-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | Commit 6d6856355a (win32: handle -1 return status from execve(2)) added a test of errno to distinguish between failure to run a program and the program returning -1. Subsequent changes in commit 9db9b34ada (win32: ignore ctrl-c in parent of execve(2)) make this test unnecessary. Remove it. Saves 16-32 bytes.
* | httpd: fix return code when run in backgroundRon Yorston2023-12-153-15/+7
| | | | | | | | | | | | | | | | | | | | | | When httpd was run in the background the return code of the parent process was incorrect. It seems when spawn() is run in _P_DETACH mode it returns 0 on success, not a process handle. Fix the test for the return code and alter mingw_spawn_detach() so it doesn't treat the return from spawn() as a handle. Saves 32 bytes.
* | httpd: fix failure to run daemonisedRon Yorston2023-12-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 2af141a2c (ash: changes to login shell functionality) httpd has failed to run in the background (i.e. without the '-f' option). This was due the removal of support for applet names with a '-' prefix. Although this feature isn't used by the shell it was used by httpd to mark when the process had been daemonised. Adds 16 bytes. (GitHub issue #378)
* | lineedit: fix to tab completion of applet overrideRon Yorston2023-12-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the ability to override an applet if an external binary was present was added, the commit message for bd7018350 said: This doesn't affect tab completion in the shell: whether a completion is an applet or an external command is irrelevant. This isn't quite true. Suppose 'applet' has been overridden in such circumstances: $ export BB_OVERRIDE_APPLETS=";applet" $ applet If the user now enters tab twice the output would be: applet applet.exe The applet is still treated as a potential match. Recent changes to the applet override code result in a simple fix: the shell PATH can be passed to is_applet_preferred() in the line editing code. Now only 'applet.exe' is treated as a match. Adds 16-32 bytes.
* | win32: tidy up conditional compilation of applet overrideRon Yorston2023-12-122-12/+11
| | | | | | | | | | This doesn't affect the generated binary, at least in the default configuration.
* | make: flush stdout after writing command stringRon Yorston2023-12-111-1/+3
| | | | | | | | | | | | | | If stdout is fully buffered (e.g. because the output is redirected to a file or pipe) the command string may appear after its output. (pdpmake GitHub PR 34)
* | win32: code shrink applet overridesRon Yorston2023-12-104-62/+32
| | | | | | | | | | | | | | | | Pass the PATH to be used to look up executables down from the shell to the applet override code. This replaces the use of a static variable and a function to fetch its value. Saves 16-32 bytes.
* | win32: allow hardcoded list of applets to overrideRon Yorston2023-12-095-6/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | The environment variable BB_OVERRIDE_APPLETS provides control over which applets are preferred in standalone shell mode. Allow a similar list to be hardcoded in the binary with the OVERRIDE_APPLETS configuration string. The environment variable is checked first. If it doesn't override the applet the hardcoded string is then checked too. The default for OVERRIDE_APPLETS is an empty string. In this case the size and behaviour of the binary is unchanged.
* | Merge branch 'busybox' into mergeFRP-5236-g7dff7f376Ron Yorston2023-12-0516-419/+784
|\|
| * top: improve large PID display in memory ('s') modeDenys Vlasenko2023-11-231-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | Display VSZ[RW] fields in more compact form if PID is wider. function old new delta display_topmem_process_list 564 614 +50 ulltoa5_and_space - 14 +14 ulltoa6_and_space 14 - -14 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/0 up/down: 64/-14) Total: 50 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Cygwin: regenerate defconfigChristian Franke2023-11-131-277/+515
| | | | | | | | | | Signed-off-by: Christian Franke <christian.franke@t-online.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * start-stop-daemon: make --output not depend on FANCYDenys Vlasenko2023-11-081-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * start-stop-daemon: do not lose error messages with -bDenys Vlasenko2023-11-083-36/+41
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta start_stop_daemon_main 1186 1206 +20 bb_daemonize_or_rexec 196 212 +16 bb_banner 47 46 -1 packed_usage 34656 34645 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 36/-12) Total: 24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * start-stop-daemon: typo fixDenys Vlasenko2023-11-081-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * start-stop-daemon: implement option -O|--outputLouai Al-Khanji2023-11-071-12/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If specified redirect command stdout and stderr to given pathname. function old new delta start_stop_daemon_main 1130 1186 +56 start_stop_daemon_longopts 164 173 +9 packed_usage 34653 34656 +3 .rodata 105384 105386 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 70/0) Total: 70 bytes Signed-off-by: Louai Al-Khanji <louai@astranis.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sleep: Update docPetr Vorel2023-11-071-7/+8
| | | | | | | | | | | | | | | | | | 4c20d9f2b removed FEATURE_FLOAT_SLEEP option, thus since then there are only two variants. Fixes: 4c20d9f2b ("extend fractional duration support to "top -d N.N" and "timeout"") Signed-off-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * start-stop-daemon: update comment, no code changesDenys Vlasenko2023-11-071-3/+13
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * start-stop-daemon: add -d DIR chdir optionejaaskel2023-11-073-15/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add option to change the running directory before starting the process. This can be done using -d or --chdir options. Add also test cases to start-stop-daemon to test out the directory change option. function old new delta packed_usage 34602 34648 +46 start_stop_daemon_main 1107 1130 +23 start_stop_daemon_longopts 156 164 +8 .rodata 105382 105384 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 79/0) Total: 79 bytes Signed-off-by: ejaaskel <esa.jaaskela@suomi24.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * start-stop-daemon: fix --help: -K or -S is requiredDenys Vlasenko2023-11-071-10/+36
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 105381 105382 +1 packed_usage 34638 34602 -36 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 1/-36) Total: -35 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcp: Avoid leaking uninitialized/stale dataRuss Dill2023-10-042-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed a commit in connman: "gdhcp: Avoid leaking stack data via unitiialized variable" [1] Since gdhcp is just BusyBox udhcp with the serial numbers filed off, I checked if BusyBox udhcp has a related issue. The issue is that the get_option logic assumes any data within the memory area of the buffer is "valid". This reduces the complexity of the function at the cost of reading past the end of the actually received data in the case of specially crafted packets. This is not a problem for the udhcp_recv_kernel_packet data path as the entire memory area is zeroed. However, d4/d6_recv_raw_packet does not zero the memory. Note that a related commit [2] is not required as we are zeroing any data that can be read by the get_option function. [1] https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=a74524b3e3fad81b0fd1084ffdf9f2ea469cd9b1 [2] https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=58d397ba74873384aee449690a9070bacd5676fa function old new delta d4_recv_raw_packet 484 497 +13 d6_recv_raw_packet 216 228 +12 .rodata 105390 105381 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 25/-9) Total: 16 bytes Signed-off-by: Russ Dill <russ.dill@gmail.com> Cc: Colin Wee <cwee@tesla.com> Cc: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * syslogd: fix breakage caused by "daemonize _after_ init" changeDenys Vlasenko2023-10-031-4/+5
| | | | | | | | | | | | | | | | | | | | function old new delta syslogd_init 1007 1140 +133 create_socket 143 - -143 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 133/-143) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: implement -E; do not reorder -f and -eDenys Vlasenko2023-10-021-48/+65
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta awk_main 843 891 +48 next_input_file 243 261 +18 packed_usage 34631 34638 +7 .rodata 105391 105390 -1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 73/-1) Total: 72 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * install: Fix chown resetting suid/sgid bits from chmodNero2023-10-021-7/+9
| | | | | | | | | | | | | | | | | | | | Since Linux 2.2.13, chown(2) resets the suid/gid bits for all users. This patch changes the ordering so that chmod gets called after chown. This behavior follows GNU coreutils. Signed-off-by: Nero <nero@w1r3.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>