aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | win32: use xmalloc_follow_symlinks() in stat(2)Ron Yorston2022-09-271-16/+9
| | | | | | | | | | | | | | | | Commit 31467ddfc (win32: changes to stat(2) implementation) followed symlinks manually. Unfortunately the implementation was incorrect. Use xmalloc_follow_symlinks() instead. Saves 32-48 bytes.
* | make: fix incorrect handling of escaped newlineRon Yorston2022-08-281-5/+4
| | | | | | | | | | | | Fix a bug in process_command() where an escaped newline followed by a character other than tab resulted in premature termination of the command.
* | make: new appletRon Yorston2022-08-0110-6/+3482
| | | | | | | | | | | | | | | | | | This is an experimental implementation of make for busybox-w32, based on my public domain POSIX make: https://frippery.org/make/ (GitHub issue #44)
* | Merge branch 'busybox' into mergeRon Yorston2022-06-2712-54/+95
|\|
| * vi: handle autoindent in 'cc' commandRon Yorston2022-06-261-24/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the 'cc' command is invoked with autoindent enabled it should use the indent of the first line being changed. The size of the indent has to be established before char_insert() is called as the lines being changed are deleted. Introduce a new global variable, newindent, to handle this. The indentcol global is now effectively a static variable in char_insert(). function old new delta do_cmd 4247 4308 +61 vi_main 416 422 +6 char_insert 891 875 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 67/-16) Total: 51 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * vi: fix regression in autoindent handlingRon Yorston2022-06-261-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose autoindent is enabled and we have a line with an initial tab where we want to split the words onto separate lines: split the words One way to do this is with the sequence 'f r<CR>;r<CR>', but in BusyBox vi the result is: split he words This is a regression introduced by commit 9659a8db1 (vi: remove autoindent from otherwise empty lines). The amount of indentation is being recorded when the 'r' command inserts a newline but isn't subsequently reset. A fix is to only record the indent when in insert or replace mode. Proper handling of the 'o' and 'O' commands then requires them to switch to insert mode before calling char_insert() to insert a newline. function old new delta char_insert 884 891 +7 do_cmd 4243 4247 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 11/0) Total: 11 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash,hush: use HOME for tab completion and promptsRon Yorston2022-06-264-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * libbb: restore special handling of nomsg errorsRon Yorston2022-06-262-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * top: improve large PID display in memory ('s') modeDenys Vlasenko2022-05-121-1/+4
| | | | | | | | | | | | | | function old new delta display_topmem_process_list 530 564 +34 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * examples/var_service/dhcp_if: make helper scripts more talkativeDenys Vlasenko2022-05-124-10/+16
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Workaround for incomplete junctions created by PowerShellRon Yorston2022-06-251-12/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Scoop uses PowerShell's New-Item to create junctions. However, these junctions lack a PrintName. This is a known issue which has caused problems even for Windows' File Explorer: https://github.com/PowerShell/PowerShell/issues/12923 Revert commit 32de287bb (win32: code shrink readlink(2)) to that readlink(2) uses SubstituteName instead. (GitHub issue #261)
* | win32: bug fix in fnmatch(3)Ron Yorston2022-06-231-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A user reports: Here is the shell script that causes me problems: var=foo:bar echo ${var#*[[:space:]]} What expect I to see echoed is foo:bar, however what I see bar. It seems that the [[:space:]] character class is matching the colon character in addition to whitespace characters. I see the same problem with the [[:blank:]] character class. This is due to a bug in the WIN32 implementation of fnmatch(3) which is derived from an old snapshot of glibc code (glibc commit 7814856974 from 1999-09-12). The bug was fixed in glibc by commit 83b1b6d8fa of 2000-07-04. Apply the equivalent fix to our version.
* | 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>