Commit graph

2344 commits

Author SHA1 Message Date
Terts Diepraam
b5ba2fc5ca factor: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
55eb4a271b expr: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
449a536c59 expand: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
4d917e28b2 env: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
812f2db464 echo: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
1f2c3064b8 du: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
db1e630c6c dirname: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
9bd1c3e967 dircolors: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
739217968f df: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
11bfb5c73f dd: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
f5797275b7 date: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
7a0309a5aa cut: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
88447c2e50 csplit: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
37ab05bd7a cp: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
99a3dc324c comm: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
cf78121746 cksum: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
16afe58371 chroot: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
8261cf05f3 chown: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
2576615576 chmod: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
e4acb64880 chgrp: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
f35b132f67 chcon: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
048cfaf97f cat: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
fb1f9ecf80 basenc: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
7e9529b8b8 arch: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
031bde97bf base32: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
0fb7ceb1a0 base64: remove clap dependency (handled by base_common) 2022-01-11 19:06:36 +01:00
Terts Diepraam
67e5ede0a1 basename: clap 3 2022-01-11 19:06:36 +01:00
Sylvestre Ledru
6723a54610
Merge pull request #2862 from rivy/fix.whitespace
refactor/polish ~ whitespace fixup
2022-01-11 17:51:37 +01:00
kimono-koans
016d5e72ad
ls: Fix padding for dangling links in non-Long formats (#2856)
* Fix padding for dangling links in non-long formats

Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
2022-01-11 12:01:54 +01:00
Jeffrey Finkelstein
cfe5a0d82c split: correct filename creation algorithm
Fix two issues with the filename creation algorithm. First, this
corrects the behavior of the `-a` option. This commit ensures a
failure occurs when the number of chunks exceeds the number of
filenames representable with the specified fixed width:

    $ printf "%0.sa" {1..11} | split -d -b 1 -a 1
    split: output file suffixes exhausted

Second, this corrects the behavior of the default behavior when `-a`
is not specified on the command line. Previously, it was always
settings the filenames to have length 2 suffixes. This commit corrects
the behavior to follow the algorithm implied by GNU split, where the
filename lengths grow dynamically by two characters once the number of
chunks grows sufficiently large:

    $ printf "%0.sa" {1..91} | ./target/debug/coreutils split -d -b 1 \
    >   && ls x* | tail
    x81
    x82
    x83
    x84
    x85
    x86
    x87
    x88
    x89
    x9000
2022-01-10 20:43:22 -05:00
Jeffrey Finkelstein
e5d6b7a1cf split: correct arg parameters for -b option 2022-01-10 20:43:22 -05:00
Terts Diepraam
f60c36f242
Merge pull request #2610 from miDeb/cp/abuse
cp: handle edge cases when dest is a symlink
2022-01-11 00:34:55 +01:00
Roy Ivy III
7a760cae99 refactor/polish ~ re-normalize whitespace
* minimize inconsistent/invisible whitespace

- consistent indentation (either spaces-only, tabs, *or* tabs with following spaces [for indentation])
- no internal/invisible tabs
- no trailing whitespace
- EOF EOLNs
2022-01-09 21:35:39 -06:00
Roy Ivy III
d6b93e42c9 update ~ pin 'retain_mut' to v0.1.2 (with MinSRV maint ToDO)
- v0.1.5 uses const generics which aren't stable until rust v1.51.0
2022-01-09 18:57:25 -06:00
Roy Ivy III
774e72551b change ~ relax 'nix' version and remove 'nix' patch
- code coverage compilation on MacOS latest (MacOS-11+) now works with newer 'nix' versions
2022-01-09 18:57:25 -06:00
Sylvestre Ledru
dcfdeb334d
Merge pull request #2854 from kimono-koans/ls_fix_errno_1
ls: Fix Errno 1, print errors at the md call point
2022-01-09 20:56:06 +01:00
moko256
5659bf8fae
ls: On Windows use DirEntry#metadata() instead of fs::metadata 2022-01-10 02:56:22 +09:00
Sylvestre Ledru
63ef039b4f
Merge pull request #2826 from jfinkels/stdbuf-uresult
stdbuf: return UResult from uumain() function
2022-01-08 22:34:06 +01:00
Sylvestre Ledru
6637fba988
Merge pull request #2833 from jfinkels/tr-uresult
tr: return UResult from uumain() function
2022-01-08 22:30:43 +01:00
Sylvestre Ledru
a007ef2c1a
Merge pull request #2834 from jfinkels/truncate-uresult
truncate: return UResult from uumain() function
2022-01-08 22:29:57 +01:00
kimono-koans
4ea61545c6
Merge branch 'uutils:master' into ls_fix_errno_1 2022-01-07 21:48:53 -06:00
Sylvestre Ledru
9922e48ba6
Merge pull request #2853 from kimono-koans/ls_fix_first_newline
ls: Fix newline when only dirs in base directory
2022-01-07 23:10:44 +01:00
Sylvestre Ledru
c9d982fb4d
Merge pull request #2848 from jfinkels/realpath-uresult
realpath: return UResult from uumain() function
2022-01-07 21:51:57 +01:00
Sylvestre Ledru
5f778ffa2e
Merge pull request #2847 from jfinkels/pr-uresult
pr: return UResult from uumain() function
2022-01-07 21:51:41 +01:00
Sylvestre Ledru
480bd3c36a
Merge pull request #2835 from jfinkels/tsort-uresult
tsort: return UResult from uumain() function
2022-01-07 21:51:25 +01:00
Sylvestre Ledru
0f4b0fd9cd
Merge pull request #2832 from jfinkels/timeout-uresult
timeout: return UResult from uumain() function
2022-01-07 21:51:01 +01:00
Sylvestre Ledru
3f27597fca
Merge pull request #2823 from jfinkels/split-uresult
split: return UResult from uumain() function
2022-01-07 21:49:11 +01:00
Sylvestre Ledru
c14ba865ce
Merge pull request #2821 from jfinkels/runcon-uresult
runcon: return UResult from uumain() function
2022-01-07 21:47:51 +01:00
Sylvestre Ledru
969f3cbf39
Merge pull request #2793 from tertsdiepraam/cksum-result-io-error
`cksum`: use `UIoError`
2022-01-07 21:47:01 +01:00
electricboogie
01585a57f6 Fix Errno 1, print errors at the md call point 2022-01-07 00:38:24 -06:00
electricboogie
30b2425541 Fix newline when only dirs in base directory, and test 2022-01-06 14:58:56 -06:00
Justin Tracey
9ad8a03646 join: operate on bytes instead of Strings 2022-01-05 13:24:10 -05:00
kimono-koans
421330d07a
ls: Improve error handling and other improvements (#2809)
*  print error in the correct order by flushing the stdout buffer before printing an error
*  print correct GNU error codes
*  correct formatting for config.inode, and for dangling links
*  correct padding for Format::Long
*  remove colors after the -> link symbol as this doesn't match GNU
*  correct the major, minor #s for char devices, and correct padding
*  improve speed for all metadata intensive ops by not allocating metadata unless in a Sort mode
*  new tests, have struggled with how to deal with stderr, stdout ordering in a test though
*  tried to implement UIoError, but am still having issues matching the formatting of GNU


Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
2022-01-05 14:50:37 +01:00
Sylvestre Ledru
ae7190ec73
Merge pull request #2846 from jfinkels/wc-uresult
wc: return UResult from uumain() function
2022-01-05 14:39:39 +01:00
Sylvestre Ledru
64effa5e78
Merge branch 'master' into split-uresult 2022-01-05 13:51:48 +01:00
Sylvestre Ledru
8ef2ea1356
Merge pull request #2830 from jfinkels/tee-uresult
tee: return UResult from uumain() function
2022-01-05 13:51:05 +01:00
Jeffrey Finkelstein
b30a20d895 chcon: return UResult from uumain() function 2022-01-02 20:08:11 -05:00
Jeffrey Finkelstein
49dca9adcb realpath: return UResult from uumain() function 2022-01-02 19:59:15 -05:00
Jeffrey Finkelstein
c80e44fb08 pr: return UResult from uumain() function 2022-01-02 19:48:52 -05:00
Jeffrey Finkelstein
cb92db322b timeout: return UResult from uumain() function 2022-01-02 19:41:21 -05:00
Jeffrey Finkelstein
9caf15c44f fixup! wc: return UResult from uumain() function 2022-01-02 19:40:22 -05:00
Sylvestre Ledru
cd1a0fbe36
Merge pull request #2841 from sbentmar/add-suffix-to-numfmt
numfmt: implement missing --suffix option
2022-01-02 23:07:29 +01:00
Sylvestre Ledru
3c68988ae7
Merge pull request #2843 from tertsdiepraam/stdbuf/fix-cargo-git-build
stdbuf: fix cargo --git build (#1276) (Attempt 2)
2022-01-02 23:06:59 +01:00
Sylvestre Ledru
e7dd56c1d5
Merge pull request #2845 from jfinkels/unexpand-uresult
unexpand: return UResult from uumain() function
2022-01-02 19:02:30 +01:00
Jeffrey Finkelstein
e060ac53f2 wc: return UResult from uumain() function 2022-01-02 11:15:30 -05:00
Jeffrey Finkelstein
f89dc6585d unexpand: return UResult from uumain() function 2022-01-02 10:33:41 -05:00
Jeffrey Finkelstein
b7e646e710 tty: return UResult from uumain() function 2022-01-02 10:28:53 -05:00
Terts Diepraam
ebd5e965e9 stdbuf: fix cargo --git build (#1276) 2022-01-02 14:17:05 +01:00
Sebastian Holgersson
a3895bba59 numfmt: replace if let with simpler match 2022-01-02 02:16:59 +01:00
Sylvestre Ledru
406cd887e0
Merge pull request #2828 from jfinkels/sum-uresult
sum: return UResult from uumain() function
2022-01-01 22:37:01 +01:00
Sylvestre Ledru
8673fbaa03
Merge pull request #2829 from jfinkels/sync-uresult
sync: return UResult from uumain() function
2022-01-01 22:36:11 +01:00
Sylvestre Ledru
46767952ce
Merge pull request #2831 from jfinkels/test-uresult
test: return UResult from uumain() function
2022-01-01 22:35:51 +01:00
Sebastian Holgersson
af5919e466 numfmt: implement missing --suffix option
adds support for the --suffix option from issue #1280.
2022-01-01 21:57:23 +01:00
Terts Diepraam
7fa720d311 fix lint, fmt & udeps errors 2022-01-01 19:43:44 +01:00
Terts Diepraam
62341112df remove cut-specific macros 2022-01-01 18:50:34 +01:00
Terts Diepraam
c075f105a4 remove unnecessary and unused macros 2022-01-01 18:31:47 +01:00
Jeffrey Finkelstein
d03dcc0231 test: return UResult from uumain() function 2021-12-31 18:25:26 -05:00
Jeffrey Finkelstein
3339060ece tsort: return UResult from uumain() function 2021-12-31 14:57:00 -05:00
Jeffrey Finkelstein
c23a844c1e truncate: return UResult from uumain() function 2021-12-31 14:50:52 -05:00
Jeffrey Finkelstein
21c1d832ae tr: return UResult from uumain() function 2021-12-31 14:44:57 -05:00
Jeffrey Finkelstein
1ead016f35 fixup! sync: return UResult from uumain() function 2021-12-31 14:28:27 -05:00
Jeffrey Finkelstein
28958a3ed2 tee: return UResult from uumain() function 2021-12-31 14:07:39 -05:00
Jeffrey Finkelstein
4e16717c22 sync: return UResult from uumain() function 2021-12-31 13:59:20 -05:00
Jeffrey Finkelstein
29d7103670 sum: return UResult from uumain() function 2021-12-31 13:53:56 -05:00
Jeffrey Finkelstein
df188258ec stdbuf: return UResult from uumain() function 2021-12-31 12:23:45 -05:00
Jeffrey Finkelstein
1f937b0760 split: return UResult from uumain() function 2021-12-31 12:19:36 -05:00
Jeffrey Finkelstein
b5522e1132 runcon: return UResult from uumain() function 2021-12-31 12:12:13 -05:00
Sylvestre Ledru
cb051e7416
Merge pull request #2825 from jfinkels/stat-uresult
stat: return UResult from uumain() function
2021-12-31 11:06:02 +01:00
Sylvestre Ledru
e3ba10cf1f
Merge pull request #2824 from jfinkels/split-strategy-enum
split: replace string checking with Strategy enum
2021-12-31 10:44:49 +01:00
Sylvestre Ledru
3e97de6946
Merge pull request #2820 from jfinkels/rm-uresult
rm: return UResult from uumain() function
2021-12-31 10:43:47 +01:00
Sylvestre Ledru
a99ce6f3f0
Merge pull request #2819 from jfinkels/relpath-uresult
relpath: return UResult from uumain() function
2021-12-31 10:43:21 +01:00
Sylvestre Ledru
60f501bab3
Merge pull request #2818 from jfinkels/readlink-uresult
readlink: return UResult from uumain() function
2021-12-31 10:43:09 +01:00
Sylvestre Ledru
e08f94ca28
Merge pull request #2817 from jfinkels/ptx-uresult
ptx: return UResult from uumain() function
2021-12-31 10:42:45 +01:00
Jeffrey Finkelstein
a862fdd60b stat: return UResult from uumain() function 2021-12-30 22:39:23 -05:00
Jeffrey Finkelstein
8f04613a84 split: create Strategy enum for chunking strategy 2021-12-30 22:18:17 -05:00
Jeffrey Finkelstein
25d0ccc61d split: move parsing outside of *Splitter::new()
Move the parsing of the output chunk size from inside
`ByteSplitter::new()` and `LineSplitter::new()` to outside. This
eliminates duplicate code and reduces the responsibilities of the
`ByteSplitter` and `LineSplitter` implementations.
2021-12-30 22:17:26 -05:00
Jeffrey Finkelstein
75e742a008 split: correct help text for -l option 2021-12-30 22:17:20 -05:00
Sylvestre Ledru
9f21cd0d37
Merge pull request #2822 from jfinkels/shred-uresult
shred: return UResult from uumain() function
2021-12-30 09:51:51 +01:00
Jeffrey Finkelstein
e9093681a5 shred: return UResult from uumain() function 2021-12-29 20:33:04 -05:00
Sylvestre Ledru
a8457bfad6
Merge pull request #2798 from jfinkels/fmt-uresult
fmt: return UResult from uumain() function
2021-12-29 21:59:50 +01:00
Jeffrey Finkelstein
f6305e2a3e rm: return UResult from uumain() function 2021-12-29 15:57:55 -05:00
Jeffrey Finkelstein
ab495427b4 relpath: return UResult from uumain() function 2021-12-29 15:49:30 -05:00
Jeffrey Finkelstein
980708cdee readlink: return UResult from uumain() function 2021-12-29 14:44:22 -05:00
Jeffrey Finkelstein
2a7831bd94 readlink: eliminate duplicate code 2021-12-29 14:42:00 -05:00
Jeffrey Finkelstein
da198e5469 ptx: return UResult from uumain() function 2021-12-29 14:28:45 -05:00
Terts Diepraam
4ae838a8b2
Merge pull request #2786 from E3uka/cut_uresult
cut: use UResult
2021-12-29 15:24:05 +01:00
Terts Diepraam
25c10ad540
Merge pull request #2791 from jfinkels/csplit-uresult
csplit: return UResult from uumain() function
2021-12-29 15:21:56 +01:00
jfinkels
8a55205521
seq: return UResult from uumain() function (#2784) 2021-12-29 15:20:17 +01:00
jfinkels
3f18b98c9d
dd: return UResult from uumain() function (#2792)
* dd: return UResult from uumain() function

* fixup! dd: return UResult from uumain() function
2021-12-29 15:13:52 +01:00
Terts Diepraam
645eea0c09
Merge pull request #2815 from jfinkels/printf-uresult
printf: return UResult from uumain() function
2021-12-29 15:10:20 +01:00
Terts Diepraam
12770ca2a9
Merge pull request #2814 from jfinkels/pinky-uresult
pinky: return UResult from uumain() function
2021-12-29 15:09:58 +01:00
Terts Diepraam
a285e8bfa9
Merge pull request #2813 from jfinkels/pathchk-uresult
pathchk: return UResult from uumain() function
2021-12-29 15:09:30 +01:00
Terts Diepraam
36b4ab4e7e
Merge pull request #2812 from jfinkels/paste-uresult
paste: return UResult from uumain() function
2021-12-29 15:09:12 +01:00
Terts Diepraam
80fab36639
Merge pull request #2811 from jfinkels/od-uresult
od: return UResult from uumain() function
2021-12-29 15:08:49 +01:00
Terts Diepraam
463127f59f
Merge pull request #2810 from jfinkels/numfmt-uresult
numfmt: return UResult from uumain() function
2021-12-29 15:08:27 +01:00
Terts Diepraam
5faf7a37f9
Merge pull request #2808 from jfinkels/nohup-uresult
nohup: return UResult from uumain() function
2021-12-29 15:08:04 +01:00
Terts Diepraam
689ae1dd84
Merge pull request #2807 from jfinkels/nice-uresult
nice: return UResult from uumain() function
2021-12-29 15:07:40 +01:00
Terts Diepraam
46a6b85ba0
Merge pull request #2806 from jfinkels/mv-uresult
mv: return UResult from uumain() function
2021-12-29 15:07:12 +01:00
Terts Diepraam
3a76cbe9b9
Merge pull request #2805 from jfinkels/mknod-uresult
mknod: return UResult from uumain() function
2021-12-29 15:06:37 +01:00
Terts Diepraam
92259b6959
Merge pull request #2804 from jfinkels/mkfifo-uresult
mkfifo: return UResult from uumain() function
2021-12-29 15:06:03 +01:00
Terts Diepraam
b81fb167e2
Merge pull request #2803 from jfinkels/logname-uresult
logname: return UResult from uumain() function
2021-12-29 15:05:23 +01:00
Terts Diepraam
27da982150
Merge pull request #2802 from jfinkels/link-uresult
link: return UResult from uumain() function
2021-12-29 15:05:01 +01:00
Terts Diepraam
50bd240451
Merge pull request #2801 from jfinkels/join-uresult
join: return UResult from uumain() function
2021-12-29 15:04:37 +01:00
Terts Diepraam
2d77ea6b68
Merge pull request #2800 from jfinkels/hashsum-uresult
hashsum: return UResult from uumain() function
2021-12-29 15:04:03 +01:00
Terts Diepraam
ee60d58410
Merge pull request #2799 from jfinkels/groups-uresult
groups: return UResult from uumain() function
2021-12-29 15:03:31 +01:00
Terts Diepraam
2fa0c55a6e
Merge pull request #2797 from jfinkels/factor-uresult
factor: return UResult from uumain() function
2021-12-29 15:02:22 +01:00
Terts Diepraam
a6f5238f19
Merge pull request #2796 from jfinkels/expand-uresult
expand: return UResult from uumain() function
2021-12-29 15:01:40 +01:00
Terts Diepraam
bd98dda7fb
Merge pull request #2795 from jfinkels/dircolor-uresult
dircolors: return UResult from uumain() function
2021-12-29 15:00:34 +01:00
Terts Diepraam
33bd5e0913
Merge pull request #2788 from jfinkels/chroot-uresult
chroot: return UResult from uumain() function
2021-12-29 14:59:39 +01:00
Jeffrey Finkelstein
c875eef632 printf: return UResult from uumain() function 2021-12-28 21:05:32 -05:00
Jeffrey Finkelstein
a6a4e0acd2 pinky: return UResult from uumain() function 2021-12-28 20:59:55 -05:00
Jeffrey Finkelstein
fcd5c0a30f pathchk: return UResult from uumain() function 2021-12-28 20:43:57 -05:00
Jeffrey Finkelstein
dd9ce9d267 paste: return UResult from uumain() function 2021-12-28 20:27:13 -05:00
Jeffrey Finkelstein
45a5fb8391 od: return UResult from uumain() function 2021-12-28 20:07:21 -05:00
Jeffrey Finkelstein
595d4dbb95 numfmt: return UResult from uumain() function 2021-12-28 19:46:20 -05:00
Jeffrey Finkelstein
f91773037e nohup: return UResult from uumain() function 2021-12-28 14:45:29 -05:00
Jeffrey Finkelstein
b89bb391c2 nice: return UResult from uumain() function 2021-12-27 19:44:26 -05:00
Jeffrey Finkelstein
d8c5b50923 mv: return UResult from uumain() function 2021-12-27 19:35:38 -05:00
Jeffrey Finkelstein
882a293974 mknod: return UResult from uumain() function 2021-12-27 18:49:35 -05:00
Jeffrey Finkelstein
b8bc5129fa mkfifo: return UResult from uumain() function 2021-12-27 18:37:28 -05:00
Jeffrey Finkelstein
14c62cc5e3 logname: return UResult from uumain() function 2021-12-27 18:32:39 -05:00
Jeffrey Finkelstein
a882b0cf3e link: return UResult from uumain() function 2021-12-27 18:26:25 -05:00
Jeffrey Finkelstein
a8c2beb548 join: return UResult from uumain() function 2021-12-27 15:53:21 -05:00
Jeffrey Finkelstein
354cd7d3df hashsum: return UResult from uumain() function 2021-12-27 15:46:47 -05:00
Jeffrey Finkelstein
c3cf88df83 groups: return UResult from uumain() function 2021-12-27 15:22:55 -05:00
Jeffrey Finkelstein
be13ff4890 fmt: return UResult from uumain() function 2021-12-26 16:41:16 -05:00
Jeffrey Finkelstein
e9fc964a3e factor: return UResult from uumain() function 2021-12-26 16:06:33 -05:00
Jeffrey Finkelstein
bb3efc7c30 expand: return UResult from uumain() function 2021-12-26 16:02:35 -05:00
Jeffrey Finkelstein
adce52571d dircolors: return UResult from uumain() function 2021-12-26 15:57:23 -05:00
Ebuka Agbanyim
ae6e3fdaf7 cut: use UResult 2021-12-26 20:56:23 +00:00
Terts Diepraam
7ae9e0a7eb cksum: accept directories as empty files 2021-12-26 21:50:13 +01:00
Jeffrey Finkelstein
f2bf1a7ff7 fixes suggested by nightly version of clippy 2021-12-26 15:45:33 -05:00
Jeffrey Finkelstein
a84f57dd1f fixup! csplit: return UResult from uumain() function 2021-12-26 15:20:09 -05:00
Terts Diepraam
8885263ad5 cksum: use UIoError 2021-12-26 18:41:25 +01:00
Terts Diepraam
4b4a83ac2e
Merge pull request #2789 from jfinkels/cksum-uresult
cksum: return UResult from uumain() function
2021-12-26 18:30:30 +01:00
Jeffrey Finkelstein
a26fbe7c8e csplit: return UResult from uumain() function 2021-12-25 20:19:16 -05:00
Sylvestre Ledru
5f71e0c8c8
Merge pull request #2790 from jfinkels/comm-uresult
comm: return UResult from uumain() function
2021-12-25 10:41:39 +01:00
Sylvestre Ledru
4ada922a4a
Merge pull request #2741 from jfinkels/seq-width-negative-decimal
seq: correct width for certain negative decimals
2021-12-24 20:46:43 +01:00
Jeffrey Finkelstein
2aebfc9f8d comm: return UResult from uumain() function 2021-12-24 13:40:18 -05:00
Jeffrey Finkelstein
aacbfe681f chroot: return UResult from uumain() function 2021-12-24 13:26:48 -05:00
Jeffrey Finkelstein
6f7ce781cb cksum: return UResult from uumain() function 2021-12-24 13:24:09 -05:00
Jeffrey Finkelstein
294bde8e08 seq: correct width for certain negative decimals
Fix a bug in which a negative decimal input would not be displayed with
the correct width in the output. Before this commit, the output was
incorrectly

    $ seq -w -.1 .1 .11
    -0.1
    0.0
    0.1

After this commit, the output is correctly

    $ seq -w -.1 .1 .11
    -0.1
    00.0
    00.1

The code was failing to take into account that the input decimal "-.1"
needs to be displayed with a leading zero, like "-0.1".
2021-12-23 20:37:29 -05:00
Jeffrey Finkelstein
b8c572b32d tac: return UResult from uumain() function 2021-12-23 20:30:51 -05:00
kimono-koans
fd64e01d92
ls: Reduce binary size of ls by removing regex crate (#2781) 2021-12-22 18:31:45 +01:00
Sylvestre Ledru
a3041843c9 bump the platform-info dep 2021-12-18 00:04:03 +01:00
Jeffrey Finkelstein
e88a8e8eb2 more: return Ok in main loop 2021-12-15 20:49:41 -05:00
Sylvestre Ledru
5e2dd9d0bc
Merge pull request #2767 from E3uka/more_uresult
more: use UResult
2021-12-15 23:40:38 +01:00
Sylvestre Ledru
5bcc53ecde
Merge pull request #2771 from E3uka/next_prev
more: add next-line and prev-line command.
2021-12-15 23:39:09 +01:00
electricboogie
a1960f5da0
Fix cp bug: pre-write permission change (#2769) 2021-12-15 22:18:02 +01:00
Ebuka Agbanyim
d2095edf6c more: add next-line and prev-line command. 2021-12-14 19:32:38 +00:00
Ebuka Agbanyim
0bf2266ef0 more: use UResult 2021-12-13 00:37:34 +00:00
electricboogie
c7f7a222b9
Fix mv bug: Should be able to stat files, but not able to mv if source and target are the same (#2763)
Closes #2760
2021-12-12 17:49:38 +01:00
Jan Verbeek
f2ddae93fa uucore::entries: Make Passwd::locate and Group::locate thread-safe 2021-11-26 14:48:33 +01:00
Hanif Ariffin
c86cb91dee Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-26 16:39:27 +08:00
Sylvestre Ledru
fe286fa8c8
Merge pull request #2749 from thomasqueirozb/utils_uresult
basename+date+fold+nl+nproc+shuf+uname: use UResult
2021-11-25 13:43:46 +01:00
Smicry
81a1fde9f4 tail use UResult 2021-11-21 12:37:56 +08:00
Hanif Ariffin
38659de66d Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-20 17:06:36 +08:00
Hanif Ariffin
0d3fa51d1e Add license headers
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2021-11-20 17:04:28 +08:00
Roy Ivy III
7e06ddaa92 fix/tee ~ repair 'unstable_name_collisions' compiler warning 2021-11-19 21:40:22 -06:00
Roy Ivy III
7784a252f2 fix/yes ~ revise to match 'nix' changes 2021-11-19 18:04:53 -06:00
Roy Ivy III
03e0cbb020 update 'nix' within workspace to force patched version 2021-11-19 17:55:03 -06:00
Roy Ivy III
f07a1749a1 fix spell-check errors 2021-11-19 17:55:02 -06:00
Roy Ivy III
f20aa49821 maint/CICD ~ (GHA) fix cargo-udeps false positives (add 'ignore' exceptions to sub-crates) 2021-11-19 17:55:02 -06:00
Sylvestre Ledru
43bdcaf212
Merge pull request #2532 from hbina/hbina-rm-silently-accept-presume-input-tty
Silently accepts ---presume-input-tty
2021-11-19 21:42:41 +01:00
Sylvestre Ledru
b4416abc82
Merge pull request #2743 from thomasqueirozb/who_uresult
who: use UResult
2021-11-19 21:41:14 +01:00
Sylvestre Ledru
01440734a4
Merge pull request #2735 from thomasqueirozb/printenv_env_compat
env+printenv: use UResult + improve compatibility
2021-11-19 21:39:34 +01:00
Sylvestre Ledru
da69ab19db
Merge pull request #2745 from thomasqueirozb/chmod_uresult
chmod: use UResult
2021-11-19 21:38:31 +01:00
Smicry
fc851e036b
Implement tail -<number> (#2747)
And add obsolete_syntax test
2021-11-19 21:37:47 +01:00
Thomas Queiroz
ed3e6b5201
uname: use UResult 2021-11-16 20:35:28 -03:00
Thomas Queiroz
06f3db8c55
shuf: use UResult 2021-11-16 20:35:28 -03:00
Thomas Queiroz
bcef1d6cca
nproc: use UResult 2021-11-16 20:35:28 -03:00
Thomas Queiroz
f015b041ec
nl: use UResult 2021-11-16 20:35:28 -03:00
Thomas Queiroz
a7d18f43b4
fold: use UResult 2021-11-16 20:35:28 -03:00
Thomas Queiroz
abc93d6f17
date: use UResult 2021-11-16 20:35:28 -03:00
Thomas Queiroz
2dc4cba64a
basename: use UResult 2021-11-16 17:51:56 -03:00
Roy Ivy III
363453f5e4 tests ~ (factor) refactor divisor() to return quickcheck::TestResult
- return standard quickcheck results
- drop `a == 0 && b == 0` from test domain via TestResult::discard()
- avoid divide by zero panics
- ref: #1589
2021-11-13 14:18:23 -06:00
Roy Ivy III
740d8e9bc5 docs/factor ~ (BENCHMARKING.md) fix formatting, returning missing newlines 2021-11-13 11:07:02 -06:00
Hanif Bin Ariffin
da46cc8015 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-13 18:33:25 +08:00
Thomas Queiroz
670ed6324b
chmod: use UResult 2021-11-12 18:29:08 -03:00
Sylvestre Ledru
177374aa5a
Merge pull request #2740 from jfinkels/seq-inf-width-spaces
seq: correct fixed-width spacing for inf sequences
2021-11-12 21:16:40 +01:00
nicoo
bed45602a7 factor/Cargo.toml: Document feature pending a MinRustV bump 2021-11-10 15:26:36 +01:00
nicoo
32b0178a72 factor: Update to current versions of smallvec
smallvec 1.0 and later wasn't compatible with Rust 1.33 but the
minimum supported Rust version for coreutils moved on.
2021-11-10 15:12:37 +01:00
Thomas Queiroz
cbe6d7d5c1
who: use UResult 2021-11-09 20:00:34 -03:00
Jeffrey Finkelstein
0b86afa858 seq: correct fixed-width spacing for inf sequences
Pad infinity and negative infinity values with spaces when using the
`-w` option to `seq`. This corrects the behavior of `seq` to match that
of the GNU version:

    $ seq -w 1.000 inf inf | head -n 4
    1.000
      inf
      inf
      inf

Previously, it incorrectly padded with 0s instead of spaces.
2021-11-08 20:12:54 -05:00
jfinkels
2e12316ae1
seq: use BigDecimal to represent floats (#2698)
* seq: use BigDecimal to represent floats

Use `BigDecimal` to represent arbitrary precision floats in order to
prevent numerical precision issues when iterating over a sequence of
numbers. This commit makes several changes at once to accomplish this
goal.

First, it creates a new struct, `PreciseNumber`, that is responsible for
storing not only the number itself but also the number of digits (both
integer and decimal) needed to display it. This information is collected
at the time of parsing the number, which lives in the new
`numberparse.rs` module.

Second, it uses the `BigDecimal` struct to store arbitrary precision
floating point numbers instead of the previous `f64` primitive
type. This protects against issues of numerical precision when
repeatedly accumulating a very small increment.

Third, since neither the `BigDecimal` nor `BigInt` types have a
representation of infinity, minus infinity, minus zero, or NaN, we add
the `ExtendedBigDecimal` and `ExtendedBigInt` enumerations which extend
the basic types with these concepts.

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats
2021-11-06 15:44:42 +01:00
equal-l2
cda3d5a29b ls: add possible value for --color= 2021-11-06 03:42:27 +09:00
Thomas Queiroz
a290c77cfc
env: add contributor 2021-11-04 20:18:59 -03:00
Hanif Bin Ariffin
ac68bc9ac7 Merge branch 'master' of github.com:uutils/coreutils into hbina-rm-silently-accept-presume-input-tty 2021-11-04 16:57:14 +08:00
Hanif Bin Ariffin
a9bc457d89 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-04 16:55:55 +08:00
Thomas Queiroz
8ad95c375a
env: force specifying command with --chdir 2021-11-02 20:06:23 -03:00
Thomas Queiroz
013405d1e6
env: change -c to -C 2021-11-02 19:51:45 -03:00
Thomas Queiroz
3d74e7b452
env: prevent panic when unsetting invalid variable 2021-11-02 19:42:52 -03:00
Thomas Queiroz
db00fab7e4
env: use UResult everywhere 2021-11-02 19:17:54 -03:00
Thomas Queiroz
b157a73a1f
printenv: change exit code when variable not found
GNU printenv has this behavior
2021-11-02 18:36:28 -03:00
Thomas Queiroz
f2a3a1f920
printenv: use UResult 2021-11-02 18:36:28 -03:00
Michael Debertol
a05628f018
Merge pull request #2731 from thomasqueirozb/env_empty_name
env: don't panic when name is empty
2021-11-02 21:33:42 +01:00
Thomas Queiroz
1afc7242a5
env: change comment 2021-11-02 17:23:34 -03:00
Thomas Queiroz
c58bd9f569
env: don't panic when name is empty 2021-11-02 16:40:03 -03:00
Hanif Bin Ariffin
5a056c2c93 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-02 20:58:03 +08:00
Michael Debertol
7c94bb082e
Merge pull request #2726 from thomasqueirozb/strip_pre_suffix
uu+tests: use strip_prefix and strip_suffix
2021-11-01 23:34:27 +01:00
Michael Debertol
3fdff304db cp: handle edge cases when dest is a symlink
- Fail if dest is a dangling symlink
- Fail if dest is a symlink that was previously created by the same
invocation of cp
2021-11-01 22:48:48 +01:00
Michael Debertol
8696193b66 cat: use FileInformation from uucore 2021-11-01 22:42:15 +01:00
Hanif Bin Ariffin
33b5e67bea Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-10-30 10:01:41 +08:00
Kevin Burke
3e1c5c2d99
rm: allow -r flag to be specified multiple times
GNU rm allows the `-r` flag to be specified multiple times, but
uutils/coreutils would previously exit with an error.

I encountered this while attempting to run `make clean` on the
Postgres source tree (github.com/postgres/postgres).

Updates #1663.
2021-10-28 22:47:07 -07:00
Hanif Bin Ariffin
02fd7176b7 Merge branch 'master' of https://github.com/uutils/coreutils into hbina-tr-reimplement-expansion 2021-10-27 13:08:57 +08:00
Thomas Queiroz
007f1b9f84
uu+tests: use strip_prefix and strip_suffix 2021-10-24 12:23:32 -03:00
Sylvestre Ledru
15fcbf3aac
Merge pull request #2728 from thomasqueirozb/uniq_uresult
uniq: use UResult
2021-10-24 09:46:22 +02:00
Hanif Bin Ariffin
002584d0dd Merge branch 'hbina-tr-reimplement-expansion' of github.com:hbina/coreutils into hbina-tr-reimplement-expansion 2021-10-24 11:41:19 +08:00
Hanif Bin Ariffin
2dad536785 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-24 11:40:42 +08:00
Thomas Queiroz
ea9b239841
uniq: use UResult 2021-10-24 00:03:33 -03:00
Thomas Queiroz
1f15b8fce4
cksum: use while loops instead of unroll! 2021-10-23 23:25:22 -03:00
Thomas Queiroz
21a2d0ce40
sort: use Range.is_empty 2021-10-23 23:22:21 -03:00
Thomas Queiroz
5e5bb91043
sort: remove unecessary implementation 2021-10-23 23:21:45 -03:00
Sylvestre Ledru
43e85ae9ce install: Also import fs from uucore 2021-10-24 00:33:00 +02:00
Sylvestre Ledru
6946377e02 cp: Also import entries from uucore 2021-10-24 00:29:24 +02:00
Sylvestre Ledru
b5977021bc Fix the uu_base32 dep 2021-10-24 00:12:05 +02:00
Sylvestre Ledru
995826e4a2
Merge pull request #2724 from sylvestre/silent-a-warning-2
Ignore two question-mark warnings
2021-10-23 23:46:59 +02:00
Sylvestre Ledru
d286c3ba4b
Merge pull request #2723 from Smicry/master
uniq: use UResult in util
2021-10-23 21:35:51 +02:00
Sylvestre Ledru
a5bc2211d5 Ignore two question-mark warnings 2021-10-23 20:59:19 +02:00
Sylvestre Ledru
f28da04fc5
Merge pull request #2722 from sylvestre/version
Prepare version 0.0.8
2021-10-23 20:56:27 +02:00
Smicry
0ffbf28cba uniq: use UResult in util 2021-10-24 02:02:49 +08:00
Sylvestre Ledru
59e9870c56 Prepare version 0.0.8 2021-10-23 19:21:50 +02:00
Sylvestre Ledru
3ffc4c07eb fix a map-clone warning 2021-10-23 19:19:52 +02:00
Sylvestre Ledru
4c8b74797f Silent question_mark clippy warnings 2021-10-23 19:19:36 +02:00
Sylvestre Ledru
610fde45ef
Merge pull request #2709 from jaggededgedjustice/support-symboli-modes
Add symbolic mode support to mkdir
2021-10-23 17:54:15 +02:00
Sylvestre Ledru
811698b658
Merge pull request #2712 from jfinkels/head-take-lines-reader
head: use std::io::copy() with TakeLines reader
2021-10-23 17:53:44 +02:00
Sylvestre Ledru
803c05cb4a
Merge pull request #2720 from Smicry/master
head: use UResult in util
2021-10-23 17:53:35 +02:00
Hanif Bin Ariffin
6c67f19df4 Merge branch 'master' of https://github.com/uutils/coreutils into hbina-tr-reimplement-expansion
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-21 13:31:51 +08:00
Jeffrey Finkelstein
858b0a9e9f head: use std::io::copy() with TakeLines reader
Replace the custom `split::walk_lines()` function with a call to
`std::io::copy()`, using a new `TakeLines` reader as the source and
`stdout` as the destination. The `TakeLines` reader is an adaptor that
scans the bytes being read for line ending characters and stops the
reading after a given number of lines has been read (similar to the
`std::io::Take` adaptor).

This change

* makes the `read_n_lines()` function more concise,
* allows it to mirror the implementation of `read_n_bytes()`,
* increases the speed of `head -n NUM`.
2021-10-20 20:59:44 -04:00
Smicry
b89b11f5da fix lint error 2021-10-21 00:22:36 +08:00
Smicry
396fa7a9b4 fix lint error 2021-10-21 00:13:28 +08:00
Smicry
2cbc2aa59b head: use UResult in util 2021-10-20 23:49:04 +08:00
Sylvestre Ledru
ede77c6099
Merge pull request #2711 from jfinkels/hashsum-crlf-windows-across-blocks
hashsum: fix handling of \r\n in Windows text mode
2021-10-19 20:50:16 +02:00
Smicry
cb34b660cb add tail usage 2021-10-19 00:15:17 +08:00
James Robson
0b2483452a Add symbolic mode support to mkdir 2021-10-16 12:57:55 +01:00
Sylvestre Ledru
40a895f79d
Merge pull request #2705 from adamreichold/tac-mmap
Minor improvements to tac
2021-10-12 21:51:38 +02:00
Hanif Bin Ariffin
c4de592e90 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-12 07:39:06 +08:00
Jeffrey Finkelstein
429e1d0f12 head: use default() instead of new() for options
Remove the `HeadOptions::new()` function in favor of the `Default`
implementation. Both were implemented, but only `Default::default()` is
needed.
2021-10-11 18:30:03 -04:00
Jeffrey Finkelstein
d1e02665bf fixup! hashsum: fix handling of \r\n in Windows text mode 2021-10-11 18:18:29 -04:00
Jeffrey Finkelstein
c50b5ac110 hashsum: fix handling of \r\n in Windows text mode
Fix a bug in which "\r\n" was not being replaced with "\n" in text mode
on Windows. This would happen only if one call to `write()` ended with a
"\r" character and the next call to `write()` started with a "\n"
character. This commit fixes the bug by buffering a "\r" character if it
appears at the end of one call to `write()` and only writing if the
first character in the next call to `write()` is *not* a "\n" character.

Fixes issue #2681.
2021-10-11 17:36:08 -04:00
Adam Reichold
86d22aaa1d tac: Add a simple how to for benchmarking 2021-10-10 14:29:37 +02:00
Adam Reichold
c526df57b8 tac: opportunistically use memory maps
Since tac must read its input files completely to start processing them
from the end, it is particularly suited to use memory maps to benefit
from the page cache maintained by the operating systems to bring the
necessary data into memory as required.

This does also include situations where the input is stdin, but not via
a pipe but for example a file descriptor set up by the user's shell
through an input redirection.
2021-10-10 13:20:31 +02:00
Adam Reichold
4eab275235 tac: buffer stdout more coarsely than line-based following the GNU tac implementation. 2021-10-10 13:20:31 +02:00
Adam Reichold
28b04fa899 tac: do not use a buffered read as fs::read is more efficient and io::Stdin is buffered internally 2021-10-10 13:20:31 +02:00
Adam Reichold
0d583754ca tac: lock stdout only once instead for each line 2021-10-10 13:20:31 +02:00
Adam Reichold
e041fda51d tac: do not re-compile regular expression for each file 2021-10-10 13:20:31 +02:00
Adam Reichold
b4864d760e pr: fix locking of stdout 2021-10-10 11:33:46 +02:00
Jan Scheer
3e985cb029
Merge branch 'master' into fix_chroot_2687 2021-10-10 01:04:25 +02:00
Sylvestre Ledru
080d3d2fa7
Merge pull request #2697 from vulppine/cp-uresult
cp: uumain returns UResult, implements UError for Error enum in cp.rs
2021-10-09 11:03:33 +02:00
Sylvestre Ledru
03a037e8ea
Merge pull request #2701 from vulppine/seq-hex
seq: Adds hexadecimal integer parsing
2021-10-09 11:01:42 +02:00
vulppine
cddd40b4e1 seq: Updates hex parse readability, adds hex test 2021-10-05 18:41:28 -07:00
Hanif Bin Ariffin
c04a0185aa Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-05 16:32:03 +08:00
Thomas Queiroz
e2fa6f9412
users: use UResult 2021-10-04 19:53:46 -03:00
Thomas Queiroz
00c9710206
uucore_procs+uu: specify uucore::show_error
This allows crates to use `#[uucore_procs::gen_uumain]` without `use uucore::show_error` or

    #[macro_use]
    extern crate uucore;

Removed unecessary usage
2021-10-04 19:53:16 -03:00
Sylvestre Ledru
368fa54520
Merge pull request #2703 from thomasqueirozb/base_uresult
base32 + base64 + basenc: use UResult
2021-10-03 17:34:56 +02:00
Thomas Queiroz
b924774c8a
basenc: use UResult 2021-10-02 23:17:16 -03:00
Thomas Queiroz
452329ad19
base64: use UResult 2021-10-02 23:15:40 -03:00
Thomas Queiroz
97df700d67
base32: use UResult 2021-10-02 23:12:09 -03:00
Thomas Queiroz
9dd401c358
base32: base_common use UResult 2021-10-02 23:10:00 -03:00
vulppine
d5caa0d9d8 seq: Adds hexadecimal integer parsing 2021-10-02 08:15:25 -07:00
Jeffrey Finkelstein
548a5121ae dd: use assert! instead of if then panic! 2021-10-02 10:15:15 -04:00
Jeffrey Finkelstein
6aee05a0f1 od: use assert! instead of if then panic! 2021-10-02 09:46:43 -04:00
Jeffrey Finkelstein
de158c0122 sort: replace redundant closure with function itself 2021-10-02 09:46:43 -04:00
Jeffrey Finkelstein
06ae968ecf csplit: use assert! instead of if then panic! 2021-10-02 09:46:43 -04:00
Jeffrey Finkelstein
71b7d6b57d more: remove redundant mut from stdout accesses 2021-10-02 09:46:43 -04:00
Jeffrey Finkelstein
d013461a6f ls: replace redundant closure with function itself 2021-10-02 09:46:43 -04:00
Sylvestre Ledru
b2fa51ddd9
Merge pull request #2656 from jhscheer/ls_selinux
`ls`: add support for showing SELinux context (--context/-Z)
2021-10-02 12:56:09 +02:00
Hanif Bin Ariffin
de605829bf Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-10-02 18:18:52 +08:00
vulppine
4319248bb6 cp: Changes '1' to 'EXIT_ERR' in UError impl 2021-10-01 16:45:19 -07:00
vulppine
c64f09dc59 cp: Adds a needed macro, changes a return 2021-10-01 15:18:05 -07:00
vulppine
4ff5fea502 cp: uumain returns UResult, UError for Error 2021-10-01 14:58:26 -07:00
Sylvestre Ledru
01d098993b
Merge pull request #2662 from Smicry/master
add kill -l final new line #2644
2021-09-29 09:58:50 +02:00
Thomas Queiroz
3882df5cdc
expr: use UResult 2021-09-25 15:36:04 -03:00
Jan Scheer
8cd8c25b0d
ls: silence clippy warnings if feat_selinx is not set 2021-09-22 13:49:08 +02:00
Jan Scheer
8f229aad87
ls: move SELinux String building logic to its own function 2021-09-22 12:24:27 +02:00
Jan Scheer
8c0b7d1314
chroot: move logic so it can be triggered by tests
* move the command building logic before the `chroot` syscall so it
will be reachable by tests that don't have root permissions.
2021-09-22 11:59:43 +02:00
Raphaël Thériault
6931dd11f1 Use non-yanked version of digest crate in hashsum 2021-09-19 12:38:56 -07:00
Hanif Bin Ariffin
f464879b12 Reduce MSRV to 1.47.0
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-09-19 23:15:28 +08:00
Hanif Bin Ariffin
9ab4f3de2f Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-09-19 23:01:48 +08:00
Jan Scheer
94fbe1edef
chroot: quick fix for #2687
* fixes #2687
* change error message to better mimic GNU
2021-09-19 13:58:44 +02:00