Terts Diepraam
8df253da69
cat: set exit code for invalid arguments to 1 instead of 2
2022-05-04 21:32:14 +02:00
Ackerley Tng
88a62c4922
du: use common error methods with show! instead of set_exit_code
2022-05-04 07:33:19 -07:00
Daniel Hofstetter
9bd883169d
df: set min width of "Used" column to 5
2022-05-04 09:37:09 +02:00
dependabot[bot]
3e30569c2f
build(deps): bump xattr from 0.2.2 to 0.2.3
...
Bumps [xattr](https://github.com/Stebalien/xattr ) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/Stebalien/xattr/releases )
- [Commits](https://github.com/Stebalien/xattr/commits )
---
updated-dependencies:
- dependency-name: xattr
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-04 06:13:02 +00:00
anastygnome
badf947f8a
Do not dereference symlink even when dangling ( fix #3364 )
...
Fixes an issue with cp not copying symlinks in spite of the -P (no dereference option)
Fix issue #3364
Performance improvements
Avoid useless read from metadata and reuse previous dest information
Signed-off-by: anastygnome <noreplygit@protonmail.com>
2022-05-03 19:53:23 +02:00
Daniel Hofstetter
15412f100a
df: show "block-size argument too large" error
2022-05-03 09:26:57 +02:00
Sylvestre Ledru
0b9d703da8
Merge branch 'main' into 2884-time-0.3
2022-05-02 21:21:45 +02:00
Sylvestre Ledru
8353b06526
Merge pull request #3472 from uutils/dependabot/cargo/memchr-2.5.0
...
build(deps): bump memchr from 2.4.1 to 2.5.0
2022-05-02 21:03:13 +02:00
Sylvestre Ledru
9b69e6fd47
Merge branch 'main' into 2884-time-0.3
2022-05-02 18:14:14 +02:00
dependabot[bot]
a1e5f8e53f
build(deps): bump memchr from 2.4.1 to 2.5.0
...
Bumps [memchr](https://github.com/BurntSushi/memchr ) from 2.4.1 to 2.5.0.
- [Release notes](https://github.com/BurntSushi/memchr/releases )
- [Commits](https://github.com/BurntSushi/memchr/compare/2.4.1...2.5.0 )
---
updated-dependencies:
- dependency-name: memchr
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 13:03:18 +00:00
Sylvestre Ledru
1c124fa6ed
Merge pull request #3468 from uutils/dependabot/cargo/libc-0.2.125
...
build(deps): bump libc from 0.2.124 to 0.2.125
2022-05-02 15:01:17 +02:00
353fc443 aka Seagull
3f942cddf5
Merge branch 'main' into mktemp-set-dir-mode
2022-05-02 10:24:03 +03:00
353fc443
87c2122e76
mktemp: change directory permission after creation
2022-05-02 07:20:29 +00:00
Sylvestre Ledru
fe7829d2f9
Merge pull request #3455 from mike-kfed/ptx_breakfile
...
ptx: implement breakfile option
2022-05-02 08:39:14 +02:00
dependabot[bot]
de6aa6de9b
build(deps): bump libc from 0.2.124 to 0.2.125
...
Bumps [libc](https://github.com/rust-lang/libc ) from 0.2.124 to 0.2.125.
- [Release notes](https://github.com/rust-lang/libc/releases )
- [Commits](https://github.com/rust-lang/libc/compare/0.2.124...0.2.125 )
---
updated-dependencies:
- dependency-name: libc
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 06:36:41 +00:00
Sylvestre Ledru
3078ca8346
Add CHARCLASS to the spell ignore
2022-05-01 20:18:33 +02:00
Jeffrey Finkelstein
aa6aefbd64
mktemp: respect path given in template argument
...
Fix a bug in `mktemp` where it was not respecting the path given by
the positional argument. Previously, it would place the temporary file
whose name is induced by a given template in the `/tmp` directory,
like this:
$ mktemp XXX
/tmp/LJr
$ mktemp d/XXX
/tmp/d/IhS
After this commit, it respects the directory given in the template
argument:
$ mktemp XXX
LJr
$ mktemp d/XXX
d/IhS
Fixes #3440 .
2022-05-01 13:03:18 -04:00
Sylvestre Ledru
9d81d6fef2
touch: add support of -d '1970-01-01 18:43:33.023456789'
2022-05-01 17:01:22 +02:00
Sylvestre Ledru
31c28eeaa9
fix gnu/tests/touch/60-seconds
2022-05-01 17:01:22 +02:00
Sylvestre Ledru
2b11d77395
time: Improve the l&f
2022-05-01 17:01:13 +02:00
Sylvestre Ledru
c009e1bed8
workaround the tests/touch/60-seconds test to skip leap second
2022-05-01 17:00:41 +02:00
Sylvestre Ledru
3a576f2441
time: Various fixes
2022-05-01 17:00:35 +02:00
Sylvestre Ledru
ca670148f2
build(deps): bump time from 0.1.43 to 0.3.9
...
Bumps [time](https://github.com/time-rs/time ) from 0.1.43 to 0.3.9.
- [Release notes](https://github.com/time-rs/time/releases )
- [Changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md )
- [Commits](https://github.com/time-rs/time/compare/v0.1.43...v0.3.9 )
---
updated-dependencies:
- dependency-name: time
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-01 16:58:47 +02:00
Jan Scheer
90a0226844
tail: improve support for polling
...
* Fix a timing related bug with polling (---disable-inotify) where some
Events weren't delivered fast enough by `Notify::PollWatcher` to pass all
of tests/tail-2/retry.sh and test_tail::{test_retry4, retry7}.
* uu_tail now reverts to polling automatically if inotify backend reports
too many open files (this mimics the behavior of GNU's tail).
2022-04-30 12:02:42 +02:00
Michael Kefeder
83a64f4afe
ptx: escape regular expression character class special chars
2022-04-30 10:01:11 +02:00
Daniel Hofstetter
023fc96aab
df: fix "Size" column header
...
Fixes #3193
2022-04-30 07:33:00 +02:00
Michael Kefeder
4889128ede
ptx: add documentation to read_char_filter_file function
2022-04-29 10:57:36 +02:00
Sylvestre Ledru
f03c069289
Merge pull request #3450 from uutils/dependabot/cargo/retain_mut-0.1.7
...
build(deps): bump retain_mut from 0.1.2 to 0.1.7
2022-04-29 10:50:45 +02:00
Michael Kefeder
b0567670d1
ptx: implement breakfile option
2022-04-28 16:51:06 +02:00
Sylvestre Ledru
bf3a86f654
Merge pull request #3451 from ndd7xv/help-discrepancies
...
fix -h and --help discrepancies
2022-04-28 08:19:41 +02:00
ndd7xv
88752ecc3e
fix -h and --help discrepancies
...
addresses https://github.com/uutils/coreutils/issues/3370
2022-04-27 23:16:36 -04:00
dependabot[bot]
38a8fa6a77
build(deps): bump retain_mut from 0.1.2 to 0.1.7
...
Bumps [retain_mut](https://github.com/upsuper/retain_mut ) from 0.1.2 to 0.1.7.
- [Release notes](https://github.com/upsuper/retain_mut/releases )
- [Commits](https://github.com/upsuper/retain_mut/commits )
---
updated-dependencies:
- dependency-name: retain_mut
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-27 06:44:04 +00:00
dependabot[bot]
3cee681e82
build(deps): bump libc from 0.2.121 to 0.2.124
...
Bumps [libc](https://github.com/rust-lang/libc ) from 0.2.121 to 0.2.124.
- [Release notes](https://github.com/rust-lang/libc/releases )
- [Commits](https://github.com/rust-lang/libc/compare/0.2.121...0.2.124 )
---
updated-dependencies:
- dependency-name: libc
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-26 11:23:42 +02:00
Sylvestre Ledru
641435d1dc
Merge pull request #3433 from uutils/dependabot/cargo/strum_macros-0.24.0
...
build(deps): bump strum_macros from 0.23.1 to 0.24.0
2022-04-25 23:08:35 +02:00
dependabot[bot]
681f5c88e2
build(deps): bump strum_macros from 0.23.1 to 0.24.0
...
Bumps [strum_macros](https://github.com/Peternator7/strum ) from 0.23.1 to 0.24.0.
- [Release notes](https://github.com/Peternator7/strum/releases )
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md )
- [Commits](https://github.com/Peternator7/strum/commits )
---
updated-dependencies:
- dependency-name: strum_macros
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 08:13:59 +02:00
Ryan Zoeller
363a2a5611
Upgrade nix to 0.24.1, ctrlc to 3.2.2
...
Limit nix features, which should help compile times slightly.
Replace usage of deprecated nix functionality with std equivalent.
2022-04-25 08:13:20 +02:00
Sylvestre Ledru
181ebd3996
Revert "df: remove trailing spaces in rightmost column"
2022-04-24 20:39:39 +02:00
Daniel Hofstetter
0f13de4e1a
df: allow sizes with a suffix for --block-size
...
Fixes #3416
2022-04-24 15:37:23 +02:00
Jan Scheer
5331a10a7b
tail: update README
2022-04-24 15:09:28 +02:00
Sylvestre Ledru
5088ddc377
Merge pull request #3408 from cakebaker/ticket_3325
...
df: respect -t arg when specific file is provided
2022-04-23 09:24:08 +02:00
Terts Diepraam
a03e9c7d8b
Merge pull request #3432 from cakebaker/remove_unreachable_code
...
df: remove unreachable code
2022-04-23 01:03:06 +02:00
Jan Scheer
6e1e3ac012
Merge branch 'main' into tail_notify
2022-04-23 00:26:59 +02:00
Jan Scheer
ceb2e993c0
tail: update readmes
2022-04-23 00:26:22 +02:00
Sylvestre Ledru
48a521224e
Merge pull request #3396 from jtracey/android2
...
fix Android support
2022-04-22 16:06:12 +02:00
Daniel Hofstetter
2d4552cce4
df: respect -t arg when specific file is provided
...
Fixes #3325
2022-04-22 10:27:25 +02:00
Jan Scheer
132cab15d2
tail: update notify crate
...
notify-crate:
Switch from latest release to latest commit on main branch
in order to fix the builds on FreeBSD/macOS.
https://github.com/notify-rs/notify/pull/399
2022-04-22 09:54:21 +02:00
Jan Scheer
6c096267bf
Merge branch 'main' into tail_notify
2022-04-21 23:55:54 +02:00
Jan Scheer
4a56d2916d
tail: fix handling of -f
with non regular files
...
This makes uu_tail pass the "gnu/tests/tail-2/inotify-only-regular" test
again by adding support for charater devices.
test_tail:
* add test_follow_inotify_only_regular
* add clippy fixes for windows
2022-04-21 22:52:17 +02:00
Sylvestre Ledru
f684162e21
Merge pull request #3403 from uutils/dependabot/cargo/remove_dir_all-0.7.0
...
build(deps): bump remove_dir_all from 0.5.3 to 0.7.0
2022-04-21 21:32:23 +02:00
Daniel Hofstetter
8d1e340d80
df: remove unreachable code
2022-04-21 15:24:52 +02:00
Terts Diepraam
e8574ca184
Merge pull request #3418 from cakebaker/ticket_3409
...
df: show error if all types are excluded
2022-04-20 23:51:36 +02:00
Sylvestre Ledru
4ed3bbe705
Merge pull request #3423 from cakebaker/remove_trailing_spaces_in_rightmost_column
...
df: remove trailing spaces in rightmost column
2022-04-20 11:42:27 +02:00
Sylvestre Ledru
f6dafbc950
Merge pull request #3429 from cakebaker/ticket_3425
...
df: fix "File" column width for unicode filenames
2022-04-20 10:50:07 +02:00
Justin Tracey
1f025c19af
address libc weirdness on 32 bit android
2022-04-20 08:44:49 +02:00
Justin Tracey
2a0d58d060
get android builds to compile and pass tests
2022-04-20 08:44:49 +02:00
Justin Tracey
5e7d58650d
fix null pointer derefs
...
The code for creating a Passwd from the fields of the raw syscall result
assumed that the syscall would return valid C strings in all non-error
cases. This is not true, and at least one platform (Android) will
populate the fields with null pointers where they are not supported.
To fix this and prevent the error from happening again, this commit
changes `cstr2string(ptr)` to check for a null pointer, and return an
`Option<String>`, with `None` being the null pointer case. While
arguably it should be the caller's job to check for a null pointer
before calling (since the safety precondition is that the pointer is to
a valid C string), relying on the type checker to force remembering this
edge case is safer in the long run.
2022-04-20 08:44:49 +02:00
Jan Scheer
7228902e55
Merge branch 'main' into tail_notify
2022-04-19 22:25:35 +02:00
Jan Scheer
eb21330ade
Merge branch 'main' into tail_notify
2022-04-19 22:14:55 +02:00
Terts Diepraam
cce2eebf98
Merge pull request #3420 from sylvestre/install-verbose
...
install: verbose - list all created directories
2022-04-19 18:56:57 +02:00
Daniel Hofstetter
9de407b1f0
df: fix "File" column width for unicode filenames
...
Fixes #3425
2022-04-19 11:09:46 +02:00
Daniel Hofstetter
cc4b28780b
df: show error if all types are excluded
...
Fixes #3409
2022-04-19 09:10:37 +02:00
Daniel Hofstetter
576ec49fa5
df: remove trailing spaces in rightmost column
2022-04-19 08:13:35 +02:00
Sylvestre Ledru
d7cf3e7483
Merge pull request #3414 from gmnsii/main
...
df: -h -H shouldn't cause an error #3366
2022-04-18 22:24:36 +02:00
Sylvestre Ledru
7910eca71b
install: verbose - list all created directories
...
$ install -Dv source_file1 sub3/a/b/c/file
install: creating directory 'sub3'
install: creating directory 'sub3/a'
install: creating directory 'sub3/a/b'
install: creating directory 'sub3/a/b/c'
'source_file1' -> 'sub3/a/b/c/file'
2022-04-18 22:06:02 +02:00
Sylvestre Ledru
ee50f408bd
Merge pull request #3419 from sylvestre/install-strip
...
install: When install --strip-program=foor fails, remove the target file
2022-04-18 19:29:26 +02:00
Terts Diepraam
ae24ca45f1
Merge pull request #3386 from cakebaker/ticket_3194
...
df: fix incorrect whitespace between columns
2022-04-18 11:13:33 +02:00
Sylvestre Ledru
6da73e6a6d
install: When install --strip-program=foor fails, remove the target file
...
Should fix:
tests/install/strip-program.sh
2022-04-17 22:24:44 +02:00
Terts Diepraam
487c874204
uniq: print warning when both -D
and -c
are passed
2022-04-17 16:32:01 +02:00
Daniel Hofstetter
a052855061
df: fix incorrect whitespace between columns
...
Fixes #3194
2022-04-17 14:00:52 +02:00
gmnsii
c9bf31f97e
Args override themselves and conflicting arguments
2022-04-17 01:52:05 -07:00
gmnsii
85d113ab79
df: -h -H shouldn't cause an error #3366
2022-04-16 07:51:24 -07:00
Daniel Hofstetter
6664525449
df: remove obsolete "show_listed_fs" options field
2022-04-16 15:31:38 +02:00
gmnsii
c2e214bd99
Add dir and vdir utils (based on ls)
...
Fix issue #3163
They are basically ls with some different options.
2022-04-15 17:30:40 +02:00
dependabot[bot]
fae0065276
build(deps): bump remove_dir_all from 0.5.3 to 0.7.0
...
Bumps [remove_dir_all](https://github.com/XAMPPRocky/remove_dir_all ) from 0.5.3 to 0.7.0.
- [Release notes](https://github.com/XAMPPRocky/remove_dir_all/releases )
- [Changelog](https://github.com/XAMPPRocky/remove_dir_all/blob/master/CHANGELOG.md )
- [Commits](https://github.com/XAMPPRocky/remove_dir_all/compare/remove_dir_all@0.5.3...v0.7.0 )
---
updated-dependencies:
- dependency-name: remove_dir_all
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 11:14:49 +00:00
Daniel Hofstetter
a5477960a5
df: show error if specified type doesn't exist
...
Fixes #3252 . As a side effect, "df -H -total" will now fail, too, as
expected.
2022-04-14 10:39:48 +02:00
Sylvestre Ledru
7967017086
Merge pull request #3358 from uutils/dependabot/cargo/nom-7.1.1
...
build(deps): bump nom from 7.1.0 to 7.1.1
2022-04-13 23:21:38 +02:00
dependabot[bot]
a644233ea2
build(deps): bump regex from 1.5.4 to 1.5.5
...
Bumps [regex](https://github.com/rust-lang/regex ) from 1.5.4 to 1.5.5.
- [Release notes](https://github.com/rust-lang/regex/releases )
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/regex/compare/1.5.4...1.5.5 )
---
updated-dependencies:
- dependency-name: regex
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-13 15:17:42 +02:00
dependabot[bot]
29fcb8653b
build(deps): bump nom from 7.1.0 to 7.1.1
...
Bumps [nom](https://github.com/Geal/nom ) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/Geal/nom/releases )
- [Changelog](https://github.com/Geal/nom/blob/main/CHANGELOG.md )
- [Commits](https://github.com/Geal/nom/compare/7.1.0...7.1.1 )
---
updated-dependencies:
- dependency-name: nom
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-13 15:11:54 +02:00
Sylvestre Ledru
c23118bab4
Merge pull request #3387 from cakebaker/ticket_3355
...
df: fix calculation of IUse%
2022-04-13 15:11:41 +02:00
Sylvestre Ledru
10be79c095
Merge pull request #3150 from pyoky/mkdir-fix
...
mkdir: fixed not respecting set umask
2022-04-13 12:00:56 +02:00
Daniel Hofstetter
56e8dda606
df: fix calculation of IUse%
...
Fixes #3355
2022-04-13 11:19:24 +02:00
Sylvestre Ledru
4afe0a77aa
mkdir.rs: Fix a clippy warning on clippy::ptr-arg
...
```
error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> src\uu\mkdir\src/mkdir.rs:72:33
|
72 | fn strip_minus_from_mode(_args: &mut Vec<String>) -> bool {
| ^^^^^^^^^^^^^^^^ help: change this to: `&mut [String]`
|
= note: `-D clippy::ptr-arg` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
```
2022-04-13 10:47:32 +02:00
Sylvestre Ledru
92f01a79dd
Clippy on Windows: also ignore the self warning
2022-04-13 09:28:26 +02:00
Sylvestre Ledru
8cd359c556
Merge pull request #3392 from sylvestre/mv-itself
...
mv: trigger an error when doing mv dir1 dir2 dir2
2022-04-13 09:16:24 +02:00
Sylvestre Ledru
07be7a0ceb
Merge pull request #3388 from cakebaker/return_unnecessarily_wrapped_by_result
...
df: remove unnecessary return of Result
2022-04-12 22:52:31 +02:00
Sylvestre Ledru
920633c0ea
mv: trigger an error when doing mv dir1 dir2 dir2
2022-04-12 22:37:38 +02:00
Sylvestre Ledru
0f59af22d5
Merge pull request #3383 from sudosmile/main
...
mv: add OverwriteMode match in specific case
2022-04-12 20:28:07 +02:00
Daniel Hofstetter
07317f3d9f
df: remove unnecessary return of Result
2022-04-12 16:40:48 +02:00
Daniel Hofstetter
d2289d268a
df: fix too low values in I* columns
...
Fixes #3349
2022-04-12 10:19:41 +02:00
Ashe Leclerc
1d76c96570
mv: add OverwriteMode match in specific case
...
Check OverwriteMode and act depending on its value, specifically in the
the case of overwriting a non-directory with a directory(#3337 )
2022-04-12 09:28:11 +02:00
Sylvestre Ledru
f114d63b4e
Merge pull request #3376 from jfinkels/df-error-on-nonexistent-files
...
df: show error when file argument does not exist
2022-04-12 09:27:59 +02:00
Terts Diepraam
af32f7a117
Dont use from_*
method names that take self
...
This was reported as an error in Clippy 1.60.
2022-04-11 22:50:36 +02:00
Sylvestre Ledru
8b719a8591
du: add support for --exclude and --exclude-from ( #3381 )
...
* du: add support for --exclude and --exclude-from
And add an option --verbose (doesn't exist in GNU)
2022-04-11 22:50:01 +02:00
Jeffrey Finkelstein
460bd67050
df: show error when file argument does not exist
...
For example:
$ df not-a-file
df: not-a-file: No such file or directory
Fixes #3373 .
2022-04-10 22:22:18 -04:00
Sylvestre Ledru
a2cefd9b52
du: Return non zero error code when dealing with permissions errors
...
Nd make the tests/du/no-x.sh & long-sloop.sh pass
2022-04-10 01:47:39 +02:00
Sylvestre Ledru
d0aa9a9927
Merge pull request #3343 from uutils/dependabot/cargo/lscolors-0.9.0
...
build(deps): bump lscolors from 0.7.1 to 0.9.0
2022-04-09 09:29:25 +02:00
Sylvestre Ledru
53baecab49
Merge pull request #3280 from crazystylus/stat-fails-to-read-a-file-redirected-to-stdin
...
`stat`: Adds support to read a filename redirected to stdin
2022-04-09 09:11:48 +02:00
Sylvestre Ledru
935bdd4210
Merge pull request #3368 from tertsdiepraam/msrv-1.56
...
Rust Edition 2021
2022-04-07 11:46:42 +02:00
Kai Lüke
e894e40c56
hashsum: add --no-names option from official b3sum tool ( #3361 )
...
* hashsum: add --no-names option from official b3sum tool
The official b3sum tool has a --no-names option for only printing the
hashes, omitting the filenames. This is quite handy when used from
scripts because it spares the postprocessing with "cut" or "awk".
Since the installed b3sum symlink would also serve as a drop-in for the
official tool, the --no-names option is expected to exist for
compatibility.
Add a --no-names option not only for b3sum but for hashsum in general
(and maybe GNU coreutils will also feel inspired to add this option).
Closes https://github.com/uutils/coreutils/issues/3360
2022-04-06 09:09:37 +02:00
Jan Scheer
a9fa94824d
tail: switch from Notify 5.0.0-pre.13 to 5.0.0-pre.14
2022-04-05 22:19:25 +02:00
Daniel Hofstetter
876924f5d5
df: show error if same type is included & excluded
...
Fixes #3302
2022-04-05 14:21:32 +02:00
Terts Diepraam
18369dc0be
all: use array intoiterator
2022-04-05 10:39:31 +02:00
Terts Diepraam
c6c936f529
all: remove explicit imports of TryFrom and TryInto
...
This is enabled by the changing the edition from 2018 to 2021
2022-04-05 10:39:31 +02:00
Terts Diepraam
af9f718936
Change edition to 2021
2022-04-05 10:39:31 +02:00
Sylvestre Ledru
5fbef7743b
Merge pull request #3367 from sylvestre/tty
...
tty: should not return 2 when --help is used
2022-04-05 08:02:28 +02:00
Sylvestre Ledru
cf722d7f0c
tty: should not return 2 when --help is used
...
This is impacting
gnu/tests/misc/usage_vs_getopt.sh
2022-04-04 22:55:36 +02:00
ndd7xv
298f73f778
env: add program signal messages
2022-04-03 20:01:12 +02:00
Sylvestre Ledru
a219d9e355
Merge pull request #3353 from sylvestre/install
...
install: support of `-d dir/.` to match GNU's
2022-04-03 19:31:48 +02:00
Sylvestre Ledru
3236daabf2
Merge pull request #3356 from sylvestre/rm
...
rm: rename none by --interactive=never to fix ../gnu/tests/rm/i-never.sh
2022-04-03 19:31:17 +02:00
Sylvestre Ledru
c00a277448
mkdir: also use the dir_strip_dot_for_creation function
2022-04-03 16:47:06 +02:00
Sylvestre Ledru
845b2294e1
create a function dir_strip_dot_for_creation to manage the /. issue
2022-04-03 16:47:06 +02:00
Sylvestre Ledru
2628f3ed60
install: support of -d dir/.
to match GNU's
2022-04-03 16:47:06 +02:00
Sylvestre Ledru
02cc67c915
rm: rename none by --interactive=never to fix ../gnu/tests/rm/i-never.sh
2022-04-03 09:15:45 +02:00
dependabot[bot]
ee515b57c3
build(deps): bump lscolors from 0.7.1 to 0.9.0
...
Bumps [lscolors](https://github.com/sharkdp/lscolors ) from 0.7.1 to 0.9.0.
- [Release notes](https://github.com/sharkdp/lscolors/releases )
- [Commits](https://github.com/sharkdp/lscolors/compare/v0.7.1...v0.9.0 )
---
updated-dependencies:
- dependency-name: lscolors
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-02 21:47:15 +02:00
dependabot[bot]
e82ef6966e
build(deps): bump exacl from 0.6.0 to 0.8.0
...
Bumps [exacl](https://github.com/byllyfish/exacl ) from 0.6.0 to 0.8.0.
- [Release notes](https://github.com/byllyfish/exacl/releases )
- [Changelog](https://github.com/byllyfish/exacl/blob/main/CHANGELOG.md )
- [Commits](https://github.com/byllyfish/exacl/compare/v0.6.0...v0.8.0 )
---
updated-dependencies:
- dependency-name: exacl
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-02 21:46:57 +02:00
Terts Diepraam
0fc667730d
join: fix workaround for IntErrorKind
...
In Rust versions before 1.55, there was no enum for parse errors. With the bump of the MSRV to 1.56 we can simplify this.
2022-04-02 15:18:34 +02:00
Terts Diepraam
b7809bd889
version 0.0.13
2022-04-02 11:04:27 +02:00
Sylvestre Ledru
ef8921044b
Merge pull request #3347 from cakebaker/fix_total_use_percentage
...
df: fix calculation of Use% in "total" row
2022-04-02 09:53:08 +02:00
Terts Diepraam
f00ec12e4f
Merge pull request #3345 from DevSabb/presume-input-pipe
...
head, tail: include presume-input-pipe parameter
2022-04-01 21:43:47 +02:00
DevSabb
1eee2194a3
head, tail: include presume-input-pipe parameter
2022-04-01 11:55:33 +02:00
Sylvestre Ledru
b3d87b088d
ln: adjust the error messages
2022-04-01 09:25:35 +02:00
Daniel Hofstetter
bf69c63e09
df: Fix calculation of Use% in "total" row
...
Change formula from: "Used/Size * 100" to "Used/(Used + Avail) * 100".
This formula also works if "Used" and "Avail" do not add up to "Size",
which is the case if there are reserved disk blocks.
2022-04-01 08:25:30 +02:00
Sylvestre Ledru
676283ce93
ln: implement fixes for tests/ln/backup-1.sh
...
When doing
ln b b~
ln -f --b=simple a b
First, we create a backup of b
Then, we force the override of a => b but we make sure that the backup is
done.
So, we had a bug in the ordering of the actions.
we were first removing b. Therefore, losing the capability to do a backup of this.
2022-03-31 23:39:42 +02:00
Sylvestre Ledru
e553241750
ln: rustfmt the recent changes
2022-03-31 23:39:42 +02:00
Sylvestre Ledru
526370f922
ln: use the quote method instead of doing it by hand
2022-03-31 23:39:42 +02:00
Sylvestre Ledru
15ef76fcbf
ln: when we get a failed to link, show which files
2022-03-31 23:39:42 +02:00
Terts Diepraam
5a49813e07
Merge pull request #3341 from uutils/dependabot/cargo/blake2b_simd-1.0.0
...
build(deps): bump blake2b_simd from 0.5.11 to 1.0.0
2022-03-31 13:05:43 +02:00
Terts Diepraam
7203340917
Merge pull request #3237 from uutils/dependabot/cargo/ioctl-sys-0.8.0
...
build(deps): bump ioctl-sys from 0.6.0 to 0.8.0
2022-03-31 01:09:22 +02:00
dependabot[bot]
3e7d1a265a
build(deps): bump blake2b_simd from 0.5.11 to 1.0.0
...
Bumps [blake2b_simd](https://github.com/oconnor663/blake2_simd ) from 0.5.11 to 1.0.0.
- [Release notes](https://github.com/oconnor663/blake2_simd/releases )
- [Commits](https://github.com/oconnor663/blake2_simd/compare/0.5.11...1.0.0 )
---
updated-dependencies:
- dependency-name: blake2b_simd
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-30 22:40:52 +00:00
Sylvestre Ledru
050b5b0c9b
ln: make the tests/ln/hard-backup.sh test work
...
We haven't a great error message with hard link on the same file
+ Update the GNU error message to match ours
2022-03-30 20:00:11 +02:00
Daniel Hofstetter
b9ac38084c
df: rename two constants
...
OPT_HUMAN_READABLE -> OPT_HUMAN_READABLE_BINARY
OPT_HUMAN_READABLE_2 -> OPT_HUMAN_READABLE_DECIMAL
2022-03-30 16:47:08 +02:00
Sylvestre Ledru
1e6b248a77
Merge pull request #3304 from ackerleytng/main
...
wc: compute number widths using total file sizes
2022-03-30 09:52:21 +02:00
Pyokyeong Son
ea592e5c03
Merge branch 'main' into mkdir-fix
2022-03-30 12:30:27 +09:00
Sylvestre Ledru
05ec34eb94
Merge pull request #3322 from jfinkels/df-multiple-columns-error
...
df: error on duplicate columns in --output arg
2022-03-29 22:30:14 +02:00
Sylvestre Ledru
52b2d2ac1c
Merge pull request #3309 from cakebaker/fix_use_percentage_calculation
...
df: fix calculation of Use% column
2022-03-29 15:19:52 +02:00
Daniel Hofstetter
e152ebaead
df: fix calculation of Use% column
...
Change formula from: "Used/Size * 100" to "Used/(Used + Avail) * 100".
This formula also works if "Used" and "Avail" do not add up to "Size",
which is the case if there are reserved disk blocks.
2022-03-28 18:57:12 +02:00
DevSabb
36ec76e1fa
Merge branch 'uutils:main' into shuf-gnu-test
2022-03-28 12:56:38 -04:00
Ackerley Tng
e9131e2b7f
wc: compute number widths using total file sizes
...
Previously, individual file sizes were used to compute the number width, which
would cause misalignment when the total has a greater number of digits, and is
different from the behavior of GNU wc
```
$ ./target/debug/wc -w -l -m -c -L deny.toml GNUmakefile
95 422 3110 3110 85 deny.toml
349 865 6996 6996 196 GNUmakefile
444 1287 10106 10106 196 total
$ wc -w -l -m -c -L deny.toml GNUmakefile
95 422 3110 3110 85 deny.toml
349 865 6996 6996 196 GNUmakefile
444 1287 10106 10106 196 total
```
2022-03-28 18:56:34 +02:00
DevSabb
68b1f04f7d
fix more clippy warnings
2022-03-28 11:09:26 -04:00
DevSabb
16ad4bc069
fix clippy warning
2022-03-28 10:31:27 -04:00
DevSabb
f6cb42ee2d
shuf: accept multiple occurances of head-count argument
2022-03-28 10:17:07 -04:00
Daniel Hofstetter
a68d77b8cf
df: --output w/o "=" doesn't expect further args
...
"df --output ." was treated as "df --output=." and hence "." was
interpreted as a column name. With this commit, "." is treated as
an argument on its own.
Fixes #3324
2022-03-28 10:13:54 +02:00
Jeffrey Finkelstein
a1f300e8a7
df: allow multiple occurrences of --output arg
...
Allow multiple occurrences of the `--output` argument. For example,
$ df --output=source --output=target | head -n1
Filesystem Mounted on
2022-03-27 22:14:16 -04:00
Jeffrey Finkelstein
6f32a1921a
df: error on duplicate columns in --output arg
...
Print a usage error when duplicat column names are specified to the
`--output` command-line argument. For example,
$ df --output=source,source
df: option --output: field ‘source’ used more than once
Try 'df --help' for more information.
2022-03-27 22:02:55 -04:00
Sylvestre Ledru
d5d6bc3050
Merge pull request #3294 from jfinkels/df-file-column
...
df: implement the File column
2022-03-27 23:41:50 +02:00
Sylvestre Ledru
c932236826
Merge pull request #3317 from sylvestre/ls-quote
...
ls: Add proper quotes on symlink with --quoting-style=shell-escape
2022-03-27 19:22:18 +02:00
Jeffrey Finkelstein
ab717ce370
df: implement the File column
...
Implement the "File" column in the `df` output table. Before this
commit, a blank entry appeared in the "File" column for each
row. After this commit, a "-" entry appears when `df` is run with no
positional arguments and the filename appears when run with positional
arguments. For example:
$ touch a b c && df --output=target,file a b c
Mounted on File
/ a
/ b
/ c
2022-03-27 13:17:36 -04:00
Jeffrey Finkelstein
b34685f8a5
timeout: return 125 on invalid time interval args
...
Exit with status 125 (indicating an error in `timeout` itself) when
the timeout duration is invalid or the "kill after" duration is
invalid.
2022-03-27 11:45:51 +02:00
Sylvestre Ledru
c79d146dde
ls: add support for --quoting-style=shell-escape b --color=auto
2022-03-27 10:50:00 +02:00
Sylvestre Ledru
bbee22bb1c
ls: Add missing quote with --quoting-style=shell-escape
...
Should fix GNU: tests/ls/symlink-quote.sh
2022-03-27 10:50:00 +02:00
Jeffrey Finkelstein
c43ef8b704
timeout: support long form of --kill-after arg
...
Add support for the long form of the `--kill-after`
argument. Previously only the short form `-k` was supported.
2022-03-26 20:20:30 -04:00
Sylvestre Ledru
98376d8fd5
Merge pull request #3311 from uutils/mkdir2
...
mkdir: gnu compat: add support of mkdir -p foo/.
2022-03-27 00:15:05 +01:00
Sylvestre Ledru
fbb64b9c5c
mkdir: gnu compat: add support of mkdir -p foo/.
2022-03-25 21:35:27 +01:00
Jeffrey Finkelstein
f856bfc479
dd: move ConversionMode parsing to parseargs mod.
...
Move the code for parsing the `ConversionMode` to use up to the
`parseargs` module. This location makes more sense for it because the
conversion mode can be determined entirely from the command-line
arguments at the time of parsing just like the other parameters. Using
an enum for this purpose also eliminates the amount of code we need
later on.
2022-03-25 20:56:38 +01:00
Jeffrey Finkelstein
b98bccf9cc
dd: move ConversionMode parsing to dd.rs
...
Move parsing of the `ConversionMode` outside of
`conv_block_unblock_helper()` and up to the code that calls it.
2022-03-25 20:56:38 +01:00
Jeffrey Finkelstein
bd626df70e
dd: replace cascading if/else if with enum match
...
Replace a cascading `if/else if` chain in `conv_block_unblock_helper()`
with a match statement on a new enum, `ConversionMode`, that enumerates
the various modes in which `dd` can operate.
2022-03-25 20:56:38 +01:00
Pyokyeong Son
8108fb15b6
Merge branch 'uutils:main' into mkdir-fix
2022-03-25 23:03:29 +09:00
Sylvestre Ledru
fe648b2666
Merge pull request #3297 from jfinkels/timeout-invalid-signal
...
timeout: produce usage error on invalid signal
2022-03-23 21:05:34 +01:00
Kartik Sharma
6b85579498
Merge branch 'uutils:main' into stat-fails-to-read-a-file-redirected-to-stdin
2022-03-23 20:09:42 +05:30
Kartik Sharma
193899f09c
Modified code to replace all instances of -
...
Now all instances of `-` will be replaced with real / canonicalized
path of `/dev/stdin`
2022-03-23 20:05:20 +05:30
Sylvestre Ledru
33c49666c3
nproc: make tests/misc/nproc-override.sh pass by implementing OMP_NUM_THREADS=X,Y,Z ( #3296 )
...
+ nproc tests: use assert_eq when comparing the two values
Co-authored-by: jfinkels <jfinkels@users.noreply.github.com>
2022-03-23 12:12:54 +01:00
Jeffrey Finkelstein
760a15aa74
timeout: produce usage error on invalid signal
...
Produce a usage error on an invalid signal argument. For example,
$ timeout --signal=invalid 1 sleep 0
timeout: 'invalid': invalid signal
Try 'timeout --help' for more information.
2022-03-23 08:39:55 +01:00
Jeffrey Finkelstein
e357d2650c
clippy fixes from nightly rust
2022-03-22 21:44:33 -04:00
Terts Diepraam
fc1fa8d1f7
Merge pull request #3027 from shoriminimoe/2986-cp
...
cp: only allow directory for -t
2022-03-22 23:08:54 +01:00
Sylvestre Ledru
291b889d66
Merge pull request #3256 from chordtoll/iseek-oseek
...
dd: implement iseek + oseek flags
2022-03-22 20:31:05 +01:00
Sylvestre Ledru
8044981df0
Merge pull request #3289 from uutils/dependabot/cargo/ouroboros-0.15.0
...
build(deps): bump ouroboros from 0.14.2 to 0.15.0
2022-03-22 08:08:13 +01:00
Terts Diepraam
5eeac5881a
Merge pull request #3285 from sylvestre/ls_aA
...
ls: when -aA are provided, the order matters
2022-03-21 18:14:13 +01:00
Terts Diepraam
e9a6cf043f
Merge pull request #3286 from sylvestre/nproc-2
...
nproc: add the full support of OMP_THREAD_LIMIT
2022-03-21 18:11:41 +01:00
dependabot[bot]
2024cc37e6
build(deps): bump ouroboros from 0.14.2 to 0.15.0
...
Bumps [ouroboros](https://github.com/joshua-maros/ouroboros ) from 0.14.2 to 0.15.0.
- [Release notes](https://github.com/joshua-maros/ouroboros/releases )
- [Commits](https://github.com/joshua-maros/ouroboros/compare/0.14.2...0.15.0 )
---
updated-dependencies:
- dependency-name: ouroboros
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-21 16:50:55 +00:00
Sylvestre Ledru
7963287c6c
Merge pull request #3282 from uutils/dependabot/cargo/libc-0.2.121
...
build(deps): bump libc from 0.2.113 to 0.2.121
2022-03-21 17:49:11 +01:00
Sylvestre Ledru
4942e519fa
nproc: add the full support of OMP_THREAD_LIMIT
2022-03-21 13:46:22 +01:00
Sylvestre Ledru
187bddb6af
ls: support multiple -a or -A
2022-03-21 13:32:23 +01:00
Sylvestre Ledru
ce28aa8b8a
Merge pull request #3287 from cakebaker/missing_spaces
...
sort: add two missing spaces in help texts
2022-03-21 13:14:28 +01:00
Sylvestre Ledru
d3e2ad2d50
Merge pull request #3283 from jfinkels/timeout-usage-error
...
timeout: give usage error on invalid time interval
2022-03-21 09:27:58 +01:00
Sylvestre Ledru
3009c73e9c
ls -aA: Add a comment
2022-03-21 09:13:56 +01:00
Daniel Hofstetter
a1d6a8f17a
sort: add two missing spaces in help texts
2022-03-21 09:13:33 +01:00
Sylvestre Ledru
af8726af43
ls: when -aA are provided, the order matters
2022-03-20 23:23:17 +01:00
Jeffrey Finkelstein
c39c917db7
sleep: give usage error on invalid time interval
...
For example,
$ sleep xyz
sleep: invalid time interval 'xyz'
Try 'sleep --help' for more information.
This matches the behavior of GNU sleep.
2022-03-20 15:21:50 -04:00
Jeffrey Finkelstein
e849aaf846
timeout: give usage error on invalid time interval
2022-03-20 15:16:03 -04:00
dependabot[bot]
34d2d1d05e
build(deps): bump libc from 0.2.113 to 0.2.121
...
Bumps [libc](https://github.com/rust-lang/libc ) from 0.2.113 to 0.2.121.
- [Release notes](https://github.com/rust-lang/libc/releases )
- [Commits](https://github.com/rust-lang/libc/compare/0.2.113...0.2.121 )
---
updated-dependencies:
- dependency-name: libc
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-20 18:14:52 +00:00
dependabot[bot]
aea30bd4a7
build(deps): bump ioctl-sys from 0.6.0 to 0.8.0
...
Bumps [ioctl-sys](https://github.com/jmesmon/ioctl ) from 0.6.0 to 0.8.0.
- [Release notes](https://github.com/jmesmon/ioctl/releases )
- [Commits](https://github.com/jmesmon/ioctl/compare/ioctl-sys-0.6.0...ioctl-sys-0.8.0 )
---
updated-dependencies:
- dependency-name: ioctl-sys
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-20 16:46:37 +00:00
Sylvestre Ledru
04b219bdef
Merge pull request #3229 from uutils/dependabot/cargo/clap-3.1.6
...
build(deps): bump clap from 3.0.10 to 3.1.6
2022-03-20 17:44:33 +01:00
Jeffrey Finkelstein
b79ff6b4fd
split: avoid writing final empty chunk with -C
...
Fix a bug in which a final empty file was written when using `split
--line-bytes` mode.
2022-03-20 09:30:58 -04:00
Sam Caldwell
f40fecf86d
Add UError impl for clap::Error
2022-03-20 13:50:39 +01:00
Sam Caldwell
979909e371
cp: better error message for target-directory
2022-03-20 13:50:39 +01:00
Sam Caldwell
efd627bb20
cp: only allow directory for -t
2022-03-20 13:50:39 +01:00
Kartik Sharma
71a6ae1443
Added support to read a filename redirected to stdin
...
- Canonicalization of `/dev/stdin` which points to stdin file
2022-03-20 17:57:00 +05:30
Terts Diepraam
d90a81fb46
all utils: remove short help flag if another -h flag is present
2022-03-20 11:16:20 +01:00
Jeffrey Finkelstein
95f58fbf3c
split: handle no final newline with --line-bytes
...
Fix a panic due to out-of-bounds indexing when using `split
--line-bytes` with an input that had no trailing newline.
2022-03-19 23:50:02 -04:00
Terts Diepraam
32cadbc715
pinky: don't include short flag in help
2022-03-19 23:07:04 +01:00
Sylvestre Ledru
1d17400b80
Merge pull request #3274 from jfinkels/split-elide-empty-files
...
split: elide all chunks when input file is empty
2022-03-19 22:52:57 +01:00
Sylvestre Ledru
377da0ded4
Merge pull request #3270 from cakebaker/ticket_3251
...
df: omit reserved filesystem blocks in "Available"
2022-03-19 22:50:33 +01:00
Terts Diepraam
bec00546f1
Merge pull request #3263 from cakebaker/remove_direct_option
...
df: remove unused "--direct" option
2022-03-19 22:38:05 +01:00
Sylvestre Ledru
f4146da604
Merge pull request #3275 from jfinkels/split-handle-broken-pipe
...
split: catch and handle broken pipe errors
2022-03-19 21:53:11 +01:00
Jeffrey Finkelstein
0a226524a6
split: elide all chunks when input file is empty
...
Fix a bug in the behavior of `split -e -n NUM` when the input file is
empty. Previously, it would panic due to overflow when subtracting 1
from 0. After this change, it will terminate successfully and produce
no output chunks.
2022-03-19 14:32:28 -04:00
Jeffrey Finkelstein
6d2eff9c27
split: catch and handle broken pipe errors
...
Catch `BrokenPipe` errors and silently ignore them so that `split`
terminates successfully on a broken pipe. This matches the behavior of
GNU `split`.
2022-03-19 12:11:03 -04:00
Terts Diepraam
76edba0e1e
Merge branch 'unittests-in-ci' of github.com:tertsdiepraam/coreutils into unittests-in-ci
2022-03-19 10:58:59 +01:00
Terts Diepraam
094bb61a63
fxi tests for unittests in dd and hashsum
2022-03-19 10:58:45 +01:00
Sylvestre Ledru
3c88fb460b
Merge branch 'main' into dependabot/cargo/clap-3.1.6
2022-03-19 09:26:05 +01:00
Sylvestre Ledru
01da0171b5
Merge pull request #3272 from jfinkels/uucore-parse-time-overflow
...
uucore, sleep: use Duration::saturating_mul and saturating_add to avoid overflow
2022-03-19 09:24:03 +01:00
Jeffrey Finkelstein
ce2a026ff8
sleep: use Duration::saturating_add to sum times
...
Use `Duration::saturating_add()` to avoid a panic due to overflow when
adding the durations provided as command-line arguments.
2022-03-18 23:15:02 -04:00
Daniel Hofstetter
50c6599a32
df: omit reserved filesystem blocks in "Available"
...
fixes #3251
2022-03-18 20:45:15 +01:00
Daniel Hofstetter
ac8dcb6bd3
df: remove unused "--direct" option
2022-03-18 20:45:09 +01:00
chordtoll
a84202ee00
Combine 4 duplicate seek/skip parsing functions into one
2022-03-18 20:45:04 +01:00
chordtoll
b77b3cba55
dd: implement iseek + oseek flags
...
These are the first half of changes needed to pass the dd/bytes.sh tests:
- Add iseek and oseek options (additive with skip and seek options)
- Implement tests for the new flags, matching those from dd/bytes.sh
2022-03-18 20:45:04 +01:00
Benjamin Bouvier
65f94c9d39
Remove duplicate paste dependency
2022-03-18 20:44:01 +01:00
Sylvestre Ledru
9796e01df6
Revert "split: implement round-robin arg to --number"
2022-03-18 14:45:29 +01:00
Terts Diepraam
04de1251dd
Merge branch 'main' into dependabot/cargo/clap-3.1.6
2022-03-18 09:54:04 +01:00
Benjamin Bouvier
ba5b2dc2ed
Remove unused dependencies by individual crates ( #3264 )
2022-03-17 22:48:17 +01:00
Terts Diepraam
20212be4c8
fix clippy errors related to clap upgrade from 3.0.10 to 3.1.6
2022-03-17 22:46:56 +01:00
dependabot[bot]
59440d35c0
build(deps): bump clap from 3.0.10 to 3.1.6
...
Bumps [clap](https://github.com/clap-rs/clap ) from 3.0.10 to 3.1.6.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v3.0.10...v3.1.6 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 13:06:29 +00:00
Sylvestre Ledru
a5948ce11b
Merge pull request #3155 from jtracey/gecos-off-by-one
...
pinky: fix off-by-one in GECOS parsing
2022-03-17 13:35:05 +01:00
Sylvestre Ledru
7e05833b96
Merge pull request #3205 from jfinkels/split-round-robin
...
split: implement round-robin arg to --number
2022-03-16 12:35:00 +01:00
Sylvestre Ledru
161db4cdd7
Merge pull request #3259 from jfinkels/df-loops
...
df: separate functions for two main modes of df
2022-03-16 12:00:36 +01:00
Sylvestre Ledru
b84ff35766
Add canonicalized to the ignore spell list
2022-03-16 09:16:01 +01:00
Devin Gunay
b277aa235a
use powi instead of unnecessary powf
...
clippy::suboptimal_flops found a few unnecessary usages of powf (powi is faster)
2022-03-16 00:37:29 -07:00
Jeffrey Finkelstein
f4ca963dca
df: separate functions for two main modes of df
...
Split the code for getting a list of `Filesystem` objects into two
separate functions: one for getting the list of all filesystems (when
running `df` with no arguments) and one for getting only named
filesystems (when running `df` with one or more arguments). This does
not change the behavior of `df` only the organization of the code.
2022-03-15 22:06:55 -04:00
Jeffrey Finkelstein
6f3dcf5998
df: add Filesystem::from_path() function
...
Add the `Filesystem::from_path()` function which produces the
filesystem on which a given path is mounted. The `Filesystem` is taken
from a list of candidate `MountInfo` objects.
2022-03-15 21:56:39 -04:00
Jeffrey Finkelstein
6371eb8298
df: use for loop over filesystems to display rows
...
Replace a loop over `Row` objects with a loop over `Filesystem`
objects when it comes time to display each row of the output
table. This helps with code structure, since the `Filesystem` is the
primary object of interest in the `df` program. This makes it easier
for us to independently vary how the list of filesystems is produced
and how the list of filesystems is displayed.
2022-03-15 19:43:28 -04:00
Jeffrey Finkelstein
18bfd1ac68
split: implement round-robin arg to --number
...
Implement distributing lines of a file in a round-robin manner to a
specified number of chunks. For example,
$ (seq 1 10 | split -n r/3) && head -v xa[abc]
==> xaa <==
1
4
7
10
==> xab <==
2
5
8
==> xac <==
3
6
9
2022-03-15 18:22:44 -04:00
kimono-koans
fa6af85b8e
ls: Fix display of inodes and add allocation size feature ( #3052 )
2022-03-15 16:27:43 +01:00
Sylvestre Ledru
748d414946
Merge pull request #3258 from cakebaker/fix_exclude_type_panic
...
df: fix panic when using -x argument (#3257 )
2022-03-15 16:24:15 +01:00
Sylvestre Ledru
9dea9b4b83
Merge branch 'main' into mkdir-fix
2022-03-15 12:03:47 +01:00
Ryan Gonzalez
2dc3d867d8
cp: Avoid following a destination symlink with -P
...
Previously, given 'cp -P a b', where 'a' and 'b' were both symlinks, cp
would end up replacing the target of 'b'.
Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2022-03-14 17:49:42 -05:00
Daniel Hofstetter
433504949d
df: fix panic when using -x argument ( #3257 )
...
Also allow multiple '-x' options
2022-03-14 10:32:42 +01:00
Sylvestre Ledru
8f97283cf3
Merge pull request #3253 from jfinkels/df-filesystem-module-3
...
df: move Filesystem to filesystem.rs
2022-03-14 09:59:28 +01:00
Sylvestre Ledru
dd6d29f389
Merge pull request #3248 from sylvestre/nproc
...
nproc: Improve the GNU compat
2022-03-14 08:32:40 +01:00
Jeffrey Finkelstein
b81f4ef6a7
df: add documentation comments for filesystem.rs
2022-03-13 14:30:15 -04:00
Jeffrey Finkelstein
2fac674317
df: move Filesystem to filesystem.rs
...
Move the `Filesystem` struct into a new module `filesystem.rs`.
2022-03-13 14:30:14 -04:00
Sylvestre Ledru
24b4af768c
nproc: Improve the support of OMP_NUM_THREADS
2022-03-13 18:33:16 +01:00
Sylvestre Ledru
d6dad9f412
Merge pull request #3250 from jfinkels/df-remove-fs-selector
...
df: remove use of FsSelector abstraction
2022-03-13 18:17:49 +01:00
Jeffrey Finkelstein
81e2de498a
df: remove use of FsSelector abstraction
...
Remove the use of the `FsSelector` struct when deciding whether a
filesystem type should be included or excluded from the output
table. Instead, just maintain optional `Vec`s of filesystem types to
exclude and include, and check whether the filesystem type is
contained in one of those. This reduces the amount of code required to
implement these checks, and since the number of types given in the
`include` or `exclude` lists is likely to be small, there should not
be much of a difference in performance.
2022-03-12 20:52:40 -05:00
Jeffrey Finkelstein
1aa6fd1468
timeout: fix bug in --preserve-status mode
...
Fix a bug where `timeout --preserve-status` was not correctly
preserving the status code of the child process if it timed out. When
that happens, the status code of the child process is considered to be
the signal number (in this case, `SIGTERM`). The exit status of
`timeout` is then 128 plus the numeric code associated with `SIGTERM`.
2022-03-12 19:53:11 -05:00
Jeffrey Finkelstein
2d390233fe
timeout: add ExitStatus enumeration
...
Add the `ExitStatus` enumeration in a new module `status.rs` to
contain all the magic numbers in the `timeout` utility.
2022-03-12 19:53:11 -05:00
Sylvestre Ledru
2c6bbcf716
nproc: support --ignore=' 1' as GNU
2022-03-12 19:23:37 +01:00
Sylvestre Ledru
bfd1e14137
Merge pull request #3204 from jfinkels/split-line-bytes
...
split: implement --line-bytes option
2022-03-12 09:45:07 +01:00
OHNONOTAMOTH
094198b22a
Consistent tempfile crate declaration (version 3) ( #3244 )
2022-03-12 09:40:23 +01:00
Sylvestre Ledru
2c10ddf3f4
Merge pull request #3243 from jfinkels/timeout-restructure
...
timeout: refactor helper func for wait-then-signal
2022-03-12 09:38:05 +01:00
Jeffrey Finkelstein
9fae445ca9
df: fix tests of internal helper functions
...
Fix unit tests for the `is_included()` and `filter_mount_list()`
internal helper functions. The function signatures changed but the
tests did not get updated to match.
2022-03-11 22:52:17 -05:00
Jeffrey Finkelstein
a0eed2405c
timeout: refactor helper func for wait-then-signal
...
Factor a helper function `wait_or_kill_process()` out of the main
`timeout()` function. This helper function contains the code to wait
for a child process and send the `SIGKILL` signal if it does not
terminate within a specified amount of time. This does not change the
function of `timeout`, just the organization of the code.
2022-03-11 18:47:30 -05:00
Kartik Sharma
5c5f4ca6ad
df
: Adds support for mount path prefix matching and input path (#3161 )
...
* Adds support for mount path prefix matching and input path
canonicalization
- Sorts mount paths in reverse lexicographical order
- Canonicalize all paths and clear invalid paths
- Checking of mount path prefix matches input path
2022-03-11 09:36:34 +01:00
Sylvestre Ledru
1795272473
Merge pull request #3176 from jfinkels/df-output-columns-2
...
df: implement the --output command-line argument
2022-03-11 09:26:17 +01:00
Jeffrey Finkelstein
77d92883c7
split: implement --line-bytes option
...
Implement the `--line-bytes` option to `split`. In this mode, the
program tries to write as many lines of the input as possible to each
chunk of output without exceeding a specified byte limit. The new
`LineBytesChunkWriter` struct represents this functionality.
2022-03-10 22:51:49 -05:00
Jeffrey Finkelstein
ec048b3857
df: implement the --output command-line argument
...
Implement the `--output` command-line argument, which allows
specifying an exact sequence of columns to display in the output
table. For example,
$ df --output=source,fstype | head -n3
Filesystem Type
udev devtmpfs
tmpfs tmpfs
(The spacing does not exactly match the spacing of GNU `df` yet.)
Fixes #3057 .
2022-03-10 22:50:15 -05:00
Jeffrey Finkelstein
0b07ecdad2
df: use Options.columns field to control output
...
Replace the `Options.show_fs_type` and `Options.show_inode_instead`
fields with the more general `Options.columns`, a `Vec` of `Column`
variants representing the exact sequence of columns to display in the
output. This makes `Options` able to represent arbitrary output column
display configurations.
2022-03-10 22:50:15 -05:00
Jeffrey Finkelstein
b42168e9dc
Clippy fixes in multiple crates
2022-03-10 22:31:21 -05:00
Sylvestre Ledru
2e8945ba7f
Merge pull request #3221 from uutils/dependabot/cargo/unicode-segmentation-1.9.0
...
build(deps): bump unicode-segmentation from 1.8.0 to 1.9.0
2022-03-10 00:32:13 +01:00
dependabot[bot]
fc4f1d869e
build(deps): bump strum from 0.23.0 to 0.24.0
...
Bumps [strum](https://github.com/Peternator7/strum ) from 0.23.0 to 0.24.0.
- [Release notes](https://github.com/Peternator7/strum/releases )
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md )
- [Commits](https://github.com/Peternator7/strum/commits )
---
updated-dependencies:
- dependency-name: strum
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-09 19:45:40 +01:00
dependabot[bot]
b4ee7f84fa
build(deps): bump unicode-segmentation from 1.8.0 to 1.9.0
...
Bumps [unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation ) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/unicode-rs/unicode-segmentation/releases )
- [Commits](https://github.com/unicode-rs/unicode-segmentation/commits )
---
updated-dependencies:
- dependency-name: unicode-segmentation
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-09 19:45:35 +01:00
Daniel Hofstetter
3317fb9924
df: always round up usage percentage ( #3208 )
2022-03-08 15:13:05 +01:00
Justin Tracey
644c99ed2e
pinky: simplify and debug printing files
2022-03-07 12:32:07 -05:00
Justin Tracey
9430a9f355
pinky: fix off-by-one in GECOS parsing
2022-03-07 12:32:07 -05:00
Sylvestre Ledru
37a0a74c19
Merge pull request #3033 from water-ghosts/cp-lb
...
cp: Create backup before hardlink
2022-03-07 08:18:36 +01:00
Sylvestre Ledru
76cb746aca
Merge pull request #3191 from jfinkels/df-block-size-heading
...
df: fix block size header for multiples of 1024
2022-03-07 08:09:03 +01:00
Sylvestre Ledru
858a38c815
Merge pull request #3222 from uutils/dependabot/cargo/once_cell-1.10.0
...
build(deps): bump once_cell from 1.9.0 to 1.10.0
2022-03-07 07:04:15 +01:00
dependabot[bot]
1c469ec6c5
build(deps): bump ouroboros from 0.10.1 to 0.14.2
...
Bumps [ouroboros](https://github.com/joshua-maros/ouroboros ) from 0.10.1 to 0.14.2.
- [Release notes](https://github.com/joshua-maros/ouroboros/releases )
- [Commits](https://github.com/joshua-maros/ouroboros/commits/0.14.2 )
---
updated-dependencies:
- dependency-name: ouroboros
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-06 22:36:00 +00:00
dependabot[bot]
2e50eade7f
build(deps): bump once_cell from 1.9.0 to 1.10.0
...
Bumps [once_cell](https://github.com/matklad/once_cell ) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/matklad/once_cell/releases )
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md )
- [Commits](https://github.com/matklad/once_cell/compare/v1.9.0...v1.10.0 )
---
updated-dependencies:
- dependency-name: once_cell
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-06 22:35:33 +00:00
Sylvestre Ledru
9113594951
Merge pull request #3206 from 353fc443/timeout-empty-string
...
timeout: avoid panicking for empty string
2022-03-06 23:02:46 +01:00
Sylvestre Ledru
b9953eb883
Merge pull request #3122 from xxyzz/chmod
...
chmod: replace walkdir with std::fs
2022-03-06 23:01:50 +01:00
Devin Gunay
103dffc12e
touch: implement -
( #3158 )
2022-03-06 23:00:42 +01:00
Sylvestre Ledru
54a10e955a
Update of the cargo.lock url to point to the right branch
2022-03-06 22:13:17 +01:00
353fc443 aka Seagull
8ccc45c68c
mkdir: recursive reporting of created directories in verbose mode ( #3217 )
2022-03-06 21:36:08 +01:00
xxyzz
ce385be575
chmod: ignore symbolic links during recursive directory traversal
2022-03-06 09:38:39 +08:00
xxyzz
281ec190e0
chmod: replace walkdir with std::fs
...
walkdir filters some files that need to be modified, for example, files inside an unreadable folder.
2022-03-06 08:40:36 +08:00
Davide Cavalca
19af43222b
Include license text in all published crates
2022-03-05 21:21:46 +01:00
Jeffrey Finkelstein
5cf7139467
df: fix block size header for multiples of 1024
...
Correct the column header printed by `df` when the `--block-size`
argument has a value that is a multiple of 1024. After this commit,
the header looks like "1K" or "4M" or "117G", etc., depending on the
particular value of the block size. For example:
$ df --block-size=1024 | head -n1
Filesystem 1K-blocks Used Available Use% Mounted on
$ df --block-size=2048 | head -n1
Filesystem 2K-blocks Used Available Use% Mounted on
$ df --block-size=3072 | head -n1
Filesystem 3K-blocks Used Available Use% Mounted on
$ df --block-size=4096 | head -n1
Filesystem 4K-blocks Used Available Use% Mounted on
2022-03-05 11:47:45 -05:00
Jeffrey Finkelstein
14e3f50651
df: move BlockSize to a new module, blocks.rs
2022-03-05 11:36:16 -05:00
353fc443
6951e18c41
timeout: avoid panicking for empty string
2022-03-05 14:36:24 +01:00
Sylvestre Ledru
430a6650e0
Merge branch 'main' into cp-lb
2022-03-05 10:33:43 +01:00
Jeffrey Finkelstein
d0ebd1c9d0
df: add support for --total option
...
Add support for the `--total` option to `df`, which displays the total
of each numeric column. For example,
$ df --total
Filesystem 1K-blocks Used Available Use% Mounted on
udev 3858016 0 3858016 0% /dev
...
/dev/loop14 63488 63488 0 100% /snap/core20/1361
total 258775268 98099712 148220200 40% -
2022-03-05 10:29:46 +01:00
Jeffrey Finkelstein
41acdb5471
df: borrow Row in DisplayRow::new()
...
Change the signature of `DisplayRow::new()` to borrow `Row` instead of
consuming it, so that the `Row` can be used after it is displayed.
2022-03-05 10:29:46 +01:00
Jeffrey Finkelstein
3fb36d02e3
df: add unit tests for internal helper functions
...
Add unit tests in the `df.rs` file for internal helper functions
`mount_info_lt()`, `is_best()`, `is_included()`, and
`filter_mount_list()`.
2022-03-05 10:28:37 +01:00
Jeffrey Finkelstein
ee36dea1a9
split: implement outputting kth chunk of file
...
Implement `-n l/k/N` option, where the `k`th chunk of the input file
is written to stdout. For example,
$ seq -w 0 99 > f; split -n l/3/10 f
20
21
22
23
24
25
26
27
28
29
2022-03-05 10:27:51 +01:00
Terts Diepraam
bb379b5384
pr: fix heuristic for number-lines argument ( #3109 )
2022-03-05 10:26:12 +01:00
Terts Diepraam
75b3cbcfd9
pr: move from getopts to clap
...
fixes
2022-03-05 10:26:12 +01:00
Sylvestre Ledru
25f0423399
Merge branch 'main' into mkdir-fix
2022-03-04 20:38:06 +01:00
Sylvestre Ledru
63cf0d20b4
Merge branch 'main' into cp-lb
2022-03-03 23:02:57 +01:00
Eli Youngs
eace4bc907
cp: Support copying FIFOs with -r ( #3032 )
2022-03-03 22:58:27 +01:00
Terts Diepraam
618a268f61
Merge pull request #3081 from HeroicKatora/main
...
Discuss seq parsing
2022-03-03 22:50:32 +01:00
Sylvestre Ledru
66e9956595
Merge pull request #3156 from jfinkels/dd-cbs-blocks
...
dd: pad partial record with spaces in some cases
2022-03-03 22:35:58 +01:00
Sylvestre Ledru
1c023c6523
Merge pull request #3202 from cakebaker/patch-1
...
cp: fix typo in help text
2022-03-01 10:14:06 +01:00
Sylvestre Ledru
346cfa060b
Merge pull request #2980 from jfinkels/split-lines-2
...
split: add support for "-n l/NUM" option to split
2022-03-01 10:13:44 +01:00
Daniel Hofstetter
5cce2b0d9a
cp: fix typo in help text
2022-02-28 15:16:47 +01:00
Sylvestre Ledru
bbef777c8c
Merge pull request #2998 from tertsdiepraam/cp-override-args
...
`cp`: override args instead of having them conflict
2022-02-28 14:47:53 +01:00
Jeffrey Finkelstein
7273d1f100
df: use safe wrapper function for statfs() func.
...
Replace unsafe code with a safe version of the `statfs()` function
provided by `uucore`.
2022-02-27 17:33:01 -05:00
Sylvestre Ledru
3b48d1273a
Merge pull request #3187 from ndd7xv/install-error-msg
...
install: better error messages when handling invalid arguments
2022-02-26 18:57:17 +01:00
Terts Diepraam
9aca050e4a
cp: override args
...
These arguments should not have been in conflict with each other, but silently override each other.
2022-02-26 10:37:58 +01:00
DevSabb
b8a3795d95
tr: fix octal interpretation of repeat count string ( #3178 )
...
* tr: fix octal interpretation of repeat count string
* tr: fix formatting errors
* tr: fix formatting issues 2
* tr: attempt to bypass spell check error
* tr: fix spell check errors attempt 2
* tr: formatting fixes
Co-authored-by: DevSabb <devsabb@local>
2022-02-25 12:11:53 +01:00
ndd7xv
172be3a8c6
install: better error messages when invalid arguments
...
executing `install` or `install file` no longer panics and insteads returns errors similar to GNU's install when it encounters similar args
2022-02-24 17:58:32 -05:00
Jeffrey Finkelstein
9f71b7ac7f
df: correct links in BlockSize documentation
2022-02-23 21:08:35 -05:00
Sylvestre Ledru
d3ca49128d
Merge pull request #3179 from omertuc/test_u64
...
Improve coverage / error messages from `parse_size` PR
2022-02-23 18:27:14 +01:00
Jeffrey Finkelstein
fc8e9f20ea
df: correctly scale bytes by block size
...
Change `df` so that it correctly scales numbers of bytes by the
default block size, 1024, when neither -h nor -H are specified on the
command-line. Previously, it was not scaling the number of bytes in
this case.
Fixes #3058 .
2022-02-22 22:51:26 -05:00
Jeffrey Finkelstein
dbbee573ab
split: add support for "-n l/NUM" option to split
...
Add support for `split -n l/NUM`. Previously, `split` only supported
`-n NUM`, which splits a file into `NUM` chunks by byte. The `-n
l/NUM` strategy splits a file into `NUM` chunks without splitting
lines across chunks.
2022-02-22 18:44:08 -05:00
Jeffrey Finkelstein
92d461247e
split: extend Strategy::Number to add NumberType
...
Make the `Strategy::Number` enumeration value more general by
replacing the number parameter with a `NumberType` enum parameter.
This allows a future commit to update `split` to support the various
sub-strategies for the `-n`. (This commit does not add support for the
other sub-strategies.)
2022-02-22 18:41:29 -05:00
Omer Tuchfeld
0ce22f3a08
Improve coverage / error messages from parse_size
PR
...
https://github.com/uutils/coreutils/pull/3084 (2a333ab391
) had some
missing coverage and was merged before I had a chance to fix it.
This PR adds some coverage / improved error messages that were missing
from that previous PR.
2022-02-22 22:09:45 +01:00
Sylvestre Ledru
2a333ab391
Merge pull request #3084 from omertuc/u64
...
Fix `parse_size` to use u64 rather than usize for better 32-bit support
2022-02-22 20:47:38 +01:00
Omer Tuchfeld
e9adf979d9
Fix type-error when calling parse_size
from stdbuf
2022-02-22 13:49:20 +01:00
Omer Tuchfeld
468ff8f0b9
Fix type-error when calling parse_size
from od
2022-02-22 13:49:20 +01:00
Gilad Naaman
6856c5dba5
Fix type-error when calling parse_size
from truncate
2022-02-22 13:49:20 +01:00
Gilad Naaman
159a1dc1db
Fix type-error when calling parse_size
from split
2022-02-22 13:49:20 +01:00
Gilad Naaman
8535cd41e0
Fix type-error when calling parse_size
from sort
2022-02-22 13:49:20 +01:00
Omer Tuchfeld
5d861df961
Fix type-error when calling parse_size
from tail
2022-02-22 13:49:20 +01:00
Omer Tuchfeld
8d8e25880e
Fix type-error when calling parse_size
from head
2022-02-22 13:49:20 +01:00
Omer Tuchfeld
0fe6017006
Fix type-error when calling parse_size
from du
2022-02-22 13:49:20 +01:00
Omer Tuchfeld
88dfb8d374
Fix type-error when calling parse_size
from dd
2022-02-22 13:49:15 +01:00
Alex Tibbles
163472ff7b
hashsum: pass spell checker
2022-02-21 20:43:42 -05:00
Alex Tibbles
3a0f292510
hashsum: refactor macro name
2022-02-21 17:04:57 -05:00
Alex Tibbles
afd5fea3c8
hashsum: refactor MD5 to use macro
2022-02-21 17:00:34 -05:00
Alex Tibbles
b1c543b4d2
hashsum: re-factor SHA1 implementation into common macro
2022-02-21 16:58:20 -05:00
Alex Tibbles
00d3c36e8c
update SHA1, SHA2, SHA3 crates
2022-02-21 16:55:59 -05:00
Alex Tibbles
41e9719d6b
upgrade to RustCrypto Hashes MD5 "MD-5" 0.10.1
2022-02-21 16:51:00 -05:00
Alex Tibbles
c8346fd720
hashsum: update hex to 0.4.3
...
Update to API change.
2022-02-21 15:35:46 -05:00
Sylvestre Ledru
6c7decc42b
Merge pull request #3172 from alextibbles/update-strum
...
uniq: update strum to 0.23 latest
2022-02-21 19:28:55 +01:00
Sylvestre Ledru
775588fb18
Merge pull request #3127 from xxyzz/df
...
df: some option changes
2022-02-21 19:08:56 +01:00
Jeffrey Finkelstein
9f367b72e6
dd: pad partial record with spaces in some cases
...
If `conv=block,sync` command-line arguments are given and there is at
least one partial record read from the input (for example, if the
length of the input is not divisible by the value of the `ibs`
argument), then output an extra block of `cbs` spaces.
For example, no extra spaces are printed in this example because the
input is of length 10, a multiple of `ibs`:
$ printf "012\nabcde\n" \
> | dd ibs=5 cbs=5 conv=block,sync status=noxfer \
> && echo $
012 abcde$
2+0 records in
0+1 records out
But in this example, 5 extra spaces are printed because the length of
the input is not a multiple of `ibs`:
$ printf "012\nabcdefg\n" \
> | dd ibs=5 cbs=5 conv=block,sync status=noxfer \
> && echo $
012 abcde $
2+1 records in
0+1 records out
1 truncated record
The number of spaces printed is the size of the conversion block,
given by `cbs`.
2022-02-21 13:00:11 -05:00
Alex Tibbles
0d5dd27e71
uniq: update strum to 0.23 latest
2022-02-21 12:34:25 -05:00
Terts Diepraam
53070141c1
all: add format_usage function ( #3139 )
...
This should correct the usage strings in both the `--help` and user documentation. Previously, sometimes the name of the utils did not show up correctly.
2022-02-21 17:14:03 +01:00
alextibbles
cd450cc591
expr: update onig crate to 6.3 ( #3136 )
...
* expr: update onig crate to 6.3
2022-02-21 17:13:27 +01:00
Sylvestre Ledru
419abec4e5
Merge pull request #3148 from jfinkels/dd-of-dev-null
...
dd: don't error when outfile is /dev/null
2022-02-21 17:10:42 +01:00
Jeffrey Finkelstein
1076fbd492
dd: move block-related functions into new module
...
Create a new module `blocks.rs` to contain the block-related helper
functions. This commit only moves the location of the code and related
tests, it does not change the functionality of `dd`.
2022-02-20 22:16:54 -05:00
Terts Diepraam
938c5acbbe
Merge pull request #3146 from ndd7xv/split-suffix-check
...
split: error when num. of chunks is greater than num. of possible filenames
2022-02-20 17:12:05 +01:00
Sylvestre Ledru
73051809a7
Merge pull request #3018 from Narasimha1997/fix-cp-recursion
...
Fix: Avoid infinite recursion when source and destinations are same while using `cp -R`
2022-02-20 10:34:34 +01:00
Sylvestre Ledru
42eba6c5b2
Merge pull request #3107 from jfinkels/split-elide-empty-files
...
split: add support for -e argument
2022-02-20 10:32:57 +01:00
Sylvestre Ledru
6bf575ad56
Merge branch 'main' into cp-lb
2022-02-20 10:31:13 +01:00
Jeffrey Finkelstein
b09bae2acf
dd: collect progress reporting into its own module
...
Collect structs, implementations, and functions that have to do with
reporting number of blocks read and written into their own new module,
`progress.rs`. This commit also adds docstrings for everything and
unit tests for the significant methods. This commit does not change
the behavior of `dd`, just the organization of the code to make it
more maintainable and testable.
2022-02-19 10:39:40 -05:00
Jeffrey Finkelstein
6900638ac6
dd: don't error when outfile is /dev/null
...
Prevent `dd` from terminating with an error when given the
command-line argument `of=/dev/null`. This commit allows the call to
`File::set_len()` to result in an error without causing the process to
terminate prematurely.
2022-02-19 10:29:09 -05:00
Terts Diepraam
1a7e5c4cc5
Merge pull request #3154 from jfinkels/dd-truncated-records
...
dd: correct order and phrasing of truncated record
2022-02-19 15:58:12 +01:00
Kartik Sharma
c523aa43f2
Fixes missing help on expr
user docs.
...
- Configured clap to take crate version, so version is now visible in docs.
- Added ABOUT string from expr help output, so about section is getting rendered in docs.
- Added USAGE section.
- Added HELP section for each args.
2022-02-19 13:47:16 +05:30
Jeffrey Finkelstein
766c85fb5e
dd: correct order and phrasing of truncated record
...
Place the "truncated records" line below the "records out" line in the
status report produced by `dd` and properly handle the singularization
of the word "record" in the case of 1 truncated record. This matches
the behavior of GNU `dd`.
For example
$ printf "ab" | dd cbs=1 conv=block status=noxfer > /dev/null
0+1 records in
0+1 records out
1 truncated record
$ printf "ab\ncd\n" | dd cbs=1 conv=block status=noxfer > /dev/null
0+1 records in
0+1 records out
2 truncated records
2022-02-18 23:49:33 -05:00
Terts Diepraam
4719717e33
Merge pull request #3128 from jfinkels/dd-zero-multiplier-regression
...
dd: remove spurious zero multiplier warning
2022-02-19 01:37:33 +01:00
Terts Diepraam
625c771d14
Merge pull request #3112 from ndd7xv/err_conv-to-result
...
uucore(memo): replace err_conv with result
2022-02-19 01:29:07 +01:00
Pyokyeong Son
b8c0a87f85
mkdir: fixed permissions behavior with umask
...
- umask application more closely resembles gnu
2022-02-18 07:52:38 +00:00
Pyokyeong Son
6db5bf1652
Merge branch 'uutils:main' into mkdir-fix
2022-02-18 14:04:16 +09:00
ndd7xv
1e12c46c24
uucore(memo): replace err_conv with result
2022-02-17 22:43:30 -05:00
Hanif Ariffin
8acdfdc553
Merge branch 'main' of github.com:uutils/coreutils into hbina-ls-propagate-write-errors
...
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-18 09:48:20 +08:00
Jeffrey Finkelstein
89f428b44f
dd: remove spurious zero multiplier warning
...
Fix a bug in which `dd` was inappropriately showing a warning about a
"0x" multiplier when there was no "x" character in the argument.
2022-02-17 19:06:05 -05:00
Jeffrey Finkelstein
6718d97f97
split: add support for -e argument
...
Add the `-e` flag, which indicates whether to elide (that is, remove)
empty files that would have been created by the `-n` option.
The `-n` command-line argument gives a specific number of chunks into
which the input files will be split. If the number of chunks is
greater than the number of bytes, then empty files will be created for
the excess chunks. But if `-e` is given, then empty files will not be
created.
For example, contrast
$ printf 'a\n' > f && split -e -n 3 f && cat xaa xab xac
a
cat: xac: No such file or directory
with
$ printf 'a\n' > f && split -n 3 f && cat xaa xab xac
a
2022-02-17 19:03:51 -05:00
Terts Diepraam
87dc692889
Merge branch 'main' into split-suffix-check
2022-02-17 23:23:58 +01:00
Terts Diepraam
e1a611374a
Merge pull request #2981 from jfinkels/split-hex-numbers
...
split: add support for -x option (hex suffixes)
2022-02-17 23:20:58 +01:00
Terts Diepraam
b082b98b7c
Merge pull request #3056 from palaster/fix-issue-2870
...
seq: Eliminated special handling of -0.0
2022-02-17 23:18:54 +01:00
Sylvestre Ledru
8e79b7fcb8
Merge pull request #3141 from jfinkels/dd-modules
...
dd: move unit tests into dd.rs and test_dd.rs
2022-02-17 10:15:07 +01:00
Pyokyeong Son
65a45ae5e1
Merge branch 'main' of github.com:pyoky/coreutils
2022-02-17 08:22:27 +00:00
Pyokyeong Son
ea175ce252
mkdir: permissions respects umask
...
- hardcoded default permissions changed to ones defined by umask
2022-02-17 07:37:55 +00:00
ndd7xv
494d709e0f
split: small tweaks to wording
...
changes `SuffixType` enums to have better names and hex suffix help to be consistent with numeric suffix help
2022-02-17 01:04:26 -05:00
xxyzz
c16c06ea0d
df: add output option's valid field names
2022-02-17 13:43:59 +08:00
ndd7xv
6c3fc7b214
split: throw error when # chunks > # filenames from suffix length
2022-02-16 23:53:56 -05:00
Jeffrey Finkelstein
4470430c89
split: add support for -x option (hex suffixes)
...
Add support for the `-x` command-line option to `split`. This option
causes `split` to produce filenames with hexadecimal suffixes instead
of the default alphabetic suffixes.
2022-02-16 23:53:56 -05:00
Jeffrey Finkelstein
891c5d1ffa
split: add SuffixType::NumericHexadecimal
...
Add a `NumericHexadecimal` member to the `SuffixType` enum so that a
future commit can add support for hexadecimal filename suffixes to the
`split` program.
2022-02-16 23:53:56 -05:00
Jeffrey Finkelstein
aa4c5aea50
split: refactor to add SuffixType enum
...
Refactor the code to use a `SuffixType` enumeration with two members,
`Alphabetic` and `NumericDecimal`, representing the two currently
supported ways of producing filename suffixes. This prepares the code
to more easily support other formats, like numeric hexadecimal.
2022-02-16 23:53:56 -05:00
Terts Diepraam
9e847c33e3
Merge pull request #3021 from iovanom/dd-multi-status-options
...
dd: allow multiple instances of arguments
2022-02-16 12:56:30 +01:00
Jeffrey Finkelstein
ba1ce7179b
dd: move unit tests into dd.rs and test_dd.rs
...
Clean up unit tests in the `dd` crate to make them easier to
manage. This commit does a few things.
* move test cases that test the complete functionality of the `dd`
program from the `dd_unit_tests` module up to the
`tests/by-util/test_dd.rs` module so that they can take advantage of
the testing framework and common testing tools provided by uutils,
* move test cases that test internal functions of the `dd`
implementation into the `tests` module within `dd.rs` so that they
live closer to the code they are testing,
* replace test cases defined by macros with test cases defined by
plain old functions to make the test cases easier to read at a
glance.
2022-02-15 21:50:48 -05:00
Michael Lohmann
3bbfe00791
cat: write_nonprint_to_end: be more explicit about printing '?'
2022-02-15 22:27:46 +01:00
Michael Lohmann
4676924532
cat: cat_path does not need to parse InputType for stdin itself
...
This type is already handled by get_input_type, so we can unify the handling
2022-02-15 22:27:46 +01:00
Michael Lohmann
34b18351e2
cat: cleanup write_tab_to_end duplication of logic
...
The logic for '\n' and '\r' about the number of written characters was duplicated
2022-02-15 22:16:02 +01:00
Sylvestre Ledru
65467ab317
Merge pull request #3137 from tertsdiepraam/docs-multiline-usage
...
docs: allow for multiline usage
2022-02-15 10:26:47 +01:00
DevSabb
6d6371741a
include io-blksize parameter ( #3064 )
...
* include io-blksize parameter
* format changes for including io-blksize
Co-authored-by: DevSabb <devsabb@local>
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2022-02-14 19:47:18 +01:00
xxyzz
c849b8722f
df: --output
option conflicts with -i
, -P
, -T
2022-02-14 09:10:54 +08:00
xxyzz
e77c8ff381
df: -t
may appear more than once and doesn't support delimiter
2022-02-14 09:09:35 +08:00
Terts Diepraam
477b40f1e5
shuf: correct execution phrase for --help
2022-02-13 21:58:48 +01:00
Kartik Sharma
6c1a655512
This commit removes empty line from USAGE string in src/uu/od/src/od.rs. ( #3074 )
...
This change is needed to fix missing USAGE section for `od` in user docs.
With reference to this issue
https://github.com/uutils/coreutils/issues/2991 , and missing USAGE
section from `od docs` at
https://uutils.github.io/coreutils-docs/user/utils/od.html , it was
found that the USAGE for od app was starts with an empty line and uudoc
only takes 1st line for using in USAGE section in docs.
This resulted in empty line in usage section for `od`
2022-02-13 21:39:11 +01:00
Terts Diepraam
351a56d3fd
Merge pull request #3133 from sylvestre/issue-3132
...
expr: Use chars().count() as we can have some multibytes chars
2022-02-13 17:48:37 +01:00
Jeffrey Finkelstein
a4955b4e06
split: add support for -x option (hex suffixes)
...
Add support for the `-x` command-line option to `split`. This option
causes `split` to produce filenames with hexadecimal suffixes instead
of the default alphabetic suffixes.
2022-02-13 11:18:37 -05:00
Jeffrey Finkelstein
494dc7ec57
split: add SuffixType::NumericHexadecimal
...
Add a `NumericHexadecimal` member to the `SuffixType` enum so that a
future commit can add support for hexadecimal filename suffixes to the
`split` program.
2022-02-13 11:18:37 -05:00
Jeffrey Finkelstein
7fbd805713
split: refactor to add SuffixType enum
...
Refactor the code to use a `SuffixType` enumeration with two members,
`Alphabetic` and `NumericDecimal`, representing the two currently
supported ways of producing filename suffixes. This prepares the code
to more easily support other formats, like numeric hexadecimal.
2022-02-13 11:18:37 -05:00
Sylvestre Ledru
7225fb6c24
expr: Use chars().count() as we can have some multibytes chars
...
Partially fixes #3132
Fixes one of the test of tests/misc/expr-multibyte
2022-02-13 14:19:25 +01:00
Terts Diepraam
85c4fb3981
Merge pull request #3129 from jfinkels/dd-partial-records
...
dd: correctly account for partial record written
2022-02-13 12:52:09 +01:00
Jeffrey Finkelstein
3ada6af19d
dd: correctly account for partial record written
...
Correct the accounting for partial records written by `dd` to the
output file. After this commit, if fewer than `obs` bytes are written,
then that is counted as a partial record. For example,
$ printf 'abc' | dd bs=2 status=noxfer > /dev/null
1+1 records in
1+1 records out
That is, one complete record and one partial record are read from the
input, one complete record and one partial record are written to the
output. Previously, `dd` reported two complete records and zero
partial records written to the output in this case.
2022-02-12 22:38:25 -05:00
Jeffrey Finkelstein
b6d1aa3e73
df: always produce the same order in output table
...
Change the `filter_mount_list()` function so that it always produces
the same order of `MountInfo` objects. This change ultimately results
in `df` printing its table of filesystems in the same order on each
execution. Previously, the table was in an arbitrary order because the
`MountInfo` objects were read from a `HashMap`.
Fixes #3086 .
2022-02-12 21:14:14 -05:00
Jeffrey Finkelstein
042e537ca8
df: refactor is_included(), mount_info_lt() funcs
...
Factor two helper functions, `is_included()` and `mount_info_lt()`,
from the `filter_mount_list()` function.
2022-02-12 21:06:37 -05:00
Jeffrey Finkelstein
b13718e742
head: use Self instead of enum name Mode in method
2022-02-12 14:45:45 -05:00
Sylvestre Ledru
f9e04ae5ef
Merge pull request #2966 from allan-silva/wc-files0-from-opt
...
wc: implement files0-from option
2022-02-12 19:05:05 +01:00
Sylvestre Ledru
0ed5e2c884
Merge pull request #2957 from jfinkels/head-preserve-no-final-newline
...
head: don't add trailing newline to end of file that didn't originally have one
2022-02-12 19:03:13 +01:00
Sylvestre Ledru
0f17ef2028
Merge pull request #2906 from jfinkels/head-better-mode
...
head: incorporate "all but last" option into Mode
2022-02-12 19:01:49 +01:00
Sylvestre Ledru
142c24e579
Merge pull request #2982 from Dr-Emann/paste_cleanup
...
paste: Fixes and cleanup
2022-02-12 19:00:39 +01:00
Sylvestre Ledru
c67a64c9df
Merge pull request #3121 from serhansekman/pr-help-page
...
pr: add missing about and version to documentation
2022-02-12 18:13:31 +01:00
alextibbles
d9c2acc2ed
update to sha 0.10.0 ( #3110 )
...
* update to sha 0.10.0
* correct formatting
2022-02-12 18:12:02 +01:00
Hanif Ariffin
45a1b7e4bb
ls: refactor out padding calculations ( #3072 )
...
* Refactor padding calculations into a function
* Propagate all write and (most) flush errors
2022-02-12 11:39:17 +01:00
Sylvestre Ledru
c2e3f4109c
Merge pull request #2944 from jfinkels/truncate-fifo
...
truncate: error when trying to truncate a fifo
2022-02-12 11:36:17 +01:00
Sylvestre Ledru
52282740dd
Merge pull request #3078 from ndd7xv/dd-progress-fix
...
dd: make status=progress rewrite once/sec
2022-02-12 11:34:21 +01:00
Sylvestre Ledru
090fb07361
Merge pull request #3066 from jfinkels/dd-skip-beyond-file
...
dd: show warning if skipping past end of input
2022-02-12 11:34:06 +01:00
Sylvestre Ledru
6b6d5ee7db
Merge pull request #2827 from jfinkels/split-std-io-copy
...
split: use std::io::copy() with new writer implementation to improve maintainability and speed
2022-02-12 11:33:12 +01:00
Sylvestre Ledru
e76818bb19
Merge pull request #3083 from jfinkels/df-table-module
...
df: refactor data table into Row, Header structs
2022-02-12 11:30:28 +01:00
Sylvestre Ledru
463e160d2f
Merge pull request #3117 from jfinkels/touch-no-deref-no-file
...
touch: show error on -h with nonexistent file
2022-02-12 11:27:46 +01:00
Tevfik Serhan Sekman
ad1954bd16
pr: add missing about and version to documentation
2022-02-12 12:36:28 +03:00
Pat Laster
aacff13ec3
seq: Eliminated special handling of -0.0
2022-02-11 23:02:57 -06:00
Jeffrey Finkelstein
f37e78c25a
touch: show error on -h with nonexistent file
...
Show an error message when running `touch -h` on a nonexistent file.
2022-02-11 20:58:16 -05:00
Sylvestre Ledru
080cb2b6f9
Merge pull request #3108 from DestroyerXyz/blake3
...
hashsum: Add BLAKE3 to Hashing Algorithms
2022-02-11 11:40:10 +01:00
Jeffrey Finkelstein
2f65b29866
split: error when --additional-suffix contains /
...
Make `split` terminate with a usage error when the
`--additional-suffix` argument contains a directory separator
character.
2022-02-10 19:33:33 -05:00
Sylvestre Ledru
e818fd2b98
Merge pull request #3092 from jtracey/join-performance
...
join: improve performance
2022-02-10 22:39:12 +01:00
Abhishek C Sharma
3f6fe7f388
ls: add new optional arguments to --classify flag ( #3041 )
...
* ls: add new optional arguments to --classify flag
The --classify flag in ls now takes an option when argument
that may have the values always, auto and none.
Modified clap argument to allow an optional parameter and
changed the classify flag value parsing logic to account for
this change.
* ls: add test for indicator-style, ind and classify with value none
* ls: require option paramter to --classify to use a = to specify flag value
* ls: account for all the undocumented possible values for the --classify flag
Added the other values for the --classify flag along with modifications to tests.
Also documented the inconsistency between GNU coreutils because we accept the
flag value even for the short version of the flag.
2022-02-10 21:35:20 +01:00
Ivan Majeru
c3b4d898ee
dd: allow multiple occurences for iflag, oflag and conv
...
The iflag, oflag and conv cli arguments take a list of values
and the correct behavior is to collect all values from multiple
occurences of theme.
For example if we call `dd --iflag=directory --iflag=skip_bytes` this should
collect the two values, `directory` and `skip_bytes` for iflag.
The unittest was added for this case.
2022-02-10 18:34:27 +02:00
Shreyans Jain
30d7a4b167
hashsum: Add BLAKE3 to Hashing Algorithms
...
Signed-off-by: Shreyans Jain <shreyansthebest2007@gmail.com>
2022-02-10 12:46:44 +05:30
Hanif Ariffin
4006524798
Merge branch 'main' of github.com:uutils/coreutils into hbina-ls-propagate-write-errors
2022-02-09 16:10:28 +08:00
Sylvestre Ledru
e5be9c1aaf
Merge pull request #3099 from tertsdiepraam/shuf-refactor
...
`shuf`: remove custom logic for bounded randomization
2022-02-09 07:37:22 +01:00
Jeffrey Finkelstein
b37718de10
split: add BENCHMARKING.md documentation file
2022-02-08 22:58:00 -05:00
Jeffrey Finkelstein
70ca1f45ea
split: remove unused ByteSplitter and LineSplitter
2022-02-08 22:58:00 -05:00
Jeffrey Finkelstein
1d7e1b8732
split: use ByteChunkWriter and LineChunkWriter
...
Replace `ByteSplitter` and `LineSplitter` with `ByteChunkWriter` and
`LineChunkWriter` respectively. This results in a more maintainable
design and an increase in the speed of splitting by lines.
2022-02-08 22:57:57 -05:00
Jeffrey Finkelstein
b31d63eaa9
split: add ByteChunkWriter and LineChunkWriter
...
Add the `ByteChunkWriter` and `LineChunkWriter` structs and
implementations, but don't use them yet. This structs offer an
alternative approach to writing chunks of output (contrasted with
`ByteSplitter` and `LineSplitter`). The main difference is that
control of which underlying file is being written is inside the writer
instead of outside.
2022-02-08 22:53:56 -05:00
Terts Diepraam
dc24c9563e
shuf: BENCHMARKING.md
2022-02-08 21:05:39 +01:00
Sylvestre Ledru
47b12b31a6
Merge pull request #3006 from jfinkels/split-errors
...
split: correct error message on invalid arg. to -a
2022-02-08 20:51:32 +01:00
Sylvestre Ledru
daaae90113
Merge branch 'main' into dd-skip-beyond-file
2022-02-08 20:46:07 +01:00
Sylvestre Ledru
936ac0db38
Merge pull request #3053 from snobee/stat-handle-negative-time
...
stat: allow formatting of negative numbers
2022-02-08 20:45:21 +01:00
Sylvestre Ledru
12d5139320
Merge pull request #3095 from jfinkels/dd-concise-main-loop
...
dd: make main loop more concise
2022-02-08 20:44:39 +01:00
Terts Diepraam
9538814702
shuf: use split_once for parsing the range
2022-02-08 14:39:32 +01:00
Terts Diepraam
30ae952b83
shuf: remove custom randomization logic
2022-02-08 14:39:32 +01:00
Sylvestre Ledru
9c813be5f1
Merge pull request #3076 from jfinkels/dd-seek-truncate
...
dd: truncate to specified seek length
2022-02-08 11:16:15 +01:00
Justin Tracey
b873d46ca0
join: flush stdout before final error message
2022-02-07 22:32:02 -05:00
Narasimha Prasanna HN
0379fca260
Fix merge conflict in tests/by-util/test_cp.rs
2022-02-07 23:26:06 +05:30
Jeffrey Finkelstein
c002b16c67
dd: make main loop more concise
...
Add some helper functions and adjust some error-handling to make the
`Output::dd_out()` method, containing the main loop of the `dd`
program, more concise. This commit also adds documentation and
comments describing the main loop procedure in more detail.
2022-02-07 10:00:49 -05:00
Allan Silva
e6c94c1cd7
wc: Fix clippy error
2022-02-07 10:20:52 -03:00
Sylvestre Ledru
b14e396983
Merge pull request #3091 from jfinkels/df-flatten-filter-mount-list
...
df: refactor filter_mount_list() to be more flat
2022-02-07 10:59:23 +01:00
Justin Tracey
41c90d79c4
join: add benchmarking documentation
2022-02-06 23:53:03 -05:00
Justin Tracey
ac9d006886
join: guess the number of fields in each line
...
This lets us use fewer reallocations when parsing each line.
The current guess is set to the maximum fields in a line so far. This is
a free performance win in the common case where each line has the same
number of fields, but comes with some memory overhead in the case where
there is a line with lots of fields at the beginning of the file, and
fewer later, but each of these lines are typically not kept for very
long anyway.
2022-02-06 23:37:17 -05:00
Justin Tracey
f33e058a5a
join: faster field parsing and representation
...
Using indexes into the line instead of Vec<u8>s means we don't have to copy
the line to store the fields (indexes instead of slices because it avoids
self-referential structs). Using memchr also empirically saves a lot of
intermediate allocations.
2022-02-06 23:37:17 -05:00
Justin Tracey
e6f59b12f7
join: lock and buffer stdout
...
By abstracting the writer we write to, we can lock stdout once at the
beginning, then use buffered writes to it throughout.
2022-02-06 23:37:17 -05:00
Justin Tracey
c12f393150
join: improve error handling
2022-02-06 23:37:06 -05:00
Jeffrey Finkelstein
9528d514bf
df: refactor data table into Row, Header structs
...
Refactor the code for representing the `df` data table into `Header`
and `Row` structs. These structs live in a new module `table.rs`. When
combined with the `Options` struct, these structs can be
`Display`ed. Organizing the code this way makes it possible to test
the display settings independently of the machinery for getting the
filesystem data. New unit tests have been added to `table.rs` to
demonstrate this benefit.
2022-02-06 21:54:58 -05:00
Jeffrey Finkelstein
9f8ec676c5
dd: show warning if skipping past end of input
...
Show a warning if the `skip=N` command-line argument would cause `dd`
to skip past the end of the input. For example:
$ printf "abcd" | dd bs=1 skip=5 count=0 status=noxfer
'standard input': cannot skip to specified offset
0+0 records in
0+0 records out
2022-02-06 20:10:42 -05:00
Jeffrey Finkelstein
84d4f24b8c
dd: avoid infinite loop in Input::force_fill()
...
Avoid an infinite loop in `Input::force_fill()` when the input has
fewer bytes than are being requested to be read from the input.
2022-02-06 20:10:41 -05:00
Jeffrey Finkelstein
8fa6797255
split: add structure to errors that can be created
...
Add some structure to errors that can be created during parsing of
settings from command-line options. This commit creates
`StrategyError` and `SettingsError` enumerations to represent the
various parsing and other errors that can arise when transforming
`ArgMatches` into `Settings`.
2022-02-06 20:09:29 -05:00
Jeffrey Finkelstein
e5361a8c11
split: correct error message on invalid arg. to -a
...
Correct the error message displayed on an invalid parameter to the
`--suffix-length` or `-a` command-line option.
2022-02-06 20:09:29 -05:00
Jeffrey Finkelstein
572b2e032c
df: refactor filter_mount_list() to be more flat
...
Use a `for` loop in the `filter_mount_list()` function to make the
filtering logic easier to read.
2022-02-06 20:04:03 -05:00
ndd7xv
3842ecb1b4
dd: status=progress rewrites once/sec
2022-02-06 17:56:08 -05:00
Jeffrey Finkelstein
fec662a623
dd: show warning when using 0x size multiplier
...
Show a warning when a block size includes "0x" since this is
ambiguous: the user may have meant "multiply the next number by zero"
or they may have meant "the following characters should be interpreted
as a hexadecimal number".
2022-02-06 17:13:15 -05:00
Sylvestre Ledru
1f7c08d87b
Merge pull request #3028 from jfinkels/dd-multipliers
...
dd: add support for 'b' and 'x' multipliers in numeric arguments
2022-02-06 22:03:54 +01:00
Sylvestre Ledru
1ac45c9961
Merge pull request #3044 from water-ghosts/cp-dir-vs-file
...
cp: Fail when copying a directory to a file
2022-02-06 22:01:37 +01:00
Andreas Molzer
a2e9329918
seq: Allow option to receive immediate arguments
...
WIP: this needs to be adjusted
2022-02-06 09:45:38 -06:00
Sylvestre Ledru
57cf3a533f
Merge pull request #3067 from ndd7xv/printf-clap-defaults
...
printf: use clap default help and version
2022-02-05 22:16:44 +01:00
Jeffrey Finkelstein
1af709f642
dd: truncate to specified seek length
...
When specifying `seek=N` and *not* specifying `conv=notrunc`, truncate
the output file to `N` blocks instead of truncating it to zero before
starting to write output. For example
$ printf "abc" > outfile
$ printf "123" | dd bs=1 skip=1 seek=1 count=1 status=noxfer of=outfile
1+0 records in
1+0 records out
$ cat outfile
a2
Fixes #3068 .
2022-02-05 16:07:44 -05:00
Hanif Ariffin
78847e2ad0
Undo a small change that was meant to silence clippy
...
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-05 23:40:23 +08:00
Hanif Ariffin
519e82240a
Revert "Refactor padding calculations into a function"
...
This reverts commit f39b861469
.
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-05 23:32:44 +08:00
Sylvestre Ledru
ebf33d775e
Merge pull request #3023 from RishiKumarRay/main
...
basenc, base64 and base32 have an ABOUT that's formatted differently than the other utils
2022-02-05 14:40:03 +01:00
Hanif Ariffin
e35b93156a
Propagate all write and (most) flush errors
...
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-05 19:30:39 +08:00
Hanif Ariffin
f39b861469
Refactor padding calculations into a function
...
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-05 19:12:05 +08:00
Sylvestre Ledru
252e30c839
Merge pull request #3046 from hbina/hbina-tail-head-dont-use-is-numeric-to-check-digits
...
tail&head: dont use is_numeric to check for digits
2022-02-05 10:08:01 +01:00
ndd7xv
5e790918ef
printf: use clap default help and version
2022-02-04 22:07:31 -05:00
Allan Silva
6a6875012e
wc: implement files0-from option
...
When this option is present, the files argument is not processed. This option processes the file list from provided file, splitting them by the ascii NUL (\0) character. When files0-from is '-', the file list is processed from stdin.
2022-02-04 10:12:08 -03:00
Sylvestre Ledru
572a505119
Merge pull request #3024 from ndd7xv/printf-version-documentation
...
printf: add description and version
2022-02-04 10:45:28 +01:00
Guilherme Augusto de Souza
ae755bb9bd
test: add version and about ( #3011 )
2022-02-04 10:28:15 +01:00
Sylvestre Ledru
033fd62f6a
Merge pull request #3047 from hbina/hbina-touch-better-msg-when-no-args
...
touch: Better error messages when no args is provided
2022-02-04 10:27:01 +01:00
Jeffrey Finkelstein
639971e520
df: refactor function for parsing CLI args
...
Add a `Options::from()` function to collect the code for parsing an
`Options` object from the `clap::ArgMatches` object.
2022-02-03 23:19:14 -05:00
Jeffrey Finkelstein
3fbaa79359
dd: add support for 'b' and 'x' multipliers
...
Support the suffix 'b' (multiply by 512) and 'x' (multiply by an
arbitrary amount) when specifying numeric arguments to dd.
2022-02-03 21:56:13 -05:00
snobee
f7e31f6008
stat: allow formatting of negative numbers
2022-02-03 16:01:19 -08:00
Hanif Ariffin
861437addf
Fix small clippy issue
...
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-03 21:45:02 +08:00
Hanif Bin Ariffin
3586465917
dont use is_numeric to check for digits
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-03 21:42:22 +08:00
snobee
ee721ebf4e
head: handle multibyte numeric utf-8 chars
2022-02-03 21:42:22 +08:00
Hanif Ariffin
ff8a83b256
touch: Better error message when no args is given
...
Matches the behavior of GNU touch
```shell
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks)> touch > /dev/null
touch: missing file operand
Try 'touch --help' for more information.
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> cargo run --quiet -- touch > /dev/null
touch: missing file operand
Try 'touch --help' for more information.
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> cargo run --quiet -- touch 2> /dev/null
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> touch 2> /dev/null
```
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-03 21:10:39 +08:00
Sylvestre Ledru
2d3b8db9ed
Merge pull request #3012 from shoriminimoe/2951-truncate
...
truncate: change cli error return code
2022-02-03 10:43:16 +01:00
Eli Youngs
d50c9c3e77
Fail when copying a directory to a file
2022-02-02 23:59:32 -08:00
Sylvestre Ledru
b411d91fac
Merge pull request #3014 from HeroicKatora/main
...
Make true return false less frequently
2022-02-02 21:43:21 +01:00
DevSaab
773ceb5534
Include ABOUT for shuf
2022-02-02 10:08:48 -05:00
Sylvestre Ledru
57231e6543
Merge pull request #3030 from rahulkadukar/hostid-description
...
hostid: added description in documentation
2022-02-02 10:29:26 +01:00
Sylvestre Ledru
64f3cd748d
Merge pull request #2976 from danieleades/lint
...
add additional lints
2022-02-02 09:55:57 +01:00
Eli Youngs
45751e9e48
cp: Create backup before hardlink
2022-02-01 23:49:39 -08:00
Ivan Majeru
9c73926616
Merge branch 'main' into dd-multi-status-options
2022-02-02 09:08:37 +02:00
Narasimha Prasanna HN
be6287e3e3
Fix: Avoid infinite recursive copies when source and destination directories are same or source is a prefix of destination
2022-02-02 11:17:53 +05:30
Rahul Kadukar
7e32b6ba17
Added description for hostid
2022-02-01 23:51:48 -05:00
Nathan
29b613a852
printf: resolve formatting nit in LONGHELP strings
...
Removed 1 preceeding space for LONGHELP_LEAD and 2 preceeding spaces for LONGHELP_BODY
2022-02-01 22:36:10 -05:00
Nathan
f6174dd946
printf: add description and version
...
Adds a version number and brief description to the printf utility in the user documentation
2022-02-01 19:28:39 -05:00
Sam Caldwell
39f8329222
truncate: use map_err
instead of unwrap_or_else
2022-02-01 14:13:52 -07:00
Rishi Kumar Ray
f117fd8dd6
added correct format to ABOUT
2022-02-02 02:40:59 +05:30
Terts Diepraam
87e582b5e0
Merge pull request #2977 from Dr-Emann/echo_octal_nul
...
echo: Allow echo with escapes to work with `\0`
2022-02-01 20:13:53 +01:00
Andreas Molzer
c6d5eccf6c
false,true: Resolve formatting nit in About
2022-02-01 19:53:25 +01:00
Ivan Majeru
19cc63df9a
dd: allow multiple instances of arguments
...
Correct the behavior of `dd` when multiple arguments are provided.
Before this commit, if the multiple arguments was provided then
the validation error are returned.
For example
```
$ printf '' | ./target/debug/dd status=none status=noxfer
error: The argument '--status=<LEVEL>' was provided more than once, but cannot be used multiple times
USAGE:
dd [OPTIONS]
For more information try --help
```
The unittest was added for this case.
2022-02-01 20:32:56 +02:00
Andreas Molzer
23a544c485
false,true: Implement custom help, version
...
This avoids hacking around the short options of these command line
arguments that have been introduced by clap. Additionally, we test and
correctly handle the combination of both version and help. The GNU
binary will ignore both arguments in this case while clap would perform
the first one. A test for this edge case was added.
2022-02-01 14:29:26 +01:00
Andreas Molzer
c1e108933f
false,true: Align behavior of short flags to GNU
2022-02-01 13:02:22 +01:00
Andreas Molzer
dcf177f908
false: Align behavior to true and GNU
2022-02-01 12:04:23 +01:00
Andreas Molzer
b29e219e4d
true: Rework to return true more often
...
Now treats recognized command line options and ignores unrecognized
command line options instead of returning a special exit status for
them.
There is one point of interest, which is related to an implementation
detail in GNU `true`. It may return a non-true exit status (in
particular EXIT_FAIL) if writing the diagnostics of a GNU specific
option fails. For example `true --version > /dev/full` would fail and
have exit status 1.
This behavior was acknowledged in gnu in commit
<9a6a486e6503520fd2581f2d3356b7149f1b225d>. No further
justification provided for keeping this quirk.
POSIX knows no such options, and requires an exit status of 0 in all
cases. We replicate GNU here which is a consistency improvement over the
prior implementation. Adds documentation to clarify the intended
behavior more properly.
2022-02-01 09:13:00 +01:00
Sam Caldwell
e1f7c774d8
Remove redundant import
2022-01-31 22:59:10 -07:00
Sam Caldwell
6f24166c63
[truncate] handle unused_must_use warning
2022-01-31 22:25:59 -07:00
Sam Caldwell
cd1b5c5748
[truncate] change cli error return code
...
Exit with status code 1 for argument parsing errors in `truncate`. When
`clap` encounters an error during argument parsing, it exits with status
code 2. This causes some GNU tests to fail since they expect status code
1.
2022-01-31 22:08:59 -07:00
Narasimha Prasanna HN
1194a8ce53
Fix: Update quick-error crate version from 1.2.3 to 2.0.1 in src/uu/cp ( #2947 )
...
fix: update quick-error crate from 1.2.3 to 2.0.1 for src/uu/cp tool, fixes: #2941
2022-01-31 21:56:47 +01:00
Terts Diepraam
7fc82cd376
Merge pull request #2902 from jtracey/join-non-unicode-sep
...
join: add support for non-unicode field separators
2022-01-31 21:54:56 +01:00
Terts Diepraam
7477761428
Merge pull request #2882 from jtracey/join-bigfields-compat
...
join: "support" field numbers larger than usize::MAX
2022-01-31 21:52:13 +01:00
Daniel Eades
4f8d1c5fcf
add additional lints
2022-01-31 20:40:47 +01:00
Sylvestre Ledru
dfc661e8b5
Merge pull request #2975 from douglaz/sha_update
...
Updated sha libraries
2022-01-31 08:26:49 +01:00
Zachary Dremann
ad4c5d3357
paste: Use a single buffer
2022-01-30 23:01:15 -05:00
Zachary Dremann
85a81d328a
paste: Create vec with capacity
2022-01-30 23:01:11 -05:00
Zachary Dremann
ff14f25c34
paste: Reuse output
allocation
2022-01-30 23:01:05 -05:00
Zachary Dremann
8905d52279
paste: Write to a locked stdout
2022-01-30 23:01:01 -05:00
Zachary Dremann
c6ec4f8f17
paste: Store delimiters as chars, rather than strings
2022-01-30 23:00:56 -05:00
Zachary Dremann
fa44957a63
paste: Handle unicode delimiters
2022-01-30 23:00:49 -05:00
Jeffrey Finkelstein
b9c2066ee9
uucore: move lines.rs to be a uucore feature
...
Refactor the `lines.rs` module to be a feature in `uucore`. It was
common to both `head` and `tail`.
2022-01-30 22:15:35 -05:00
Jeffrey Finkelstein
cba0696b90
head: don't add trailing newline to end of file
...
Prevent `head` from adding a trailing newline to the end of a file
that did not originally have one when using `head --lines=-0`.
2022-01-30 22:04:19 -05:00
Jeffrey Finkelstein
371278e043
truncate: fix typo in docs: "the any" -> "any"
2022-01-30 22:03:13 -05:00
Jeffrey Finkelstein
fe5b537f56
truncate: error when trying to truncate a fifo
...
Terminate the `truncate` program with an error message when trying to
truncate a named pipe (also known as a fifo).
2022-01-30 22:03:12 -05:00
Jeffrey Finkelstein
83eac9c0a8
head: incorporate "all but last" option into Mode
...
Refactor the `Mode` enum in the `head.rs` module so that it includes
not only the mode type---lines or bytes---but also whether to read the
first NUM items of that type or all but the last NUM. Before this
commit, these two pieces of information were stored separately. This
made it difficult to read the code through several function calls and
understand at a glance which strategy was being employed.
2022-01-30 22:01:25 -05:00
Justin Tracey
58d65fb953
join: add support for non-unicode field separators
...
This allows for `-t` to take invalid unicode (but still single-byte) values
on unix-like platforms. Other platforms, which as of the time of this commit
do not support `OsStr::as_bytes()`, could possibly be supported in the future,
but would require design decisions as to what that means.
2022-01-30 20:04:22 -05:00
Zachary Dremann
d6a0b3c920
Allow echo with escapes to work with \0
...
Testing with gecho on macos outputs a nul character for a \0
2022-01-30 17:24:29 -05:00
Terts Diepraam
7b3cfcf708
Merge pull request #2868 from jfinkels/split-filename-iterator
...
split: use iterator to produce filenames
2022-01-30 22:37:37 +01:00
Allan Douglas R. de Oliveira
f22051a4e1
Updated sha libraries
2022-01-30 17:23:02 -03:00
Daniel Eades
41e2197188
squash some repeated match blocks
2022-01-30 18:32:09 +01:00
Sylvestre Ledru
de07df5992
Merge pull request #2963 from danieleades/refactor/code-quality
...
Refactor/code quality
2022-01-30 18:26:16 +01:00
Jeffrey Finkelstein
a5b435da58
split: use iterator to produce filenames
...
Replace the `FilenameFactory` with `FilenameIterator` and calls to
`FilenameFactory::make()` with calls to `FilenameIterator::next()`. We
did not need the fully generality of being able to produce the
filename for an arbitrary chunk index. Instead we need only iterate
over filenames one after another. This allows for a less
mathematically dense algorithm that is easier to understand and
maintain. Furthermore, it can be connected to some familiar concepts
from the representation of numbers as a sequence of digits.
This does not change the behavior of the `split` program, just the
implementation of how filenames are produced.
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2022-01-30 11:18:58 -05:00
Daniel Eades
ba45fe312a
use 'Self' and derive 'Default' where possible
2022-01-30 15:08:26 +01:00
Daniel Eades
2f85610cc3
remove explicit iter loops
2022-01-30 15:08:26 +01:00
Daniel Eades
cf24620d3d
remove 'let and return'
2022-01-30 15:08:26 +01:00
Daniel Eades
784f2e2ea1
use semicolons if nothing returned
2022-01-30 15:08:26 +01:00
Daniel Eades
a2d5f06be4
remove needless pass by value
2022-01-30 15:08:26 +01:00
Daniel Eades
8bb6c4effa
use pointer args
2022-01-30 14:01:21 +01:00
Daniel Eades
f2074140ec
use 'char' instead of 'str' for single character patterns
2022-01-30 14:01:21 +01:00
Daniel Eades
5af66753af
remove needless borrows
2022-01-30 14:01:21 +01:00
Sylvestre Ledru
2f6f6867c5
Merge branch 'main' into 2940
2022-01-30 13:33:35 +01:00
Sylvestre Ledru
57dc11e586
Merge pull request #2871 from jfinkels/split-settings-methods
...
split: add a method to convert ArgMatches to Settings
2022-01-30 11:31:58 +01:00
Sylvestre Ledru
81b2a240e6
Merge pull request #2960 from water-ghosts/fix-cp-a-panic
...
Don't panic when calling cp -a with a nonexistent file
2022-01-30 11:30:56 +01:00
Sylvestre Ledru
bfa2d8b7da
Merge pull request #2875 from kimono-koans/ls_bad_fd_2
...
ls: Fix display of bad file descriptor errors
2022-01-30 09:59:58 +01:00
Sylvestre Ledru
7c1abdb7d9
Merge pull request #2866 from jfinkels/split-number-2
...
split: implement -n option
2022-01-30 09:58:04 +01:00
Sylvestre Ledru
b8b642101f
Merge pull request #2898 from jfinkels/tail-lines-zero-terminated
...
tail: support zero-terminated lines in streams
2022-01-30 09:44:04 +01:00
Eli Youngs
680e9081fe
Don't panic when calling cp -a with a nonexistent file
2022-01-29 22:59:53 -08:00
Dan Klose
bb7f37e8b4
fix: update itertools 0.8.0 -> 0.10.0
...
Targets https://github.com/uutils/coreutils/issues/2940
* since versions were mxing versions of x.y and x.y.z I changed all to x.y.z
* minor whitespace formatting
2022-01-29 22:35:51 +00:00
Terts Diepraam
eb82015b23
all: change macros
...
- Change the main! proc_macro to a bin! macro_rules macro.
- Reexport uucore_procs from uucore
- Make utils to not import uucore_procs directly
- Remove the `syn` dependency and don't parse proc_macro input (hopefully for faster compile times)
2022-01-29 15:26:32 +01:00
Sylvestre Ledru
1dcd3b2c24
Merge pull request #2943 from jfinkels/truncate-no-such-dir
...
truncate: better error msg when dir does not exist
2022-01-29 12:25:38 +01:00
Sylvestre Ledru
52ab6325a0
Merge pull request #2881 from jtracey/join-null-field-sep
...
join: add support for `-t '\0'`
2022-01-29 10:55:04 +01:00
Sylvestre Ledru
196a7a921c
Merge pull request #2877 from jfinkels/head-use-uucore-error-handling
...
head: use uucore error handling instead of custom
2022-01-29 10:53:48 +01:00
Sylvestre Ledru
24744ca42b
Merge pull request #2911 from jfinkels/dd-seek-stdout
...
dd: support seek=N when destination is stdout
2022-01-29 10:47:17 +01:00
Sylvestre Ledru
57ee6b5302
Merge branch 'main' into truncate-no-such-dir
2022-01-29 09:58:17 +01:00
Sylvestre Ledru
cbc7da3d7d
Merge pull request #2936 from tertsdiepraam/clap-infer-long-args
...
all: enable infer long arguments in clap
2022-01-29 09:57:15 +01:00
Sylvestre Ledru
bd44c59043
Merge pull request #2945 from jfinkels/truncate-reduce-underflow
...
truncate: prevent underflow when reducing size
2022-01-29 09:55:29 +01:00
Sylvestre Ledru
52b7a725ed
Merge pull request #2938 from sylvestre/selinux-dep
...
selinux: add consistency in the dep declaration
2022-01-29 09:46:16 +01:00
Jeffrey Finkelstein
0454d3b243
truncate: prevent underflow when reducing size
...
Prevent usize underflow when reducing the size of a file by more than
its current size. For example, if `f` is a file with 3 bytes, then
truncate -s-5 f
will now set the size of the file to 0 instead of causing a panic.
2022-01-28 22:44:07 -05:00
Jeffrey Finkelstein
c780c96e17
truncate: better error msg when dir does not exist
...
Improve the error message that gets printed when a directory does not
exist. After this commit, the error message is
truncate: cannot open '{file}' for writing: No such file or directory
where `{file}` is the name of a file in a directory that does not
exist.
2022-01-28 21:21:37 -05:00
Terts Diepraam
5f1933a89f
df: no longer override help
2022-01-29 02:06:32 +01:00
Terts Diepraam
9c8e865b55
all: enable infer long arguments in clap
2022-01-29 02:06:29 +01:00
Sylvestre Ledru
96584027e5
selinux: add consistency in the dep declaration
2022-01-29 01:31:17 +01:00
Sylvestre Ledru
f1d72018d7
Merge pull request #2923 from jfinkels/seq-error-zero-increment-value
...
seq: correct error message for zero increment
2022-01-29 01:25:57 +01:00
Sylvestre Ledru
c702154a84
Merge pull request #2934 from jfinkels/truncate-division-by-zero
...
truncate: add a division by zero error
2022-01-29 01:25:10 +01:00
Sylvestre Ledru
fed5ca4ba9
Merge pull request #2935 from tertsdiepraam/wc-unusual-files
...
wc: fix counting files from pseudo-filesystem
2022-01-29 01:09:02 +01:00
Sylvestre Ledru
b94bd96bc6
ignore spelling issue
2022-01-29 00:35:16 +01:00
Sylvestre Ledru
7f79fef2cd
fix various doc warnings
2022-01-29 00:09:09 +01:00
Terts Diepraam
dd311b294b
wc: fix counting files from pseudo-filesystem
2022-01-28 19:08:44 +01:00
electricboogie
72c53219e3
Prevent potential unwrap on a None value
2022-01-27 22:07:07 -06:00
Jeffrey Finkelstein
9dda23d8c6
seq: correct error message for zero increment
...
Change a word in the error message displayed when an increment value
of 0 is provided to `seq`. This commit changes the message from "Zero
increment argument" to "Zero increment value" to match the GNU `seq`
error message.
2022-01-27 21:17:27 -05:00
Jeffrey Finkelstein
b636ff04a0
split: implement -n option
...
Implement the `-n` command-line option to `split`, which splits a file
into a specified number of chunks by byte.
2022-01-27 21:16:27 -05:00
Jeffrey Finkelstein
1e5e637990
truncate: add a division by zero error
...
Add an error for division by zero. Previously, running `truncate -s /0
file` or `-s %0` would panic due to division by zero. After this
change, it writes an error message "division by zero" to stderr and
terminates with an error code.
2022-01-27 21:12:59 -05:00
Jeffrey Finkelstein
1074deeb03
truncate: make better use of UResult
...
Replace some uses of `crash!()` and move `UError` handling down into
the `truncate()` function. This does not change the behavior of the
program, just organizes the code to facilitate introducing code to
handle other types of errors in the future.
2022-01-27 21:05:34 -05:00
electricboogie
5e82d6069f
Fix comments
2022-01-27 16:12:34 -06:00
Sylvestre Ledru
b816e80e2f
Merge pull request #2912 from jfinkels/truncate-create-non-existent-file
...
truncate: create non-existent file by default
2022-01-27 23:03:55 +01:00
electricboogie
463c1ac2ff
Make suggested changes: Move logic into PathData struct, etc.
2022-01-27 11:57:19 -06:00
electricboogie
7512200ba2
Cleanup comments
2022-01-26 16:52:05 -06:00
electricboogie
1d629d8d66
Move more logic into md function, make enter_directory function clearer
2022-01-26 16:41:52 -06:00
Jeffrey Finkelstein
4fbe2b2b5e
seq: implement -f FORMAT option
...
Add support for the `-f FORMAT` option to `seq`. This option instructs
the program to render each value in the generated sequence using a
given `printf`-style floating point format. For example,
$ seq -f %.2f 0.0 0.1 0.5
0.00
0.10
0.20
0.30
0.40
0.50
Fixes issue #2616 .
2022-01-25 20:48:26 -05:00
Sylvestre Ledru
c7fc0a703b
Merge pull request #2893 from g-k/2888-rand-0.8
...
update rand crate to 0.8
2022-01-25 23:23:43 +01:00
Sylvestre Ledru
5932937952
Merge pull request #2777 from jfinkels/uucore-printf
...
uucore: move printf::memo module to uucore
2022-01-25 23:22:27 +01:00
Sylvestre Ledru
5c45911c13
Merge pull request #2915 from jfinkels/dd-status-noxfer
...
dd: correct behavior when status=noxfer
2022-01-25 23:19:53 +01:00
Jeffrey Finkelstein
e8df666c2e
dd: support seek=N when destination is stdout
...
Add support for the `seek=N` argument when the destination is stdout
and not a file. Previously, the argument was ignored when writing to
stdout.
2022-01-25 12:34:13 -05:00
Sylvestre Ledru
630b5d8577
Merge pull request #2909 from jfinkels/dd-conv-ascii-unblock
...
dd: block/unblock on ebcdic/ascii conversions
2022-01-25 14:37:20 +01:00
Sylvestre Ledru
b5df3723df
Merge pull request #2897 from tertsdiepraam/mdbook
...
Automatic mdBook Documentation
2022-01-25 14:33:41 +01:00
Sylvestre Ledru
1415ebc263
Merge pull request #2908 from cohosh/join_chkodr_default
...
join: fix default check order behaviour
2022-01-25 13:47:34 +01:00
Sylvestre Ledru
c74cfdc33e
Merge pull request #2916 from jfinkels/tail-follow-non-utf8-bytes
...
tail: don't error when following non-UTF-8 data
2022-01-25 13:47:16 +01:00
Sylvestre Ledru
e6733881d6
Merge pull request #2850 from sbentmar/numfmt-error-handling
...
numfmt: use UResult in more functions
2022-01-25 13:46:46 +01:00
Jeffrey Finkelstein
83f96ec29d
tail: don't error when following non-UTF-8 data
...
Fix a bug where `tail -f` would terminate with an error due to failing
to parse a UTF-8 string from a sequence of bytes read from the
followed file. This commit replaces the call to `BufRead::read_line()`
with a call to `BufRead::read_until()` so that any sequence of bytes
regardless of encoding can be read.
Fixes #1050 .
2022-01-24 21:32:52 -05:00
Greg Guthe
e6fdf0761f
factor: ignore quickcheck tests using unhandled large vals
...
refs: #1559
2022-01-24 20:51:10 -05:00
Greg Guthe
e24ecea1da
factor: tests: update Arbitrary impl for Factors
...
Upstream removed the Gen trait and made the gen method private in
d286e4db20
2022-01-24 20:41:22 -05:00
Greg Guthe
c037382df7
factor: update quickcheck dev dep to 1.0.3
...
quickcheck <1 uses rand 0.6.x which results in E0599 errors. Upgrading resolves that error and lets
us remove the older rand version from our deps.
refs: https://stackoverflow.com/questions/56901973/errore0599-no-method-named-gen-found-for-type-mut-g-in-the-current-scope/56902740#56902740
2022-01-24 20:41:20 -05:00
Greg Guthe
a6f8d1d9fd
shuf: fix crate relative import for vendored rand read adapter
2022-01-24 20:40:57 -05:00
Greg Guthe
2630894658
shuf: remove ReadRng deprecation notices
2022-01-24 20:40:57 -05:00
Greg Guthe
6bcca01e83
shuf: add deprecated rand crate ReadRng adapter
...
It is deprecated pending future removal. This version copied from:
https://github.com/rust-random/rand/blob/0.8.4/src/rngs/adapter/read.rs
2022-01-24 20:40:55 -05:00
Greg Guthe
a342df03f0
tests: update factor Distribution<Factors> sample to take range
2022-01-24 20:40:31 -05:00
Greg Guthe
cae6bc5e82
deps: update rand to 0.8
...
fix : #2888
2022-01-24 20:40:29 -05:00
Jeffrey Finkelstein
80ac2619e4
dd: correct behavior when status=noxfer
...
Correct the behavior of `dd` with the `status=noxfer` option. Before
this commit, the status output was entirely suppressed (as happens
with `status=none`). This was incorrect behavior. After this commit,
the input/output counts are printed to stderr as expected.
For example,
$ printf "" | dd status=noxfer
0+0 records in
0+0 records out
This commit also updates a unit test that was enforcing the wrong
behavior.
2022-01-23 17:36:14 -05:00
Terts Diepraam
d2fe245192
Merge pull request #2502 from hbina/hbina-tr-reimplement-expansion
...
`tr`: Expanding expansion module
2022-01-23 19:08:00 +01:00
Jeffrey Finkelstein
129cfe12b8
truncate: create non-existent file by default
...
Fix the behavior of truncate when given a non-existent file so that it
correctly creates the file before truncating it (unless the
`--no-create` option is also given).
2022-01-23 11:24:53 -05:00
Jeffrey Finkelstein
1c8df122d7
dd: block/unblock on ebcdic/ascii conversions
...
Update `dd` so that the conversion `conv=ascii` implies `conv=unblock`
and, symmetrically, the conversion `conv=ebcdic` implies `conv=block`.
2022-01-23 09:57:37 -05:00
Cecylia Bocovich
594157d1e0
join: fix default check order behaviour
...
If neither --nocheck-order or --check-order are specified, only fail on
unsorted inputs if either file contains unpaired lines.
2022-01-22 17:51:29 -05:00
Terts Diepraam
7014607f0a
Merge branch 'main' into mdbook
2022-01-22 12:42:19 +01:00
Jeffrey Finkelstein
f595edaded
tail: fix a bug in tail [ -n | -c ] +NUM <file>
...
Fix a bug when getting all but the first NUM lines or bytes of a file
via `tail -n +NUM <file>` or `tail -c +NUM <file>`. The bug only
existed when a file is given as an argument; it did not exist when the
input data came from stdin.
2022-01-21 19:05:53 -05:00
Jeffrey Finkelstein
d27d6bc32c
split: add forwards_thru_file() helper function
...
Add helper function `forwards_thru_file()` that finds the index in a
reader of the byte immediately following the `n`th instance of a given
byte.
2022-01-21 18:33:15 -05:00
Jeffrey Finkelstein
58d84d5107
tail: support zero-terminated lines in streams
...
Support `-z` option when the input is not a seekable file. Previously,
the option was accepted by the argument parser, but it was being
ignored by the application logic.
2022-01-21 18:31:15 -05:00
Sylvestre Ledru
8c298e97a5
expr: Fix a warning in the doc generation ( #2900 )
...
```
warning: this URL is not a hyperlink
```
2022-01-21 23:14:05 +01:00
Terts Diepraam
ab3623f65a
docs: usage and values for options
2022-01-21 19:20:55 +01:00
Cecylia Bocovich
67878de379
join: print unsorted line in error message
...
This expands the error message that is printed if either input file has
an unsorted line. Both the program name (join) and the offending line
are printed out with the message to match the behaviour of the GNU
utility.
2022-01-21 11:47:37 -05:00
Terts Diepraam
9ddd61ab6b
Merge branch 'main' into hbina-tr-reimplement-expansion
2022-01-21 14:42:30 +01:00
Terts Diepraam
55a47f6fc0
Merge pull request #2863 from tertsdiepraam/clap-3
...
Clap 3
2022-01-20 23:14:52 +01:00
Sylvestre Ledru
d64b32d121
Merge pull request #2885 from jfinkels/head-find-nth-line-from-end
...
head: refactor helper function find_nth_line_from_end()
2022-01-20 21:53:47 +01:00
electricboogie
0b53cd8c4a
Make suggested changes
2022-01-20 14:52:45 -06:00
Terts Diepraam
b51a6e8fe3
tr: make parsing of sets more terse
2022-01-19 21:03:57 +01:00
Terts Diepraam
da728dd2b6
Merge branch 'main' into hbina-tr-reimplement-expansion
2022-01-19 19:34:13 +01:00
Terts Diepraam
6aa433c70a
tr: adapt copyright to new guidelines
2022-01-19 19:07:17 +01:00
Roy Ivy III
2e251f91f1
0.0.12
2022-01-19 05:35:00 -06:00
Jeffrey Finkelstein
ca812a7558
tail: rm trailing \n if input doesn't end with one
...
Fix a bug where `tail` would inappropriately add a newline to the last
line of output even though the input did not end with one.
2022-01-18 17:34:41 -05:00
Terts Diepraam
4b79419514
runcon/hashsum: remove references to get_matches_from_safe
2022-01-18 16:34:06 +01:00
Terts Diepraam
0a30c43bb6
chcon: use try_get_matches_from
2022-01-18 13:06:02 +01:00
Terts Diepraam
e345768484
base64: remove clap dependency again
2022-01-18 12:56:58 +01:00
Terts Diepraam
270a6ee83e
rm: fix 3 leading hyphens for ---presume-input-tty
2022-01-18 12:54:50 +01:00
Justin Tracey
ce3df12eaa
join: "support" field numbers larger than usize::MAX
...
They silently get folded to usize::MAX, which is the official GNU behavior.
2022-01-17 17:49:41 -05:00
Jeffrey Finkelstein
e575007629
tail: improve error handling when file not found
2022-01-17 10:57:24 -05:00
Jeffrey Finkelstein
0f1053ce68
head: refactor helper func find_nth_line_from_end
...
Factor out a loop for finding the index of the byte immediately
following the `n`th line from the end of a file. This does not change
the behavior of the code, just its organization.
2022-01-17 10:55:40 -05:00
Terts Diepraam
951f3bb689
fix up runcon and chcon for clap 3
2022-01-17 16:52:17 +01:00
Terts Diepraam
55893f0e3d
od: use clap options instead of custom mock options for unit tests
2022-01-17 16:25:49 +01:00
sbentmar
b0cf6f9b34
numfmt: minor adjustments to test cases
2022-01-17 16:24:40 +01:00
sbentmar
635c2d0c31
numfmt: remove unused function
2022-01-17 16:24:40 +01:00
sbentmar
1287ce3780
numfmt: add tests for handle_buffer
2022-01-17 16:24:40 +01:00
sbentmar
4a7d313712
numfmt: add unit test for io error
2022-01-17 16:24:40 +01:00
sbentmar
5cab4e41b3
numfmt: add copyright notice
2022-01-17 16:24:40 +01:00
Sebastian Holgersson
9b04c98ddb
numfmt: use UResult in more functions
...
This commit replaces generic Results with UResults in some key
functions in numfmt. As a result of this, we can provide different
exit codes for different errors, which resolves ~70 failing test
cases in the GNU numfmt.pl test suite.
2022-01-17 16:24:40 +01:00
Jeffrey Finkelstein
ab4036297b
head: use uucore error handling instead of custom
...
Use `show!()` and `USimpleError` to handle I/O errors instead of using
custom code.
2022-01-17 08:58:44 -05:00
Jeffrey Finkelstein
58f2000406
split: method to convert ArgMatches to Settings
...
Create a `Settings::from` method that converts a `clap::ArgMatches`
instance into a `Settings` instance. This eliminates the unnecessary
use of a mutable variable when initializing the settings.
2022-01-17 08:58:10 -05:00
Jeffrey Finkelstein
d9afdf0527
uucore: move printf::memo module to uucore
...
Move the `printf::memo` module to `uucore` so that it can be used by
other programs, not just `printf`. For example, the `-f` option to `seq`
requires parsing and formatting numbers according to the same logic as
`printf`.
2022-01-17 08:46:45 -05:00
Jeffrey Finkelstein
2d66c84413
printf: remove cli module
...
Remove the cli module from the printf crate and move its functions into
the module tokenize::unescaped_text module, the only place they are
used.
2022-01-17 08:43:36 -05:00
Terts Diepraam
8872485922
Merge branch 'main' into clap-3
2022-01-17 13:25:51 +01:00
Terts Diepraam
08efa1fe5a
Merge branch 'main' into join-null-field-sep
2022-01-17 12:59:52 +01:00
Sylvestre Ledru
a87a71893f
Merge pull request #2879 from sylvestre/chrono-issue
...
Force minimal version of chrono to avoid a security issue
2022-01-17 12:53:31 +01:00
Justin Tracey
109277d405
join: add support for -t '\0'
2022-01-16 18:05:58 -05:00
Justin Tracey
346415e1d2
join: add support for -z option
2022-01-16 17:56:07 -05:00
Sylvestre Ledru
fcff6fec6d
Force minimal version of chrono to avoid a security issue
...
See: https://rustsec.org/advisories/RUSTSEC-2020-0071.html
2022-01-16 23:33:12 +01:00
Sylvestre Ledru
4fc47aba61
Merge pull request #2878 from tertsdiepraam/stdbuf-trouble
...
`stdbuf`: fix `cargo publish` problem
2022-01-16 23:23:35 +01:00
Sylvestre Ledru
516bdfcfd5
Merge pull request #2872 from jfinkels/split-verbose
...
split: add --verbose option
2022-01-16 23:19:30 +01:00
Terts Diepraam
c5e2515833
fix stdbuf problem
2022-01-16 22:50:34 +01:00
electricboogie
16b7b38b92
Run cargo fmt
2022-01-16 11:17:43 -06:00
electricboogie
e6ce049d2c
Fix Windows lints/build errors
2022-01-16 11:07:22 -06:00
electricboogie
e1bffea595
Merge branch 'master' into ls_bad_fd_2
2022-01-16 10:26:44 -06:00
electricboogie
15efba54c5
Use dir_entry metadata for dereferenced bad fds to match GNU, add comments, clippy lints
2022-01-16 10:20:50 -06:00
Sylvestre Ledru
1fbda8003c
coreutils 0.0.8 => 0.0.9, uucore_procs 0.0.7 => 0.0.8, uucore 0.0.10 => 0.0.11
2022-01-16 17:05:48 +01:00
Sylvestre Ledru
00c11b184f
Merge pull request #2851 from jtracey/join-strless
...
join: operate on bytes instead of Strings
2022-01-16 16:24:38 +01:00
Terts Diepraam
448b84806f
fix Rust 1.58 clippy lints ( #2874 )
2022-01-16 15:57:33 +01:00
Jeffrey Finkelstein
7af3007204
split: add --verbose option
2022-01-16 09:34:28 -05:00
electricboogie
37ca6edfdc
Fix display of bad fd errors
2022-01-15 22:39:07 -06:00
kimono-koans
fd5310411e
ls: Fix device display ( #2855 )
2022-01-15 00:39:56 +01:00
Sylvestre Ledru
3cc1fb593a
Merge pull request #2859 from jfinkels/split-dynamic-suffix-length
...
split: correct filename creation algorithm
2022-01-14 18:06:57 +01:00
Terts Diepraam
49e5412580
tsort: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
e62fdb9307
yes: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
fe69ad25f8
whoami: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
e3b8e6c993
who: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
e9e5768591
wc: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
e5a775be46
users: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
ac76eefb99
uptime: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
2cd32beb70
unlink
2022-01-11 19:16:48 +01:00
Terts Diepraam
5105a59fda
uniq: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
dafa0737c8
unexpand: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
7de993fa4f
uname: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
48c65934c7
tty: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
263357666f
truncate: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
6c37cdebce
true: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
fd777866a3
tr: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
9f58715d65
touch: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
7318d1d24b
timeout: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
0ff1984471
test: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
3cac8a631f
tee: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
9c9643807a
tail: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
219498c2e8
tac: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
57361292aa
sync: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
bad790840a
sum: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
0fca4460de
stdbuf: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
eaaa16291e
stat: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
ecf6f18ab3
split: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
b43839a8a8
sort: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
d0a52c95e6
sleep: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
793e540323
shuf: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
92e94de2d7
shred: clap 3
2022-01-11 19:16:48 +01:00
Terts Diepraam
41513a8ba6
seq: clap 3
2022-01-11 19:16:48 +01:00