Commit graph

9081 commits

Author SHA1 Message Date
Jeffrey Finkelstein
6167de903e cp: restrict permissions when copying FIFO
When copying the contents of a named pipe (also known as a FIFO) via

    cp --preserve=ownership --copy-contents fifo fifo-copy

limit the permissions of the destination file while the contents are
being copied, and then restore the permissions to match those of the
source FIFO when all contents have been copied successfully.
2022-12-03 18:30:47 -05:00
jfinkels
4a4bb550e1
Merge pull request #3653 from jfinkels/dd-concise-byte-counts
dd: correct rendering of SI and IEC byte counts
2022-12-03 11:48:19 -05:00
Jeffrey Finkelstein
3a5b31a30f dd: correct rendering of SI and IEC byte counts
Adjust the rendering of the concise byte counts in both SI and IEC
units to better match the behavior of GNU dd.

Before this commit,

    $ head -c 1024 /dev/zero | dd > /dev/null
    2+0 records in
    2+0 records out
    1024 bytes (1 KB, 1024 B) copied, 0.0 s, 1.0 MB/s

After this commit,

    $ head -c 1024 /dev/zero | dd > /dev/null
    2+0 records in
    2+0 records out
    1024 bytes (1.0 kB, 1.0 KiB) copied, 0.0 s, 1.0 MB/s

For comparison, GNU dd produces the following:

    $ head -c 1024 /dev/zero | dd > /dev/null
    2+0 records in
    2+0 records out
    1024 bytes (1.0 kB, 1.0 KiB) copied, 0.000332864 s, 3.1 MB/s
2022-12-03 10:14:00 -05:00
Sylvestre Ledru
3880b463fe
Merge pull request #4185 from jfinkels/uucore-sprintf-2
uucore: add sprintf() function
2022-12-03 10:21:09 +01:00
Sylvestre Ledru
75502aba93
Merge pull request #4136 from Joining7943/tail-test-runner
`tests/common/util`: Implement UChild, an abstraction for std::process::Child, to return UChild from run_no_wait instead
2022-12-03 10:18:25 +01:00
Sylvestre Ledru
818012e30b
Merge pull request #4193 from jfinkels/touch-relative-time
touch: add support for some relative times
2022-12-03 10:16:21 +01:00
Sylvestre Ledru
8e5d374ec2
Merge pull request #4197 from tertsdiepraam/cleanup-uucore-process
`uucore/process`: remove custom `ExitStatus`
2022-12-03 10:15:48 +01:00
Sylvestre Ledru
2facffa489
Merge pull request #4208 from jfinkels/cp-preserve-link
cp: preserve hard links when target already exists
2022-12-03 10:15:22 +01:00
Jeffrey Finkelstein
66ee373373 cp: preserve hard links when target already exists
Prevent a panic in `cp -a` when the target of a hard link already
exists in the target directory structure.

For example,

    $ mkdir -p src dest/src
    $ touch src/f dest/src/f
    $ ln src/f src/link
    $ cp -a src dest

The `cp` command now succeeds without error.
2022-12-02 23:50:18 -05:00
Joining7943
4a2ced5940 tests: Adjust some tests to use improved UChild. test_tac: Ignore pipe tests on windows.
Summary:
* Disable test_retry6 on android because of intermittent failures
* Use wait() instead of wait_with_output in test_cat, test_cp, test_sort
* tests/sort: Simplify usage of test_sigpipe_panic
* Fix tests in test_tee.

tests/tac:
There was a change in the `tests/common/util.rs` test api concerning piped input which may have
revealed a bug in the implementation of tac. Please see also
https://github.com/uutils/coreutils/pull/4136
2022-12-02 13:13:10 +01:00
Terts Diepraam
dc828fed2d uucore/process: remove custom ExitStatus 2022-12-02 12:25:14 +01:00
Sylvestre Ledru
3ca6139e0f
Merge pull request #4158 from tertsdiepraam/markdown-in-docs-v1
Markdown in docs v1
2022-12-02 09:39:33 +01:00
Joining7943
4f54eedb74 tests/util: Improve UChild. Cleanup redundant functions in util.rs.
A short summary of changes:

