aboutsummaryrefslogtreecommitdiff
path: root/coreutils (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* mktemp: make it NOEXECDenys Vlasenko2017-08-041-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* new NOFORKs: pwdx,kill[all5],ttysize,realpath,readlink NOEXECs: date,resizeDenys Vlasenko2017-08-033-12/+19
| | | | | | | | | | function old new delta run_nofork_applet 258 280 +22 readlink_main 112 123 +11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 33/0) Total: 33 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: FEDORA_COMPAT option (so far only tweaks uname)Denys Vlasenko2017-08-031-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* new NOFORKs: clear, nproc, tty, uname, arch, unlink, whichDenys Vlasenko2017-08-034-6/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* NOFORK fixesDenys Vlasenko2017-08-024-5/+15
| | | | | | | | | | | | | | | | | | "rm -i FILE" and "yes" can now be interrupted by ^C in hush. This also now works: $ usleep 19999999 ^C $ echo $? 130 function old new delta run_pipe 1668 1711 +43 pseudo_exec_argv 312 321 +9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 52/0) Total: 52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* do not use `a' quoting style in commentsDenys Vlasenko2017-08-025-6/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: do not use `a' quoting in help textsDenys Vlasenko2017-08-024-4/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* test: fix 4-argument caseDenys Vlasenko2017-07-311-9/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream dash commit: Date: Sun, 13 Jul 2008 19:20:10 +0800 Fixed 3,4-argument cases for test per POSIX ----- Forwarded message from Gerrit Pape <pape@smarden.org> ----- Subject: Bug#455828: dash: 4-argument test "test \( ! -e \)" yields an error Date: Fri, 28 Dec 2007 08:53:29 +0000 From: Gerrit Pape <pape@smarden.org> To: Vincent Lefevre <vincent@vinc17.org>, 455828@bugs.debian.org On Thu, Dec 27, 2007 at 06:23:20PM +0100, Vincent Lefevre wrote: > On 2007-12-27 16:00:06 +0000, Gerrit Pape wrote: > > On Wed, Dec 12, 2007 at 02:18:47AM +0100, Vincent Lefevre wrote: > > > According to POSIX[*], "test \( ! -e \)" is a 4-argument test and is > > > here equivalent to "test ! -e". But dash (like ksh93 and bash) yields > > > an error: > > > > > > $ test \( ! -e \) || echo $? > > > test: 1: closing paren expected > > > 2 > > > $ test ! -e || echo $? > > > 1 > > > > Hi Vincent, > > > > the -e switch to test takes an argument, a pathname. > > According to POSIX, in both above examples, "-e" is *not* a switch, > just a string. > > test \( ! -e \) > > means: return true if the string "-e" is empty, otherwhise return false. > The error in dash is that it incorrectly thinks that "-e" is a switch in > this context. I see, you're right. Thanks, Gerrit. ----- End forwarded message ----- This patch hard-codes the 3,4-argument cases in the way required by POSIX. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> function old new delta test_main 370 421 +51 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tar: postpone creation of symlinks with "suspicious" targets. Closes 8411Denys Vlasenko2017-07-241-1/+1
| | | | | | | | | | | function old new delta data_extract_all 968 1038 +70 tar_main 952 986 +34 scan_tree 258 262 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 108/0) Total: 108 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* basename: do not use argcDenys Vlasenko2017-07-211-5/+4
| | | | | | | function old new delta basename_main 153 148 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: deindent all help textsDenys Vlasenko2017-07-2182-245/+245
| | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Update remaining menuconfig items with approximate applet sizesDenys Vlasenko2017-07-191-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* od_bloaty: fix floating point outputRon Yorston2017-07-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently od_bloaty does this: $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -f od: invalid character 'F' in type string 'fF' $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -t fD od: invalid character 'D' in type string 'fD' $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -t f 0000000 0000010 The first two occur because the alphabetic length specifier isn't being properly skipped. The third is due to the empty length specifier being treated as alphabetic so we fall off the end of the FDL_sizeof array with undetermined consequences. Coreutils defaults to printing a double in this case. With this patch the output is: $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -f 0000000 0.0000000e+00 0.0000000e+00 0000010 $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -t fD 0000000 0.000000000000000e+00 0000010 $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -t f 0000000 0.000000000000000e+00 0000010 I guess nobody uses BusyBox od to print floating point numbers. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-1879-89/+89
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Tweaks from mass recompile for 1.27.1 releaseDenys Vlasenko2017-07-181-7/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* printf: fix format string sanity checkRon Yorston2017-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the tests for printf checks for an invalid bare '%' in the format string: $ busybox printf '%' a b c printf: %: invalid format On x86_64 a slightly different test doesn't work correctly: $ busybox printf '%' d e f printf: invalid number 'd' printf: invalid number 'e' printf: invalid number 'f' On other platforms the test fails randomly depending on how the arguments are laid out in memory. There are two places in the code where strchr is used to determine if a character in the format string is valid. However, strchr also returns a valid pointer if the character being searched for is the null terminator thus causing the code to incorrectly suppose that a valid character has been found. Add explicit checks for the null terminator. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* arch: new applet (same as unmae -m). ~30 bytes.Denys Vlasenko2017-07-161-69/+96
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* uuencode: allow space instead of "`" as padding char. Closes 10046Denys Vlasenko2017-07-141-3/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dd: fix status=none. Closes 10066Denys Vlasenko2017-07-141-4/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cat: fix "cat -An" ignoring -n; make numbering go througn all filesDenys Vlasenko2017-07-142-35/+29
| | | | | | | function old new delta cat_main 418 428 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cat: allow compiling out -n and -bKang-Che Sung2017-07-141-21/+38
| | | | | | | | | | When these options were introduced in d88f94a5df3a2edb8ba56fab5c13674b452f87ab it provides no config options to compile them out. Now provide one. Introduce config FEATURE_CATN. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shuf: fix random line selection. Closes 9971Denys Vlasenko2017-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | """ For example, given input file: foo bar baz after shuffling the input file, foo will never end up back on the first line. This came to light when I ran into a use-case where someone was selecting a random line from a file using shuf | head -n 1, and the results on busybox were showing a statistical anomaly (as in, the first line would never ever be picked) vs the same process running on environments that had gnu coreutils installed. On line https://git.busybox.net/busybox/tree/coreutils/shuf.c#n56 it uses r %= i, which will result in 0 <= r < i, while the algorithm specifies 0 <= r <= i. """ Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: new function bb_getgroups() - allocating wrapper around getgroups()Denys Vlasenko2017-07-041-26/+7
| | | | | | | | | | function old new delta bb_getgroups - 111 +111 nexpr 843 757 -86 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/1 up/down: 111/-86) Total: 25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix support for long options when FEATURE_LS_COLOR is deselectedLaurent Bercot2017-05-261-6/+8
| | | | | | | | | | | Declaration of ls_longopts and initialization of applet_long_options were incorrectly guarded with ENABLE_FEATURE_LS_COLOR; that yielded a "ls: NO_OPT: \xff" error message when long options were selected and color support was not. This patch ensures long options are initialized separately from color support. Signed-off-by: Laurent Bercot <ska-dietlibc@skarnet.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Spelling fixes in comments, documentation, tests and examplesDenys Vlasenko2017-04-171-1/+1
| | | | | | By klemens <ka7@github.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: fix stray semicolonDenys Vlasenko2017-04-171-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: support "no-argvs" usageDenys Vlasenko2017-04-141-17/+39
| | | | | | | | | | | function old new delta factorize_numstr - 72 +72 packed_usage 31562 31566 +4 factor_main 109 101 -8 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 76/-8) Total: 68 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: improve comments for sieving logic... also fix a typoDenys Vlasenko2017-04-131-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: improve comments for sieving logicDenys Vlasenko2017-04-131-2/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: tweak commentsDenys Vlasenko2017-04-131-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* catv: convert this bbox-specific applet into "cat -v"Denys Vlasenko2017-04-122-114/+122
| | | | | | | | | | | | | | function old new delta cat_main 150 320 +170 packed_usage 31511 31552 +41 applet_install_loc 190 189 -1 applet_main 1516 1512 -4 applet_names 2618 2613 -5 catv_main 227 - -227 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 2/3 up/down: 211/-237) Total: -26 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix errors found with make_single_applets.shDenys Vlasenko2017-04-122-29/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Sort more misplaced applets into coreutils or util-linuxDenys Vlasenko2017-04-122-390/+122
| | | | | | | | No code changes Surprisingly, nice and renice are coming from different packages :) Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Sort some miscutils/ applets into coreutils or util-linuxDenys Vlasenko2017-04-121-0/+127
| | | | | | No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* w: new applet, alias to "who -H"Denys Vlasenko2017-04-111-4/+44
| | | | | | | | | | | | function old new delta who_main 451 463 +12 packed_usage 31477 31485 +8 applet_main 1508 1512 +4 applet_names 2606 2608 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 26/0) Total: 26 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: remove debug codeDenys Vlasenko2017-04-111-19/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: move isqrt from factor, use it in diff tooDenys Vlasenko2017-04-111-18/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: much faster, and very slightly larger isqrt()Denys Vlasenko2017-04-111-34/+10
| | | | | | | function old new delta isqrt_odd 70 88 +18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: don't be too clever in isqrt - be small insteadDenys Vlasenko2017-04-101-10/+12
| | | | | | | function old new delta isqrt_odd 111 70 -41 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: add code to test isqrt() correctnessDenys Vlasenko2017-04-101-0/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: 25% faster sievingDenys Vlasenko2017-04-101-19/+48
| | | | | | | function old new delta factorize 287 260 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: better comments, slightl more clever conversion even->oddDenys Vlasenko2017-04-101-5/+26
| | | | | | | function old new delta isqrt_odd 114 111 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: fix HALF_FMT usageDenys Vlasenko2017-04-101-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: fix commentsDenys Vlasenko2017-04-101-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: a bit more simple isqrtDenys Vlasenko2017-04-101-1/+1
| | | | | | | function old new delta isqrt_odd 87 80 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: simpler isqrtDenys Vlasenko2017-04-101-24/+39
| | | | | | | function old new delta isqrt_odd 102 87 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: factor2 variable is unused now, drop itDenys Vlasenko2017-04-091-6/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: expand commentsDenys Vlasenko2017-04-091-4/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: 30% faster code (estimate max possible factor just once)Denys Vlasenko2017-04-091-24/+82
| | | | | | | | | | | function old new delta factorize - 161 +161 isqrt_odd - 102 +102 factor_main 281 110 -171 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/1 up/down: 263/-171) Total: 92 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* nl: fix copyright messageDenys Vlasenko2017-04-091-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>