Commit graph

1855 commits

Author SHA1 Message Date
Emil Suleymanov
1172a7e781
cp: remove interactive mode message on 'no' (#4069) 2022-11-10 12:45:18 +01:00
Sylvestre Ledru
9a5d18b8f6 Weird env variable names should trigger an error.
For example `env a=b=c printenv a=b` should fail

Tested by tests/misc/printenv.sh
2022-11-06 17:35:00 +01:00
Sylvestre Ledru
8e5c259e4b
Merge pull request #3966 from jfinkels/cp-backup-force
cp: force copying file to itself with --backup
2022-11-06 08:43:52 +01:00
Sylvestre Ledru
3ea7a061d7
Merge pull request #4097 from devnexen/fbsd_test_fix
fix cp tests build since they re supposed to be ignored on freebsd an…
2022-11-06 07:41:16 +01:00
Sylvestre Ledru
446df9da5a
Merge branch 'main' into cp-backup-force 2022-11-06 07:24:48 +01:00
Sylvestre Ledru
47e3149e85
Merge pull request #3978 from jfinkels/cp-copy-contents-fifo
cp: implement --copy-contents option for fifos
2022-11-06 07:23:25 +01:00
Jeffrey Finkelstein
5b100fef62 cp: implement --copy-contents option for fifos
Implement the `--copy-contents` option when the source is a FIFO, so
that the contents of the FIFO are copied (when the bytes become
available for reading) instead of the FIFO object itself. For example,

    $ mkfifo fifo
    $ cp --copy-contents fifo outfile &
    [1] 1614080
    $ echo foo > fifo
    $ cat outfile
    foo
    [1]+  Done                    cp --copy-contents fifo outfile
2022-11-05 19:25:37 -04:00
Jeffrey Finkelstein
fbed01dd54 cp: force copying file to itself with --backup
Fix the behavior of `cp` when both `--backup` and `--force` are
specified and the source and destination are the same file.  Before
this commit, `cp` terminated without copying and without making a
backup. After this commit, the copy is made and the backup file is
made. For example,

    $ touch f
    $ cp --force --backup f f

results in a backup file `f~` being created.
2022-11-05 19:23:50 -04:00
Sylvestre Ledru
6bc68cdcdf
Merge branch 'main' into refactor/add_nix_error_auto_conversion 2022-11-04 12:54:35 +01:00
Orhun Parmaksız
be49eb68f3
fix: address test failures 2022-11-04 13:35:54 +03:00
Daniel Hofstetter
8114abc956 Fix "needless borrow" clippy warning in env test 2022-11-04 11:10:35 +01:00
Sylvestre Ledru
2d79c4f693
Merge pull request #4091 from dmatos2012/allow-default-value-mktemp
mktemp: allow default missing value
2022-11-03 20:46:11 +01:00
Sylvestre Ledru
f60e861232
Merge pull request #4074 from jfinkels/cp-force-dangling-symlink
cp: restrict copy through dangling symlink with -f
2022-11-03 08:27:41 +01:00
David Matos
53c4b0b81e mktemp: allow default missing value 2022-11-03 08:27:08 +01:00
David CARLIER
40b1ce7151 disable cp tests on FreeBSD where they are supposed to be ignored. 2022-11-03 08:25:40 +01:00
Daniel Hofstetter
2d4810b91b numfmt: allow ' ' as field separator 2022-11-01 10:04:46 +01:00
Daniel Hofstetter
27c233f294 numfmt: allow "-" in field list 2022-10-31 14:53:41 +01:00
Sylvestre Ledru
b942054568
Merge pull request #4093 from cakebaker/numfmt_test_all_fields
numfmt: add test for "--field -" (all fields)
2022-10-31 11:01:32 +01:00
Terts Diepraam
ba3bb56041
Merge pull request #4013 from palaster/rm-correct-prompts
rm: rm3 now passes
2022-10-31 10:17:27 +01:00
Daniel Hofstetter
5d27c19853 numfmt: add test for "--field -" (all fields) 2022-10-31 09:26:28 +01:00
Sylvestre Ledru
bc126085c4
Merge branch 'main' into cp-force-dangling-symlink 2022-10-29 20:01:07 +02:00
Daniel Hofstetter
3a8feedf2d numfmt: allow hyphen values for --field option 2022-10-29 16:50:41 +02:00
Sylvestre Ledru
b3af47a390
Merge branch 'main' into cp-force-dangling-symlink 2022-10-28 21:24:42 +02:00
Pat Laster
c4417bf9b2
Merge branch 'main' into rm-correct-prompts 2022-10-27 13:38:41 -05:00
Sylvestre Ledru
00d93ff451
Merge pull request #4088 from tertsdiepraam/hashsum-test-no-names
hashsum: enable testing --no-names
2022-10-27 19:55:45 +02:00
Daniel Hofstetter
2eb0b6dfe0 numfmt: round values if precision is 0 2022-10-27 15:33:20 +02:00
Sylvestre Ledru
34eabca299 pwd: support the env variable 'POSIXLY_CORRECT'
Should fix tests/misc/pwd-option.sh
2022-10-26 11:40:46 +02:00
Terts Diepraam
96b6252910
Merge pull request #4081 from sylvestre/chown-sep
chown: fails when XXXX. or XXXX: is provided (when XXXX is numeric value)
2022-10-26 11:24:35 +02:00
Terts Diepraam
bbc3495896 hashsum: enable testing --no-names
Co-authored-by: Huijeong Kim <herehuijeong@gmail.com>
2022-10-26 11:10:26 +02:00
Pat Laster
0079f73568
Merge branch 'main' into rm-correct-prompts 2022-10-25 20:58:01 -05:00
Sylvestre Ledru
52d82d54a3 Revert "hashsum: test b3sum::test_nonames for real (#4027)"
This reverts commit 02f6fa7b24.
2022-10-25 23:44:05 +02:00
Sylvestre Ledru
76a0794823
Merge pull request #4072 from jfinkels/clippy-fixes
clippy fixes
2022-10-25 23:28:20 +02:00
Sylvestre Ledru
42fad7c4e5
Merge pull request #4078 from sylvestre/update-i
{cp, mv} -i --update source existing should not do anything and exit 0
2022-10-25 08:31:39 +02:00
Sylvestre Ledru
9f1ac221cd chown: fails when XXXX. or XXXX: is provided (when XXXX is numeric values)
If the arg starts with an id numeric value, the group isn't set but the separator is provided,
we should fail with an error

Should fix tests/chown/separator.sh
2022-10-25 08:25:05 +02:00
Pat Laster
9069d4832a
Merge branch 'main' into rm-correct-prompts 2022-10-24 18:36:52 -05:00
Sylvestre Ledru
6e8f8034ba {cp, mv} -i --update source existing should not do anything and exit 0
Should fix tests/mv/update.sh
2022-10-24 21:03:30 +02:00
Daniel Hofstetter
dedb6289dd numfmt: handle negative zero values 2022-10-24 15:13:02 +02:00
Jeffrey Finkelstein
d48a650966 cp: restrict copy through dangling symlink with -f
Change `cp` to terminate with an error when attempting to copy through
a dangling symbolic link with the `--force` option. Before this
commit,

    touch src
    ln -s no-such-file dest
    cp -f src dest

would incorrectly replace `dest` with the contents of `src`. After
this commit, it correctly fails with the error message

    cp: not writing through dangling symlink 'dest'
2022-10-23 20:17:20 -04:00
Jeffrey Finkelstein
55b3766c10 clippy fixes 2022-10-23 13:56:20 -04:00
Sylvestre Ledru
c766726e8b
Merge pull request #3281 from jfinkels/split-round-robin
split: implement round-robin arg to --number
2022-10-23 09:57:01 +02:00
Jeffrey Finkelstein
ac3fcca6c0 cp: correctly copy ancestor dirs in --parents mode
Fix a bug where `cp` failed to copy ancestor directories when using
the `--parents` option. For example, before this commit:

    $ mkdir -p a/b/c d
    $ cp --parents a/b/c d
    $ find d
    d
    d/c

After this commit

    $ mkdir -p a/b/c d
    $ cp --parents a/b/c d
    $ find d
    d
    d/a
    d/a/b
    d/a/b/c

This commit also adds the correct messages for `--verbose` mode:

    $ cp -r --parents --verbose a/b/c d
    a -> d/a
    a/b -> d/a/b
    'a/b/c' -> 'd/a/b/c'

Fixes #3332.
2022-10-23 00:06:56 -04:00
Jeffrey Finkelstein
cee6c25cc4 cp: make test for interactive mode more specific 2022-10-23 00:03:26 -04:00
Jeffrey Finkelstein
7dc96697c9 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-10-22 23:15:55 -04:00
Pat Laster
99942b4234
Merge branch 'main' into rm-correct-prompts 2022-10-22 14:12:55 -05:00
Huijeong Kim
02f6fa7b24
hashsum: test b3sum::test_nonames for real (#4027)
* hashsum: test b3sum::test_nonames for real

Signed-off-by: Huijeong Kim <herehuijeong@gmail.com>

* apply cargo format

Signed-off-by: Huijeong Kim <herehuijeong@gmail.com>
2022-10-22 11:23:39 +02:00
Sylvestre Ledru
1d9ec1ed94
Merge pull request #3927 from niyaznigmatullin/fix_timeout_test_tmp_files_deleted_on_sigint
test_sort: Fix timeout issue `test_tmp_files_deleted_on_sigint`
2022-10-22 10:24:30 +02:00
Sylvestre Ledru
fd13ceddcb
Merge branch 'main' into rm-correct-prompts 2022-10-22 10:22:29 +02:00
Sylvestre Ledru
e4fe2b10fa
Merge pull request #4014 from tertsdiepraam/ls-windows-permissions
`ls`, `stat`: Show more info in long format on Windows
2022-10-22 10:21:43 +02:00
Sylvestre Ledru
49c435a25b
ignore a word 2022-10-20 07:46:38 +02:00
David Matos
d46e5df3d3 hashsum: warn on file not found rather than fail 2022-10-19 22:46:47 +02:00
Pat Laster
79895a73e6
Merge branch 'main' into rm-correct-prompts 2022-10-18 10:48:26 -05:00
Niyaz Nigmatullin
729d97e993 test_sort: use Pcg32 random number generator 2022-10-18 13:18:50 +03:00
Niyaz Nigmatullin
ec8e610e48 test_sort: created a new big file for sort
Before, the sort could work faster and we could be late with
the signal.
Now we create a new big file, `sort` can't process it in a minute,
so we can safely wait for the temporary directory to be created
and send a signal afterwards
2022-10-18 13:18:50 +03:00
Niyaz Nigmatullin
95e7b53402 test_sort: make timeout smarter, wait if failed to create dir
Before the change it slept for 0.1 seconds and right after that
asserted if `sort` has created the directory. Sometimes `sort`
didn't manage to create the directory in 0.1 seconds.
So the change is it tries to wait for `timeout` starting with
0.1 seconds, and if directory was not found, it tries 4 more times,
each time increasing timeout twice. Once the directory is found
it breaks.
2022-10-18 13:18:50 +03:00
Niyaz Nigmatullin
cefc4f6736 tests: fixed some tests on Windows
Tests used to use system `touch` and `ls` instead of
testing bench `fixtures.touch` and `uu_ls`
2022-10-18 10:00:28 +03:00
Pat Laster
87df47dee3
Merge branch 'main' into rm-correct-prompts 2022-10-17 17:41:44 -05:00
Sylvestre Ledru
969f821830
Merge pull request #4009 from andrewbaptist/fix_eof_linebytes
Match GNU semantics for missing EOF
2022-10-17 16:23:20 +02:00
Niyaz Nigmatullin
277e3d17a1 tests: change error messages for wrong arguments
Clap used `"` for argument values, now uses `'`.
2022-10-16 19:28:04 +03:00
Pat Laster
7e62945fd3
Merge branch 'main' into rm-correct-prompts 2022-10-15 14:58:13 -05:00
Pat Laster
0507270f90 Clippy is going to be the death of me 2022-10-13 20:03:35 -05:00
Pat Laster
70bf4f36a0 Added test to check rm force prompts order 2022-10-13 20:03:35 -05:00
Pat Laster
6245029445 rm: rm3 now passes 2022-10-13 20:03:35 -05:00
Terts Diepraam
14e3c5176c realpath: require arguments again 2022-10-13 20:06:27 +02:00
Terts Diepraam
b0c200e831 env: handle - correctly again 2022-10-13 20:06:02 +02:00
Terts Diepraam
53567deb0f who: update to clap 4 2022-10-13 17:50:43 +02:00
Terts Diepraam
12048cda68 unlink: update to clap 4 2022-10-13 17:50:43 +02:00
Terts Diepraam
9cce0bed7f truncate: update to clap 4 2022-10-13 17:50:43 +02:00
Terts Diepraam
72d7287b11 test: update to clap 4 2022-10-13 17:50:43 +02:00
Terts Diepraam
b6a4f32889 stdbuf: update to clap 4 2022-10-13 17:50:40 +02:00
Terts Diepraam
4cfc90c077 seq: update to clap 4 2022-10-13 17:50:40 +02:00
Terts Diepraam
5faae817ba mv: update to clap 4 2022-10-13 17:50:36 +02:00
Terts Diepraam
1d6c5d14b2 mknod: update to clap 4 2022-10-13 17:50:36 +02:00
Terts Diepraam
c6cff20f18 ls: update to clap 4 2022-10-13 17:50:36 +02:00
Terts Diepraam
838479f86a link: update to clap 4 2022-10-13 17:50:33 +02:00
Terts Diepraam
458c2c8b85 factor: update to clap 4 2022-10-13 17:50:29 +02:00
Terts Diepraam
b7c1216a1a env: update to clap 4 2022-10-13 17:50:29 +02:00
Terts Diepraam
042bb3c4e3 cp: update to clap 4 2022-10-13 17:50:26 +02:00
Terts Diepraam
075245235e chgrp: update to clap 4 2022-10-13 17:50:23 +02:00
Terts Diepraam
649dab36f1 basename: update to clap 4 2022-10-13 16:22:45 +02:00
Terts Diepraam
26309dc9d7 base{32, 64, enc}: update to clap 4 2022-10-13 16:22:24 +02:00
Sylvestre Ledru
6e14dea73b Fix some clippy warnings
Fixed with `cargo clippy --features unix  --fix`
and manually
2022-10-13 09:07:22 +02:00
Sylvestre Ledru
b7c298afee
Merge pull request #4020 from ackerleytng/main
dircolors: align TERM matching behavior with that of GNU dircolors
2022-10-12 09:27:34 +02:00
Chad Brewbaker
cbb9db7be7 fix MIRI crash of long test 2022-10-11 12:11:52 -05:00
Sylvestre Ledru
d768b19f2b chroot: improve support of --skip-chdir
Should unbreak tests/misc/chroot-fail.sh
2022-10-10 14:07:45 +02:00
Sylvestre Ledru
ad0ca2f042
Merge pull request #3973 from jfinkels/cp-directory-preserve-permissions
cp: preserve permissions when copying directory and don't terminate early on inaccessible file
2022-10-10 08:16:27 +02:00
Ackerley Tng
1239fc477b dircolors: align TERM matching behavior with that of GNU dircolors 2022-10-09 18:47:20 -07:00
Jeffrey Finkelstein
b89e8e54c4 cp: continue directory walk if file inaccessible
Stop `cp` from terminating prematurely if a file in a directory is
inaccesible due to insufficient permissions.
2022-10-09 17:31:41 -04:00
Jeffrey Finkelstein
2450493302 cp: preserve permissions when copying directory
Make cp preserve the permissions of a directory when copying
it. Before this commit,

    cp -pR src/ dest/

failed to copy the permissions of `src/` to `dest/`. After this
commit, the permissions are correctly copied.
2022-10-09 17:29:29 -04:00
Jeffrey Finkelstein
fba8d495d2 tests: create assert_metadata_eq!() macro
Create `assert_metadata_eq!()` macro to contain a series of assertions
that check whether two `Metadata` objects are equal.
2022-10-09 17:28:43 -04:00
jfinkels
349320ae61
Merge branch 'main' into cp-symbolic-link-loop 2022-10-09 17:28:30 -04:00
Sylvestre Ledru
538e8eca0b
Fix coding style 2022-10-09 20:03:06 +02:00
Terts Diepraam
b3e6472d02 test_ls: adapt to new windows permissions 2022-10-09 12:03:44 +02:00
Terts Diepraam
7d8917bb35
Merge pull request #4003 from sylvestre/sync2
sync: various compatibility improvement
2022-10-09 11:07:44 +02:00
Ackerley Tng
d84803b72f ls: align --ignore behavior with that of GNU ls 2022-10-08 16:54:07 -07:00
Andrew Baptist
4922d34177 Match GNU semantics for missing EOF
While the rust coreutils semantics were arguably more correct,
they were different than the gnu split semantics when handling a
file without a trailing EOF. This patch addresses that difference
and allows passing one more GNU test suite.
2022-10-07 17:50:26 -04:00
Sylvestre Ledru
97dd4824e5
Merge pull request #3976 from andrewbaptist/implement_suffix_start
Add support for starting suffix numbers
2022-10-07 21:07:07 +02:00
Sylvestre Ledru
97f3dfad54
Merge pull request #3965 from Joining7943/fix-windows-pipe
`tests/tail`: Fix tests to reflect changes from the refactoring #3905
2022-10-06 11:17:25 +02:00
Sylvestre Ledru
88fb43c8e4
Merge branch 'main' into cp-symbolic-link-loop 2022-10-06 09:53:02 +02:00
Jeffrey Finkelstein
8bfd96fb59 cp: correct error message on copying dir to itself
Correct the error message produced when attempting to copy a directory
into itself with `cp`. Before this commit, the error message was

    $ cp -R d d
    cp: cannot copy a directory, 'd', into itself, 'd'

After this commit, the error message is

    $ cp -R d d
    cp: cannot copy a directory, 'd', into itself, 'd/d'
2022-10-05 21:37:30 -04:00
Sylvestre Ledru
ae7c45d27a
Merge pull request #3988 from dmatos2012/add-date-format-ls
ls: add support for +FORMAT in timestyle
2022-10-05 18:41:15 +02:00
Andrew Baptist
49e1cc6c71 Add support for starting suffix numbers
This commit now allows split to pass split/numeric.sh
2022-10-05 09:52:20 -04:00
Pat Laster
493a2628d2
rm: Added descend messages for interactive mode Fixes #3817 (#3931)
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2022-10-05 13:35:31 +02:00
Joining7943
1725151ef8 tests/tail: Fix tests to reflect changes from the refactoring #3905 2022-10-05 13:32:35 +02:00
Jeffrey Finkelstein
24630db45e cp: allow removing symbolic link loop destination
Allow `cp --remove-destination` to remove a symbolic link loop (or a
symbolic link that initiates a chain of too many symbolic
links). Before this commit, if `loop` were a symbolic link to itself,
then

    cp --remove-destination file loop

would fail with an error message. After this commit, it succeeds. This
matches the behaviotr of GNU cp.
2022-10-05 13:32:21 +02:00
Sylvestre Ledru
6edf8ebf41 sync: Verify that the files can be opened 2022-10-05 13:30:19 +02:00
Sylvestre Ledru
fc1c7755b9 sync: make fail like GNU - tests/misc/sync.sh 2022-10-05 13:30:19 +02:00
David Matos
b8a5588b81 ls: add support for +FORMAT in timestyle 2022-10-05 13:29:19 +02:00
Sylvestre Ledru
858b2a5b99 disable the new tests 2022-10-04 17:24:06 +02:00
Sylvestre Ledru
3cda177d34 Disable test_preference_of_userspec on android 2022-10-04 17:17:01 +02:00
Terts Diepraam
25db814671
Merge pull request #4002 from sylvestre/cmd-test
test: add a bunch of operations
2022-10-04 12:00:00 +02:00
Sylvestre Ledru
33de6c89db test: allow parsing of bigger numbers
Fixes: tests/misc/test.pl
2022-10-03 20:25:45 +02:00
Sylvestre Ledru
f0b8b33dc1 test: add support for -ef, -nt & -ot 2022-10-03 20:25:42 +02:00
Emil Suleymanov
a7b637b1eb
cp: assume --reflink=always on no value (#3992)
* Set reflink to auto by default
2022-10-03 20:20:55 +02:00
Sylvestre Ledru
63203a0a68 test: add -N FILE exists and has been modified since it was last read
Upstream: tests/misc/test-N.sh
2022-10-03 00:59:39 -10:00
Terts Diepraam
4b517a361d
Merge pull request #3959 from Joining7943/tail-reactivate-presume-input-pipe
tail: Reactivate ---presume-input-pipe option
2022-09-28 00:09:18 +02:00
Terts Diepraam
a3ba02a791
Merge pull request #3971 from niyaznigmatullin/cp_H_option
cp: add `-H` option
2022-09-25 15:16:37 +02:00
Terts Diepraam
9ce600ffa8
Merge pull request #3904 from cakebaker/pr_use_clap_for_help_and_version
pr: use clap to handle help & version
2022-09-25 14:10:00 +02:00
Niyaz Nigmatullin
84a741fe91 cp: add -H option, add tests, fix test 2022-09-23 20:31:24 +03:00
jfinkels
dd0daa5e06
df: remove trailing spaces in rightmost column (#3882)
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2022-09-22 08:37:20 +02:00
Jeffrey Finkelstein
60ca9a03bb mktemp: add message for directory not found
Add special handling in `mktemp` for when the directory that will
contain the temporary file is not found. This situation now produces
the message

    mktemp: failed to create file via template 'XXX': No such file or directory

to match the behavior of GNU mktemp.
2022-09-21 21:26:39 -04:00
Sylvestre Ledru
68ad9e4301
Merge pull request #3951 from jfinkels/mktemp-too-many-templates
mktemp: match GNU error message on too many args
2022-09-21 22:39:55 +02:00
Sylvestre Ledru
5a746a778f
Merge pull request #3938 from tertsdiepraam/dd-positional-args
`dd`: parse operands manually via positional args
2022-09-21 22:39:13 +02:00
Sylvestre Ledru
69b52b4a1b chroot: add a new test to verify that 'chroot / ls -al' works 2022-09-21 19:47:01 +02:00
Sylvestre Ledru
2e26e1d2bd chroot: implement --skip-chdir 2022-09-21 19:46:58 +02:00
Terts Diepraam
e377e4f046 dd: custom positional argument parsing 2022-09-21 18:41:12 +02:00
Joining7943
c32d61dcfb tests/tail: Add system tests for ---presume-input-pipe 2022-09-21 16:39:52 +02:00
Sylvestre Ledru
3654efe8e7 chroot: add more tests 2022-09-21 14:53:50 +02:00
Jeffrey Finkelstein
7b35749ea6 mktemp: match GNU error message on too many args
Update the usage message when too many template arguments are given on
the command line to match that of GNU mktemp:

    mktemp: too many templates
    Try 'mktemp --help' for more information.

This fixes the test case `too-many` in the GNU test suite file
`tests/misc/mktemp.pl`.
2022-09-21 10:02:56 +02:00
Sylvestre Ledru
a857002def
Merge pull request #3949 from niyaznigmatullin/cp-i_gnu_test
cp: fix `cp-i` GNU test
2022-09-18 22:06:12 +02:00
Terts Diepraam
8c839888e1
Merge pull request #3905 from Joining7943/refactor-tail
Refactor tail
2022-09-17 20:39:53 +02:00
Niyaz Nigmatullin
2ce999c959 cp: fix cp-i GNU test
`cp` in interactive mode used to write to stdout asking for
overwrite. GNU version writes to stderr.

Changed: write to stderr to make compatible with GNU.
2022-09-17 19:15:52 +03:00
Jeffrey Finkelstein
61345cbdc9 mktemp: respect TMPDIR environment variable
Change `mktemp` so that it respects the value of the `TMPDIR`
environment variable if no directory is otherwise specified in its
arguments. For example, before this commit

    $ TMPDIR=. mktemp
    /tmp/tmp.WDJ66MaS1T

After this commit,

    $ TMPDIR=. mktemp
    ./tmp.h96VZBhv8P

This matches the behavior of GNU `mktemp`.
2022-09-13 19:38:25 -04:00
Joining7943
951c51e740 tail: large refactoring and cleanup of the tail code base. See also #3905 for details 2022-09-13 22:54:36 +02:00
Sylvestre Ledru
78a9f6edf8
Merge pull request #3908 from tertsdiepraam/chroot-err-codes
`chroot`: set exit codes to 125, 126 or 127 for errors from chroot itself
2022-09-12 22:43:12 +02:00
Niyaz Nigmatullin
8bd9427d0d tests/ls: added exit code to some test failures 2022-09-12 19:47:16 +03:00
Daniel Hofstetter
ebbf8ade1e pr: use clap to handle help & version 2022-09-12 15:28:08 +02:00
Terts Diepraam
51bd8a2ba8 chroot: set exit codes to 125, 126 or 127 for errors from chroot itself 2022-09-11 12:02:54 +02:00
Terts Diepraam
9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Niyaz Nigmatullin
999db68042 pr: migrate from chrono crate to time
It seems that `chrono` is the reason of deadlock or UB in android
CI. Also `chrono` had some security issues and wasn't maintained for
two years until March 2022, so other unstabilities can happen. Plus
`chrono` uses old `time` dependency.
2022-09-09 21:59:08 +03:00
Niyaz Nigmatullin
0d6383dd19 test_cp: comment out bad syscall failing piece of code for Android 2022-09-09 16:12:05 +03:00
Joining7943
2658f8ae5b tail: improve performance of piped stdin
Rewrite handling of stdin when it is piped and read input in chunks.

Fixes https://github.com/uutils/coreutils/issues/3842
2022-09-09 13:51:37 +02:00
Sylvestre Ledru
a8d1d73465 fix a test on cp counting the number of fd:
The testsuite runs in parallel, we have pipe, sockets
opened by other tests.
So, we take in account the various fd to increase the limit
2022-09-07 21:26:03 +02:00
Jan Scheer
88d3aee71c tail: fix offset for stdin redirect if multiple input files 2022-09-05 10:09:04 +02:00
Jan Scheer
74f359bd76 tail: use same-file crate to get a handle of stdin redirected file 2022-09-05 10:09:04 +02:00
Jan Scheer
942928b0ea tail: fix stdin redirect when file is not at its beginning
Previously, if stdin redirect pointed to a regular file,
tailing started at the beginning of the file. However,
tailing needs to start at the current position because this
is expected by tests/tail-2/start-middle.sh.

This fixes the issue by taking the current offset into account
while going backwards through the stdin redirected file.
2022-09-05 10:09:04 +02:00
Jan Scheer
92c3f60440 tail: fix stdin redirect (#3842)
This fixes a bug where calling `tail - < file.txt` would result
in invoking `unbounded_tail()`.
However, it is a stdin redirect to a seekable regular file and
therefore `bounded_tail` should be invoked as if `tail file.txt` had
been called.
2022-09-05 10:09:04 +02:00
Sylvestre Ledru
282774a3ef
Merge pull request #3853 from stefins/rm-write-protected
rm: added write-protected check for files
2022-08-29 17:03:24 +02:00
Owen Anderson
08d3da8f6c
Fix a TODO by making conv_block_unblock_helper consume the input. (#3787)
* Fix a TODO by making `conv_block_unblock_helper` consume the input.
2022-08-28 10:07:04 +02:00
Stefin
4c1c9ebf89 rm: change InteractiveMode::Default to InteractiveMode::PromptProtected
Signed-off-by: Stefin <stefin@pm.me>
2022-08-27 19:38:10 +05:30
Tavo Annus
09cfa44560 Fix tail panicing when seeking backwards
Previously `tail -c n file.txt` caused panic if n > sizeof file.txt.
Now it prints out whole file similarly to GNU tail.
2022-08-24 21:02:47 +03:00