* Add some basic tests for UChild and the run methods.
* Try more often in a fixed interval to create the tempfile for CapturedOutput.
* Fix drop order of struct fields for better cleanup of temporary files/dirs.
* Mark UChild::wait_with_output and UChild::pipe_in_and_wait_with_output deprecated
* Make CapturedOutput private
* Panic in stdout_all, stdout_all_bytes etc. if output is not captured.
* Rename some methods, refactor, clean up, fix documentation, add try_... methods
2022-12-02 08:06:48 +01:00
Joining7943
982fb682e9 tests: Use UChild in tests. Rename run_no_wait_child to run_no_wait and return UChild
tests/tail:
* test_stdin_redirect_file:. Test fails now when assert_alive()!
The follow test `tail -f < file` where file's content is `foo` fails with:
    Assertion failed. Expected 'tail' to be running but exited with status=exit status: 0

I also tried on the command line and can confirm that tail isn't runnning when following by
descriptor. The test is deactivated until the implementation is fixed.

* test_follow_stdin_descriptor
* test_follow_stdin_explicit_indefinitely.
* test_follow_single
* test_follow_non_utf8_bytes
* test_follow_multiple
* test_follow_name_multiple
* test_follow_invalid_pid
* test_single_big_args
* test_retry3
* test_retry4
* test_retry5
* test_retry7
* test_retry8
* test_retry9
* test_follow_descriptor_vs_rename1
* test_follow_descriptor_vs_rename2
* test_follow_name_retry_headers
* test_follow_name_remove
* test_follow_name_truncate1
* test_follow_name_truncate2
* test_follow_name_truncate3
* test_follow_name_truncate4
* test_follow_truncate_fast
* test_follow_name_move_create1
* test_follow_name_move_create2
* test_follow_name_move1
* test_follow_name_move2
* test_follow_name_move_retry1
* test_follow_name_move_retry2
* test_follow_inotify_only_regular
* test_fifo
* test_illegal_seek

tests/cat:
* test_dev_full
* test_dev_full_show_all
* test_dev_random
* test_fifo_symlink

tests/dd:
* test_random_73k_test_lazy_fullblock
* test_sync_delayed_reader

tests/factor:
* test_parallel

tests/rm:
* test_rm_force_prompts_order
* test_rm_descend_directory
* test_rm_prompts

tests/seq:
* the helper run method

tests/sort:
* test_sigpipe_panic

tests/tee:
* the helper run_tee method

tests/tty:
* test_tty module

tests/yes:
* the helper run method
2022-12-02 08:06:45 +01:00
Joining7943
040a5e8301 tests/util: Implement UChild. UCommand: implement stderr_to_stdout, capture output as default
See pr #4136 (https://github.com/uutils/coreutils/pull/4136)
2022-12-02 08:05:05 +01:00
Joining7943
9b446bf261 tests/tail: Fix clippy warning same-item-push. Do not push same flag twice. 2022-12-02 08:05:05 +01:00
Jeffrey Finkelstein
d083fa19c2 uucore: add sprintf() function
Add an `sprintf()` function (and `printf()` function) to
`uucore::memo`.  The `sprintf()` function behaves roughly like the
standard Rust `format!()`, but follows our implementation of the GNU
`printf` formatting logic instead.
2022-12-02 07:48:36 +01:00
Sylvestre Ledru
403780a613
Merge pull request #4196 from cakebaker/cut_remove_unnecessary_return_type
cut: remove unnecessary return type
2022-12-02 07:47:49 +01:00
Sylvestre Ledru
3f43e7d1ea
Merge pull request #4202 from cakebaker/string_new
chore: standardize creation of empty strings
2022-12-02 07:47:27 +01:00
Daniel Hofstetter
05d12892f3 CI: enable manual_string_new lint 2022-12-01 13:49:23 +01:00
Daniel Hofstetter
6cc470920f numfmt: derive default impl for FormatOptions 2022-12-01 13:49:23 +01:00
Daniel Hofstetter
9a2174ba02 chore: standardize creation of empty strings 2022-12-01 13:49:23 +01:00
Terts Diepraam
efa0fd498b
Merge pull request #4179 from djedi23/verbose_and_progress
Suspend the progress bar before printing the copied files.
2022-11-30 13:19:58 +01:00
Terts Diepraam
558314e822
Merge pull request #4200 from uutils/sylvestre-patch-2
Move the dependabot to weekly
2022-11-30 12:32:39 +01:00
Sylvestre Ledru
46b7019ddf
Merge pull request #4195 from uutils/dependabot/cargo/clap_complete-4.0.6
build(deps): bump clap_complete from 4.0.5 to 4.0.6
2022-11-30 08:39:20 +01:00
Sylvestre Ledru
033969cf8f
Merge pull request #4181 from cakebaker/split_backticks_are_unbalanced
split: fix "backticks are unbalanced" warnings
2022-11-30 08:38:30 +01:00
Sylvestre Ledru
5efdc51609
Merge pull request #4191 from jfinkels/dd-sparse
dd: correctly set file size when conv=sparse
2022-11-30 08:38:09 +01:00
Terts Diepraam
b632ba8ff6 numfmt: update help to markdown syntax 2022-11-29 22:54:41 +01:00
Terts Diepraam
bcf3b852c6 expr: update help to markdown syntax 2022-11-29 22:54:41 +01:00
Terts Diepraam
e155a5ea6d uudoc: support after_help and read directly from markdown file 2022-11-29 22:54:41 +01:00
Moïse Valvassori
8b30ead588 add comment to the pregress bar suspension. 2022-11-29 22:54:07 +01:00
Moïse Valvassori
1b004053ac Suspend the progress bar before printing the copied files. 2022-11-29 22:54:07 +01:00
Daniel Hofstetter
ac1790c69e split: fix "backticks are unbalanced" warnings 2022-11-29 22:53:56 +01:00
Jeffrey Finkelstein
9632db4f86 dd: correctly set file size when conv=sparse
Before this commit, if `sparsefile` were a regular file of non-zero
size whose contents are all null bytes, then

    dd if=sparsefile of=outfile conv=notrunc

