Commit graph

2344 commits

Author SHA1 Message Date
Jeffrey Finkelstein
35fb4e6ea1 mktemp: include suffix in error message
Include the suffix in the error message produced by `mktemp` when
there are too few Xs in the template. Before this commit,

    $ mktemp --suffix=X aXX
    mktemp: too few X's in template 'aXX'

After this commit,

    $ mktemp --suffix=X aXX
    mktemp: too few X's in template 'aXXX'

This matches the behavior of GNU `mktemp`.
2022-05-21 21:59:06 -04:00
Thomas Queiroz
0b24839a1e
tests/ls: add --group-directories-first test 2022-05-21 18:57:53 -03:00
Thomas Queiroz
c4606266e4
tests/ls: update version sort test 2022-05-21 18:50:26 -03:00
Sylvestre Ledru
d92107362b
Merge pull request #3521 from jfinkels/mktemp-tmpdir-absolute-path
mktemp: correct error message on absolute path
2022-05-21 09:40:33 +02:00
Sylvestre Ledru
bda9f9f889
Merge pull request #3529 from ilkecan/mv-target-dir
mv: allow a single source with --target-directory
2022-05-21 09:40:16 +02:00
Jan Scheer
84480f892d
tail: add equivalent of stdin_is_pipe_or_fifo() for Windows
* add support to determine if stdin is readable on Windows
2022-05-19 22:55:47 +02:00
Jeffrey Finkelstein
6260333415 mktemp: fix error msg when suffix has path sep.
Correct the error message when the template argument contains a path
separator in its suffix. Before this commit:

    $ mktemp aXXX/b
    mktemp: too few X's in template 'b'

After this commit:

    $ mktemp aXXX/b
    mktemp: invalid suffix '/b', contains directory separator

This error message is more appropriate and matches the behavior of GNU
mktemp.
2022-05-19 15:46:04 +02:00
Jan Scheer
6a1cf72316
Merge branch 'main' into tail_notify 2022-05-18 14:28:19 +02:00
Jan Scheer
07231e6c6c
tail: fix handling of stdin redirects for macOS
On macOS path.is_dir() can be false for directories
if it was a redirect, e.g. ` tail < DIR`

* fix some tests for macOS

Cleanup:
* fix clippy/spell-checker
* fix build for windows by refactoring stdin_is_pipe_or_fifo()
2022-05-18 14:22:53 +02:00
Jeffrey Finkelstein
8a941db20a mktemp: correct error message on absolute path
Correct the error message produced by `mktemp` when `--tmpdir` is
given and the template is an absolute path:

    $ mktemp --tmpdir=a /XXX
    mktemp: invalid template, '/XXX'; with --tmpdir, it may not be absolute
2022-05-17 20:16:47 -04:00
Daniel Hofstetter
27dd59635a uucore: add InvalidSuffix to ParseSizeError 2022-05-17 15:37:49 +02:00
Jan Scheer
75a6641ced
Merge branch 'main' into tail_notify 2022-05-17 14:13:20 +02:00
353fc443 aka Seagull
124312702f
Merge branch 'main' into mktemp-set-dir-mode 2022-05-17 12:51:04 +01:00
Terts Diepraam
eac0760905
Merge pull request #3528 from jfinkels/clippy-fixes
all: clippy fixes
2022-05-17 11:57:47 +02:00
353fc443 aka Seagull
2086d04996
Merge branch 'main' into mktemp-set-dir-mode 2022-05-17 04:58:03 +00:00
Jan Scheer
409878e323
Merge branch 'main' into tail_notify 2022-05-16 22:45:52 +02:00
Jan Scheer
ede73745f5
test_tail: add various tests for follow-stdin and redirect-stdin
* add various tests adapted from `gnu/tests/tail-2/follow-stdin.sh`
* explicitly set_stdin to null where needed, otherwise stdin is always
  `piped`
* tighten some existing tests (no_stderr, code_is, etc)
* add test for fifo
2022-05-16 22:17:09 +02:00
Jan Scheer
59827bca1a
test_tail: add various tests for stdin-follow and stdin-redirect
* add various tests adapted from `gnu/tests/tail-2/follow-stdin.sh`
* explicitly set_stdin to null where needed, otherwise stdin is always
  `piped`