would have resulted in `outfile` having zero size as reported by
`stat`. After this commit, `outfile` will have the same size as
`sparsefile` (even if the contents are represented sparsely by the
filesystem).
2022-11-29 22:53:18 +01:00
Jeffrey Finkelstein
a396ebd883 touch: add support for some relative times
For example,

    $ touch -d +1 days

Fixes #3964.
2022-11-29 22:53:13 +01:00
dependabot[bot]
f0e0404496 build(deps): bump clap_complete from 4.0.5 to 4.0.6
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.0.5 to 4.0.6.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.0.5...clap_complete-v4.0.6)

---
updated-dependencies:
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 22:53:03 +01:00
Daniel Hofstetter
be7717b2d0 cut: remove unnecessary return type 2022-11-29 22:52:58 +01:00
Sylvestre Ledru
4cada56e78 Move the dependabot to weekly
We don't need to move that fast
2022-11-29 22:51:58 +01:00
Sylvestre Ledru
e307f624e8
Merge pull request #4201 from niyaznigmatullin/ubuntu-20.04_for_GNUTests
gnu-tests: rollback to `ubuntu-20.04` for gnu-tests until fixed
2022-11-29 22:51:42 +01:00
Niyaz Nigmatullin
328b387dbd gnu-tests: rollback to ubuntu-20.04 for gnu-tests until it fixed 2022-11-29 18:43:12 +02:00
Sylvestre Ledru
27958a27ef
Merge pull request #4159 from sylvestre/issue_3780
date: add a test for the issue 3780 to make sure we don't regress
2022-11-27 18:24:07 +01:00
Sylvestre Ledru
96fab62421
Merge pull request #4182 from cakebaker/ci_remove_python_pyinotify_dependency
CI: change python-pyinotify to python3-pyinotify
2022-11-26 13:36:52 +01:00
Daniel Hofstetter
f079c7aa80 CI: change python-pyinotify to python3-pyinotify 2022-11-24 15:30:02 +01:00
Sylvestre Ledru
af804df9a2
Merge pull request #4166 from miles170/issue-4080-cp-fails-on-mac
cp: fix `cp --force --backup f f` fails on macOS
2022-11-21 21:13:35 +01:00
Sylvestre Ledru
aa0c00aeb2
Merge pull request #4174 from niyaznigmatullin/cargo_update
deps: bump `textwrap` to `0.16` and `cargo +1.60.0 update`
2022-11-21 15:35:58 +01:00
Niyaz Nigmatullin
fd42953984 deny: modify duplicate packages 2022-11-21 10:46:59 +02:00
Niyaz Nigmatullin
7ca3f0b338 deps: bump textwrap to 0.16 and cargo +1.60.0 update 2022-11-21 10:40:44 +02:00
Sylvestre Ledru
1fccafe2b1
Merge pull request #4170 from sylvestre/deny
Remove some old and unused info from cargo-deny
2022-11-21 09:27:53 +01:00
Sylvestre Ledru
bdd67b7203 Remove some old and unused info from cargo-deny 2022-11-20 20:35:44 +01:00
Sylvestre Ledru
9e859e98c1
Merge pull request #4168 from sylvestre/lscolors
update lscolors to switch to nu_ansi_term
2022-11-20 20:35:21 +01:00