* tighten some existing tests (no_stderr, code_is, etc)
* add test for fifo
2022-05-16 22:02:47 +02:00
353fc443
2383950403
mktemp: Added tests for checking directory permissions 2022-05-16 18:05:59 +00:00
Sylvestre Ledru
40095e1b50
Merge pull request #3438 from jfinkels/chown-nonexistent-user-id
chown: allow setting arbitrary numeric user ID
2022-05-14 09:20:01 +02:00
Sylvestre Ledru
9044d96123
Merge pull request #3523 from jhscheer/fix_stat_redirect
test_stat: expand scope for stdin tests
2022-05-14 09:18:40 +02:00
ilkecan
530d5f6dbf mv: allow a single source with --target-directory 2022-05-14 03:00:29 +00:00
Jeffrey Finkelstein
896bbec760 all: clippy fixes 2022-05-13 22:47:56 -04:00
Jan Scheer
fa94591b72
test_stat: expand scope for stdin tests
On Android and macOS all/some tests for stdin fail with:
`cannot stat '-': No such file or directory`
Apparently the `/dev/stdin` redirect workaround doesn't work for
these targets.
2022-05-12 22:49:34 +02:00
Daniel Hofstetter
598dc79b69 df: test default blocksize in POSIX mode 2022-05-12 10:11:24 +02:00
Jeffrey Finkelstein
163df8abc1 fixup! chown: allow setting arbitrary numeric user ID 2022-05-12 08:41:17 +02:00
Jeffrey Finkelstein
55550e1a6e chown: allow setting arbitrary numeric user ID
Update `chown` to allow setting the owner of a file to a numeric user
ID regardless of whether a corresponding username exists on the
system.

For example,

    $ touch f && sudo chown 12345 f

succeeds even though there is no named user with ID 12345.

Fixes #3380.
2022-05-12 08:41:17 +02:00
Sylvestre Ledru
6a9a7d76fc
Merge pull request #3498 from jhscheer/fix_stat_redirect
stat: improve handling of stdin/fifo (fix #3485)
2022-05-12 08:35:43 +02:00
Sylvestre Ledru
1ca4cf5ea7
Merge pull request #3512 from jfinkels/mktemp-invalid-template-path-sep
mktemp: error on path separator in template prefix
2022-05-12 08:34:50 +02:00
Sylvestre Ledru
c212f4a556
Merge pull request #3513 from cakebaker/portability_headers
df: implement POSIX conform header line
2022-05-12 08:33:50 +02:00
Daniel Hofstetter
a6b100a5ca df: show error if provided block size is zero 2022-05-11 12:59:51 +02:00
Daniel Hofstetter
e26fed61b3 df: implement POSIX conform header line
It also fixes #3195
2022-05-11 12:59:47 +02:00
Jeffrey Finkelstein
2874f18950 mktemp: error on path separator in template prefix
Correct the error that arises from a path separator in the prefix
portion of a template argument provided to `mktemp`. Before this
commit, the error message was incorrect:

    $ mktemp -t a/bXXX
    mktemp: failed to create file via template 'a/bXXX': No such file or directory (os error 2) at path "/tmp/a/bege"

After this commit, the error message is correct:

    $ mktemp -t a/bXXX
    mktemp: invalid template, 'a/bXXX', contains directory separator

The code was failing to check for a path separator in the prefix
portion of the template.
2022-05-11 12:59:44 +02:00
Jan Scheer
d906f09e6e stat: improve handling of stdin/fifo (fix #3485)
* fix https://github.com/uutils/coreutils/issues/3485
* improve the workaround from #3280
* add tests
2022-05-11 12:59:25 +02:00
Sylvestre Ledru
0ebd9c9391
Merge pull request #3518 from jhscheer/run_ucmd_as_root
test/util: improve `run_ucmd_as_root` for CICD
2022-05-11 12:57:42 +02:00
Jan Scheer
12d7d9846a
test/util: improve run_ucmd_as_root for CICD
* ensure that `fn run_no_wait` is only invoked if the system running the
test has `sudo` in $path

Previously, if run inside CICD, calling `fn run_ucmd_as_root`
would provoke `fn run_no_wait` to panic because there's no `sudo`.
2022-05-10 23:41:22 +02:00
Sylvestre Ledru
7d8b1de213 uniq: Disable one of the gnu test for failing too often
See: https://github.com/uutils/coreutils/issues/3509
2022-05-10 13:54:33 +02:00
jfinkels
ae580cd54a
Merge pull request #3482 from cakebaker/handle_posixly_correct
df: use blocksize of 512 if POSIXLY_CORRECT is set
2022-05-09 19:43:58 -04:00
Sylvestre Ledru
f65d72e334 also support for tests/touch/relative.sh 2022-05-08 21:52:12 +02:00
Sylvestre Ledru
d5569847bd also support for tests/touch/no-rights.sh format 2022-05-08 21:50:12 +02:00
Daniel Hofstetter
f668b69a2c df: use blocksize of 512 if POSIXLY_CORRECT is set 2022-05-08 14:46:31 +02:00
Sylvestre Ledru
56264ebece
Merge branch 'main' into 2884-time-0.3 2022-05-07 20:57:14 +02:00
Daniel Hofstetter
5a3933a882 df: fix "Size" header for multiples of 1000 & 1024 2022-05-06 15:37:52 +02:00
Sylvestre Ledru
06ef89b3d8 touch: improve the -d option support of other dates 2022-05-06 09:23:46 +02:00
Sylvestre Ledru
9ea8531878
Merge pull request #2692 from jhscheer/run_ucmd_as_root
tests/util: add a convenience wrapper to run a ucmd with root permissions
2022-05-06 08:35:33 +02:00
Jan Scheer
f5ffa94129
test_stat: add tests for issues with stdin
* add tests for: https://github.com/uutils/coreutils/issues/3485
* add test for: https://github.com/uutils/coreutils/pull/3280
2022-05-05 20:39:50 +02:00
Sylvestre Ledru
75ea1f1fc3
Merge pull request #3457 from tertsdiepraam/clap-exit-code
`clap` exit code
2022-05-05 11:44:24 +02:00
Sylvestre Ledru
84f24aed8f
Merge pull request #3476 from ackerleytng/main
du: use USimpleError instead of set_exit_code
2022-05-05 07:59:20 +02:00
Sylvestre Ledru
cbe39b4154
Merge pull request #3456 from cakebaker/ticket_3193
df: fix "Size" column header
2022-05-05 07:58:48 +02:00
Terts Diepraam
1bb85acc71 nice: set exit code for clap errors to 125 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
anastygnome
70c451fa61
Add test for copying dangling symlink copy with dereference
Signed-off-by: anastygnome <noreplygitemail@protonmail.com>
2022-05-03 19:54:13 +02:00
Daniel Hofstetter
15412f100a df: show "block-size argument too large" error 2022-05-03 09:26:57 +02:00
Sylvestre Ledru
9b69e6fd47
Merge branch 'main' into 2884-time-0.3 2022-05-02 18:14:14 +02:00
Terts Diepraam
0322d4633e
Merge pull request #3061 from hbina/hbina-printf-default-left-justify-legth
printf: Default left-justify integer conversion to 1 width
2022-05-02 17:50:10 +02: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
Jeffrey Finkelstein
08816a4f05 fixup! mktemp: respect path given in template argument 2022-05-01 16:51:25 -04:00
Sylvestre Ledru
eaad6c5286 more comment
mostly to retrigger the ci :)
2022-05-01 20:15:44 +02:00
Jan Scheer
bab7ba8a52 Update util.rs 2022-05-01 20:15:44 +02:00
Jan Scheer
de01b11a7d Update util.rs
add feature for `whoami`
2022-05-01 20:15:44 +02:00
Jan Scheer
e991838ca8 tests/util: add a convenience wrapper to run a ucmd with root
permissions
2022-05-01 20:15:44 +02:00
Hanif Ariffin
2e60dce11a printf: Default left-justify integer conversion to 1 width
When using left-justify with integer conversion (like `printf '%-o'`),
default the minimum width to 1.

Closes: https://github.com/uutils/coreutils/issues/3050

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-05-01 20:00:09 +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
10eaaae272 time: take in account the local tz 2022-05-01 17:00:41 +02:00
Sylvestre Ledru
326dc5080d stat: add a test to verify time easily 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
Sylvestre Ledru
f869fafd03
Merge pull request #3460 from tertsdiepraam/fix-dir-vdir-tests
`dir`, `vdir`: fix incorrect regex in tests
2022-05-01 16:15:25 +02:00
Terts Diepraam
95ba8c45b2 dir, vdir: fix incorrect regex in tests 2022-05-01 13:48:51 +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
994dedd6d9 tests/ptx: added breakfile option tests 2022-04-29 10:15:06 +02:00
Michael Kefeder
c6ad244142 tests/ptx: verify output width is handled correctly 2022-04-28 16:46:10 +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
Daniel Hofstetter
78dc90124e df: simplify get_header() in test_block_size_1024 2022-04-23 16:56:06 +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
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
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
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
67a01a5d79 preserve LD_PRELOAD in the test env 2022-04-20 08:44:49 +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
Daniel Hofstetter
0d7f99a21f df: fix broken "test_df_output_overridden" test 2022-04-19 07:46:00 +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
87f06637a9 tests/uniq: add GNU tests as Rust tests
tests/uniq: fix and uncomment test case 120
2022-04-17 16:50:18 +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
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
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
c23118bab4
Merge pull request #3387 from cakebaker/ticket_3355
df: fix calculation of IUse%
2022-04-13 15:11:41 +02:00
Sylvestre Ledru
f7fef343f3
Merge pull request #3377 from uutils/dependabot/cargo/rlimit-0.8.3
build(deps): bump rlimit from 0.4.0 to 0.8.3
2022-04-13 14:53:47 +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
991672a030 Adjust rlimit usage with the new version 2022-04-13 11:18:37 +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
57b8caf1d0 mv: move the tests in a separate function 2022-04-12 20:39:00 +02:00
Ashe Leclerc
76a74c65ab tests/mv: test interactive mvError
test -i flag in case of overwriting a non-directory with a directory
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
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
Jeffrey Finkelstein
c5413167e2 df: correct --total argument used in unit test
Add a missing dash to the `--total` argument applied in the
`test_df_output` test case. Before this commit, the argument `-total`
was treated as a path argument. After this commit, `--total` is
treated as a command-line option that causes the total file usage to
be displayed.
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
Jeffrey Finkelstein
7192856da4 tests: print stdout in error msg for no_stdout()
Fix a bug in which the error message displayed when using
`CmdResult::no_stdout()` was incorrectly showing stderr when it should
have been showing stdout.
2022-04-09 12:44:24 -04: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
935bdd4210
Merge pull request #3368 from tertsdiepraam/msrv-1.56
Rust Edition 2021
2022-04-07 11:46:42 +02:00
Terts Diepraam
54b2fe700b fix regressed test due to lscolors update 2022-04-07 11:05:20 +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
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
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
74a348161e install: add tests to test with multiple directories
to please @calixteman
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
Sylvestre Ledru
12ad0f0903
Fix clippy
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2022-04-02 09:54:11 +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
Pyokyeong Son
9a76f3ba31 tests/mkdir: reduced tested permission combinations
tests/pwd: escapted directory paths
2022-03-31 15:50:52 +09: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
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
eeafdc7021 fix lint errors attempt 2 2022-03-28 11:36:50 -04:00
DevSabb
bb64e699ec fix lint errors 2022-03-28 11:33:38 -04:00
DevSabb
68b1f04f7d fix more clippy warnings 2022-03-28 11:09:26 -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
fbb64b9c5c mkdir: gnu compat: add support of mkdir -p foo/. 2022-03-25 21:35:27 +01:00
Pyokyeong Son
98370727a2 test/mkdir: formatting compliance 2022-03-25 15:04:15 +00:00
Pyokyeong Son
8108fb15b6
Merge branch 'uutils:main' into mkdir-fix 2022-03-25 23:03:29 +09:00
Sylvestre Ledru
0ffc162daa
Merge pull request #3301 from sylvestre/assert_eq
use assert_eq instead of x == y. Better output in case of error
2022-03-24 08:18:08 +01: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
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
Sylvestre Ledru
ba83e5e901 use assert_eq instead of x == y. Better output in case of error 2022-03-23 10:41:31 +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
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
Jeffrey Finkelstein
f4af226820 uucore: error on negative interval in parse_time
Return an error when a negative interval is provided as the argument
to `uucore::parse_time::from_str()`, since a `Duration` should only be
non-negative.
2022-03-21 21:11:31 -04: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
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
435c983b36
Merge pull request #3087 from water-ghosts/printf-general
printf - Update %g formatting to match GNU
2022-03-21 13:23: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
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
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
efd627bb20 cp: only allow directory for -t 2022-03-20 13:50:39 +01:00
Eli Youngs
a0bd88b51b Add comments and an additional test 2022-03-20 00:44:09 -07: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
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
Sylvestre Ledru
3c88fb460b
Merge branch 'main' into dependabot/cargo/clap-3.1.6 2022-03-19 09:26:05 +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
Jeffrey Finkelstein
388cb6c83a uucore: use Duration::saturating_mul in parse_time
Use `Duration::saturating_mul()` to avoid a panic due to overflow in
`uucore::parse_time::from_str()`. This change prevents panic on very
large arguments to timeout and sleep.
2022-03-18 23:15:02 -04:00
chordtoll
72ce815d87 Add correct set of tests, fix typo in flags to test, write test to confirm additive flags 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
Sylvestre Ledru
9796e01df6
Revert "split: implement round-robin arg to --number" 2022-03-18 14:45:29 +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
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
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
dd6d29f389
Merge pull request #3248 from sylvestre/nproc
nproc: Improve the GNU compat
2022-03-14 08:32:40 +01:00
Sylvestre Ledru
24b4af768c nproc: Improve the support of OMP_NUM_THREADS 2022-03-13 18:33:16 +01: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
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
Sylvestre Ledru
2cc951ae79
Merge pull request #3218 from sylvestre/timeout-test
timeout: add a test for empty arg
2022-03-12 09:43:36 +01:00
Eli Youngs
565af8237b Fix formatting 2022-03-11 23:43:59 +01:00
Eli Youngs
e23219289a Simplify test cases 2022-03-11 23:43:59 +01:00
Eli Youngs
2afa9cd1a0 printf - Update %g formatting to match GNU 2022-03-11 23:43:59 +01: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
c0cd017706 tests: update test_df.rs to use --output argument 2022-03-10 22:50:15 -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
b42168e9dc Clippy fixes in multiple crates 2022-03-10 22:31:21 -05:00
Sylvestre Ledru
2e860e7048
Merge pull request #3116 from nickd0/printf-round-fix
printf: fix printf sci notation round up
2022-03-09 19:47:52 +01:00
Sylvestre Ledru
3955354b3a timeout: add a test for empty arg 2022-03-09 19:45:43 +01:00
Daniel Hofstetter
3317fb9924 df: always round up usage percentage (#3208) 2022-03-08 15:13:05 +01:00
Justin Tracey
687dcaef9f users and who: ignore failing tests for now 2022-03-07 12:32:07 -05:00
Justin Tracey
f52f655934 pinky: improve tests 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
Nick Donald
a74ffac19e printf: fix printf sci notation round up 2022-03-07 07:01:21 +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
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
3272a590db
test_chmod: update expected results of test_chmod_recursive
The test succeeds before because the files are read before the permission change and that's inconsistent with GNU chmod.
2022-03-06 08:40:36 +08:00
xxyzz
9083f236da
test_chmod: add read permission recursively test 2022-03-06 08:40:36 +08: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
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
Sylvestre Ledru
f3bd1f3020 Add onehundredlines in the spell ignore 2022-03-05 10:27:51 +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
Sylvestre Ledru
8df4f0bb4d
Merge branch 'main' into cp-lb 2022-03-04 20:39:23 +01:00
Sylvestre Ledru
25f0423399
Merge branch 'main' into mkdir-fix 2022-03-04 20:38:06 +01:00
Hanif Ariffin
30a174e6e4
realpath: Error when resolved symlink is absolute and ENOENT (#3037)
* realpath: Match behavior where resolving symlinks with absolute path is an error if ENOENT

This PR changes `realpath` to match the behavior in GNU where,

```shell
hbina@akarin ~/Documents> mkdir dir1
hbina@akarin ~/Documents> mkdir dir2
hbina@akarin ~/Documents> touch dir2/bar
hbina@akarin ~/Documents> ln -s ../dir2/bar dir1/foo1
hbina@akarin ~/Documents> ln -s /dir2/bar dir1/foo2
hbina@akarin ~/Documents> ln -s ../dir2/baz dir1/foo3
hbina@akarin ~/Documents> realpath ./dir1/foo1 ./dir1/foo2 ./dir1/foo3
/home/hbina/Documents/dir2/bar
realpath: ./dir1/foo2: No such file or directory
/home/hbina/Documents/dir2/baz
```

Currently, our `realpath` will happily print the second one out,

```shell
hbina@akarin ~/Documents> ~/git/uutils/target/debug/coreutils realpath ./dir1/foo1 ./dir1/foo2 ./dir1/foo3
/home/hbina/Documents/dir2/bar
/dir2/bar
/home/hbina/Documents/dir2/baz
```

Closes https://github.com/uutils/coreutils/issues/3036

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-03-03 23:06:15 +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
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
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
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
ndd7xv
47be40afae install: add tests for error handling 2022-02-25 21:17:43 -05: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
Terts Diepraam
722c5d268f fix Rust 1.59 clippy lints 2022-02-25 09:39:48 +01:00
Pyokyeong Son
31d91f36b9 test/mkdir: fixed assert types to both mode_t 2022-02-24 07:43:53 +00:00
Pyokyeong Son
fe9e9e6689 test/mkdir: made umask variable mode_t 2022-02-24 07:26:46 +00: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
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
Omer Tuchfeld
f3895124b9 Remove impractical test creating a file too large 2022-02-22 14:23:46 +01:00
Omer Tuchfeld
fa60898354 Adjust 32-bit tests for tail,split,truncate,head 2022-02-22 13:49:20 +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
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
Sylvestre Ledru
bc3f540a1b
Merge pull request #2965 from tertsdiepraam/test-wsl-exec-permission
`test`: fix wsl executable permission
2022-02-20 10:36:13 +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
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
Pyokyeong Son
553c22d33d test/mkdir: reverted mkdir testing delete 2022-02-19 05:46:11 +00:00
Pyokyeong Son
8ffe367dd8 test/mkdir: added testing for umask compliance
- tests for all permission combinations
2022-02-19 05:37:56 +00:00
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
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
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
xxyzz
c16c06ea0d
df: add output option's valid field names 2022-02-17 13:43:59 +08: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
Jeffrey Finkelstein
e598bf0835 tests: add CmdResult::stdout_is_fixture_bytes()
Add helper method `CmdResult::stdout_is_fixture_bytes()`, which is
like `stdout_is_fixture()` but compares stdout to the raw bytes of a
given file instead of decoding the contents of the file to a UTF-8
string.
2022-02-15 21:50:48 -05:00
Sylvestre Ledru
67cee26abe
Merge pull request #3003 from tertsdiepraam/ls-fix-another-flaky-test
`ls`: fix flaky test `test_ls_io_errors`
2022-02-15 20:11:48 +01:00
DevSabb
63fa3c81ed fix failure in test_split 2022-02-14 20:41:58 -05: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
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
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
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
142c24e579
Merge pull request #2982 from Dr-Emann/paste_cleanup
paste: Fixes and cleanup
2022-02-12 19:00:39 +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
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
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
cccc6b8524
Merge pull request #3089 from jfinkels/tests-stderr-only-bytes
tests: fix no_stderr check in stderr_only_bytes()
2022-02-12 11:32:35 +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
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
353fc443
c2bb9dd433
Fix clippy octal-escapes warning 2022-02-11 13:02:06 +00: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
Shreyans Jain
3176ad5c1b
tests/hashsum: Fix missing space in checkfile 2022-02-10 13:55:53 +05:30
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
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
ca7af808d5 tests: correct a test case for split
Correct the `test_split::test_suffixes_exhausted` test case so that it
actually exercises the intended behavior of `split`. Previously, the
test fixture contained 26 bytes. After this commit, the test fixture
contains 27 bytes. When using a suffix width of one, only 26 filenames
should be available when naming chunk files---one for each lowercase
ASCII letter. This commit ensures that the filenames will be exhausted
as intended by the test.
2022-02-08 22:53:57 -05: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
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
Justin Tracey
bf67c5d981 join: add tests for --check-order and stdout error 2022-02-07 22:26:27 -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
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
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
e6a63a78f6 tests: fix no_stderr check in stderr_only_bytes()
Fix a bug in `stderr_only_bytes()` where it was unintentionally
checking `no_stderr()` when it should have been checking
`no_stdout()`.
2022-02-06 18:03:13 -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
16b397a648
Merge pull request #3029 from hbina/hbina-test_ls_order_time-is-flaky
test_ls: Do not rely on the system time of metadata'access time
2022-02-06 22:03:31 +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
Andreas Molzer
66733ca994 seq: Add difficult cases to test suite 2022-02-06 09:45:37 -06: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
Sylvestre Ledru
2ffc5f9e13
Merge pull request #3070 from water-ghosts/printf-0
printf: Support leading zeroes with %0n formatting
2022-02-05 21:02:16 +01: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
Eli Youngs
162f85773e printf: Support leading zeroes with %0n formatting 2022-02-05 00:43:09 -08: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
Hanif Ariffin
793d3dd97c test_printf: add test for additional escape (\c)
Using this escaped character will cause `printf` to stop generating characters.

For instance,

```rust
hbina@akarin ~/g/uutils (hbina-add-test-for-additional-escape)> cargo run --quiet -- printf "%s\c%s" a b
a⏎
```

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-04 18:47:23 +08:00
Sylvestre Ledru
b4c85b2c17
Merge pull request #2997 from tertsdiepraam/cp-allow-hyphen-suffix
`uucore`: allow backup suffix with hyphen value
2022-02-04 10:29:21 +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
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
e60b581c38
test_sort: Preserve the environment variable when executing tests (#3031)
* test_sort: Output sorted files to a file with different name

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>

* Fix the test by saving the environment variable

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>

Co-authored-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-03 16:02:50 +01: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
9cd65c766a Add tests
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-03 21:14:56 +08:00
Hanif Bin Ariffin
c4c666814b Merge branch 'main' of github.com:uutils/coreutils into hbina-test_ls_order_time-is-flaky 2022-02-03 19:57:13 +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
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
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
Hanif Bin Ariffin
560cd74a63 test_ls: Do not rely on the system time of metadata'access time
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-02 12:49:40 +08:00
Sam Caldwell
ea5541db56 truncate: add test_invalid_option 2022-02-01 13:42:50 -07:00
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
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
149399c1bf false,true: Add by-util tests for options 2022-02-01 13:02:18 +01:00
Terts Diepraam
08f1199b08 ls: fix flaky test test_ls_io_errors 2022-02-01 10:55:15 +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
829e4fcb2c
Merge pull request #2970 from tertsdiepraam/ls-fix-flaky-test
`ls`: fix flaky test
2022-01-31 14:26:40 +01:00
Terts Diepraam
184b65df20 uucore: allow backup suffix with hyphen value 2022-01-31 12:10:57 +01:00
Zachary Dremann
f75466bb31 tests/paste: Add test to avoid trimming extra whitespace 2022-01-30 23:03:11 -05:00
Zachary Dremann
fa44957a63 paste: Handle unicode delimiters 2022-01-30 23:00:49 -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
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
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
Terts Diepraam
96d3a95a39 test: fix wsl executable permission 2022-01-31 00:22:21 +01: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
e01e2141f5 ls: fix flaky test (#2969) 2022-01-30 20:09:20 +01: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
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
f4c6ea0ee8 remove unnecessary 'to_owned' 2022-01-30 14:01:21 +01:00
Daniel Eades
191e29f951 simplify some boolean operations 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
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
71c889116e Fix formatting and unused variable checks 2022-01-30 00:33:06 -08:00
Eli Youngs
680e9081fe Don't panic when calling cp -a with a nonexistent file 2022-01-29 22:59:53 -08: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
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
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
2412e4cbf7 add some tests for Clap's InferLongArgs setting 2022-01-29 02:06:32 +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
Terts Diepraam
dd311b294b wc: fix counting files from pseudo-filesystem 2022-01-28 19:08:44 +01: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
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
8b6c1337aa Fix broken test in certain Linux containers 2022-01-27 15:36:55 -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
f1dde86f9b
Merge pull request #2903 from jtracey/ls-test-clippy
ls: fix clippy lints in tests
2022-01-25 23:24:40 +01: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
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
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
1e0dc6c278 tests: update test_random to take range
Fix 'error[E0061]: this function takes 1 argument but 2 arguments were supplied'.
2022-01-24 20:40:31 -05:00
Greg Guthe
771c9f5d9c tests: update random_chars generator to map u8 to char
Fix 'value of type `char` cannot be built from `std::iter::Iterator<Item=u8>`' for split test.

refs: https://docs.rs/rand/0.8.4/rand/distributions/struct.Alphanumeric.html#example
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
c8f9ea5b15
tests/join: test default check order behaviour 2022-01-22 17:51:29 -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
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
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
Justin Tracey
b65815cd06 ls: fix clippy lints in tests 2022-01-21 15:56:42 -05: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
0c34e35fdb
Merge pull request #2896 from tertsdiepraam/flaky-tr-test
`tr`: fix flaky test
2022-01-20 21:53:27 +01:00
Terts Diepraam
9f649ffe9b tr: fix flaky test 2022-01-19 22:33:54 +01:00
Terts Diepraam
da728dd2b6 Merge branch 'main' into hbina-tr-reimplement-expansion 2022-01-19 19:34:13 +01: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
77229aea86 ls: fix tests for windows 2022-01-18 13:47:50 +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
electricboogie
4bee6526bf Add new test, never print error on deref-ed bad fd 2022-01-17 13:14:43 -06:00
Jeffrey Finkelstein
e575007629 tail: improve error handling when file not found 2022-01-17 10:57:24 -05:00
sbentmar
413bff26f8 numfmt: ignore stdin write error 2022-01-17 16:24:40 +01:00
sbentmar
328cf4d91b numfmt: add more negative tests 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
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
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
516bdfcfd5
Merge pull request #2872 from jfinkels/split-verbose
split: add --verbose option
2022-01-16 23:19:30 +01: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
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
e3b8e6c993 who: 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
b43839a8a8 sort: 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
283973c5bf rm: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
c39a9b49d4 pinky: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
6e39eddbc1 mknod: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
0531f13cfd link: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
89112fb1c2 install: clap 3 2022-01-11 19:16:47 +01:00
Sylvestre Ledru
6723a54610
Merge pull request #2862 from rivy/fix.whitespace
refactor/polish ~ whitespace fixup
2022-01-11 17:51:37 +01:00
kimono-koans
016d5e72ad
ls: Fix padding for dangling links in non-Long formats (#2856)
* Fix padding for dangling links in non-long formats

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

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

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

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

- consistent indentation (either spaces-only, tabs, *or* tabs with following spaces [for indentation])
- no internal/invisible tabs
- no trailing whitespace
- EOF EOLNs
2022-01-09 21:35:39 -06:00
Sylvestre Ledru
dcfdeb334d
Merge pull request #2854 from kimono-koans/ls_fix_errno_1
ls: Fix Errno 1, print errors at the md call point
2022-01-09 20:56:06 +01:00
moko256
5659bf8fae
ls: On Windows use DirEntry#metadata() instead of fs::metadata 2022-01-10 02:56:22 +09:00
Justin Tracey
4df2f3c148 join: add test for non-Unicode files 2022-01-08 21:28:29 -05:00
Justin Tracey
cdfe64369d join: add test for non-linefeed newline characters 2022-01-08 19:51:16 -05:00
electricboogie
4052d4ec6a Add test for double printing dangling link errors 2022-01-08 12:10:52 -06:00
kimono-koans
4ea61545c6
Merge branch 'uutils:master' into ls_fix_errno_1 2022-01-07 21:48:53 -06:00
Sylvestre Ledru
9922e48ba6
Merge pull request #2853 from kimono-koans/ls_fix_first_newline
ls: Fix newline when only dirs in base directory
2022-01-07 23:10:44 +01:00
Sylvestre Ledru
969f3cbf39
Merge pull request #2793 from tertsdiepraam/cksum-result-io-error
`cksum`: use `UIoError`
2022-01-07 21:47:01 +01:00
electricboogie
13d6d74fa3 Fix Windows test(?): inode request shouldn't error on Windows, b/c there are no inodes 2022-01-07 09:24:32 -06:00
electricboogie
882b8ddd7b Fix test dir names for Windows 2022-01-06 15:41:53 -06:00
electricboogie
30b2425541 Fix newline when only dirs in base directory, and test 2022-01-06 14:58:56 -06:00
kimono-koans
421330d07a
ls: Improve error handling and other improvements (#2809)
*  print error in the correct order by flushing the stdout buffer before printing an error
*  print correct GNU error codes
*  correct formatting for config.inode, and for dangling links
*  correct padding for Format::Long
*  remove colors after the -> link symbol as this doesn't match GNU
*  correct the major, minor #s for char devices, and correct padding
*  improve speed for all metadata intensive ops by not allocating metadata unless in a Sort mode
*  new tests, have struggled with how to deal with stderr, stdout ordering in a test though
*  tried to implement UIoError, but am still having issues matching the formatting of GNU


Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
2022-01-05 14:50:37 +01:00
Sebastian Holgersson
84798a520e numfmt: fix spelling and formatting issues in tests 2022-01-01 22:55:50 +01:00
Sebastian Holgersson
af5919e466 numfmt: implement missing --suffix option
adds support for the --suffix option from issue #1280.
2022-01-01 21:57:23 +01:00
Jeffrey Finkelstein
f6305e2a3e rm: return UResult from uumain() function 2021-12-29 15:57:55 -05:00
jfinkels
8a55205521
seq: return UResult from uumain() function (#2784) 2021-12-29 15:20:17 +01:00
jfinkels
3f18b98c9d
dd: return UResult from uumain() function (#2792)
* dd: return UResult from uumain() function

* fixup! dd: return UResult from uumain() function
2021-12-29 15:13:52 +01:00
Jeffrey Finkelstein
a882b0cf3e link: return UResult from uumain() function 2021-12-27 18:26:25 -05:00
Terts Diepraam
7ae9e0a7eb cksum: accept directories as empty files 2021-12-26 21:50:13 +01:00
Sylvestre Ledru
5f71e0c8c8
Merge pull request #2790 from jfinkels/comm-uresult
comm: return UResult from uumain() function
2021-12-25 10:41:39 +01:00
Jeffrey Finkelstein
2aebfc9f8d comm: return UResult from uumain() function 2021-12-24 13:40:18 -05:00
Jeffrey Finkelstein
294bde8e08 seq: correct width for certain negative decimals
Fix a bug in which a negative decimal input would not be displayed with
the correct width in the output. Before this commit, the output was
incorrectly

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

After this commit, the output is correctly

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

The code was failing to take into account that the input decimal "-.1"
needs to be displayed with a leading zero, like "-0.1".
2021-12-23 20:37:29 -05:00
kimono-koans
fd64e01d92
ls: Reduce binary size of ls by removing regex crate (#2781) 2021-12-22 18:31:45 +01:00
Sylvestre Ledru
59da0d8cd6 cp: add a unit test for issue 1665 2021-12-19 18:19:48 +01:00
electricboogie
a1960f5da0
Fix cp bug: pre-write permission change (#2769) 2021-12-15 22:18:02 +01:00
Sylvestre Ledru
52d2fe1d28 Try to unbreak the code coverage CI.
For some reasons, on windows, test_compress_fail is failing with a different
error. So, don't check the output on windows
2021-12-14 09:46:28 +01:00
electricboogie
c7f7a222b9
Fix mv bug: Should be able to stat files, but not able to mv if source and target are the same (#2763)
Closes #2760
2021-12-12 17:49:38 +01:00
Jan Verbeek
f2ddae93fa uucore::entries: Make Passwd::locate and Group::locate thread-safe 2021-11-26 14:48:33 +01:00
Hanif Ariffin
c86cb91dee Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-26 16:39:27 +08:00
Hanif Ariffin
38659de66d Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-20 17:06:36 +08:00
Roy Ivy III
f07a1749a1 fix spell-check errors 2021-11-19 17:55:02 -06:00
Roy Ivy III
7133efd0a5 tests ~ fix cargo clippy complaint (clippy::needless_return) 2021-11-19 17:55:02 -06:00
Sylvestre Ledru
43bdcaf212
Merge pull request #2532 from hbina/hbina-rm-silently-accept-presume-input-tty
Silently accepts ---presume-input-tty
2021-11-19 21:42:41 +01:00
Sylvestre Ledru
01440734a4
Merge pull request #2735 from thomasqueirozb/printenv_env_compat
env+printenv: use UResult + improve compatibility
2021-11-19 21:39:34 +01:00
Sylvestre Ledru
da69ab19db
Merge pull request #2745 from thomasqueirozb/chmod_uresult
chmod: use UResult
2021-11-19 21:38:31 +01:00
Smicry
fc851e036b
Implement tail -<number> (#2747)
And add obsolete_syntax test
2021-11-19 21:37:47 +01:00
Hanif Bin Ariffin
da46cc8015 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-13 18:33:25 +08:00