Commit graph

8073 commits

Author SHA1 Message Date
Andrew Baptist
f2cfc15a70 split: Don't overwrite files
Check that a file exists by calling create_new and changing the
interface of instantiate_current_writer to return a Result rather
than calling unwrap.
2022-07-21 12:06:13 -04:00
Owen Anderson
735db78b3d
wc: specialize scanning loop on settings. (#3708)
* wc: specialize scanning loop on settings.

The primary computational loop in wc (iterating over all the
characters and computing word lengths, etc) is configured by a
number of boolean options that control the text-scanning behavior.
If we monomorphize the code loop for each possible combination of
scanning configurations, the rustc is able to generate better code
for each instantiation, at the least by removing the conditional
checks on each iteration, and possibly by allowing things like
vectorization.

On my computer (aarch64/macos), I am seeing at least a 5% performance
improvement in release builds on all wc flag configurations
(other than those that were already specialized) against
odyssey1024.txt, with wc -l showing the greatest improvement at 15%.

* Reduce the size of the wc dispatch table by half.

By extracting the handling of hand-written fast-paths to the
same dispatch as the automatic specializations, we can avoid
needing to pass `show_bytes` as a const generic to
`word_count_from_reader_specialized`. Eliminating this parameter
halves the number of arms in the dispatch.
2022-07-18 12:16:52 +02:00
Sylvestre Ledru
189a8af450
Merge pull request #3721 from niyaznigmatullin/add_test_for_issue_3332
tests/cp: add test for cp-parents.sh
2022-07-18 12:11:30 +02:00
Sylvestre Ledru
6248afed68
Merge pull request #3725 from uutils/dependabot/cargo/nix-0.24.2
build(deps): bump nix from 0.24.1 to 0.24.2
2022-07-18 12:11:07 +02:00
dependabot[bot]
d15b95533e
build(deps): bump nix from 0.24.1 to 0.24.2
Bumps [nix](https://github.com/nix-rust/nix) from 0.24.1 to 0.24.2.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/v0.24.2/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.24.1...v0.24.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-18 06:41:18 +00:00
Sylvestre Ledru
fbe22497ff
Merge pull request #3724 from niyaznigmatullin/ln_same_file_on_force
ln: symlink --force, src and dst are same file
2022-07-18 08:29:44 +02:00
Niyaz Nigmatullin
0ab0f2761f tests/ln: add test for same file 2022-07-18 08:17:37 +03:00
Niyaz Nigmatullin
4db08273b3 ln: error on --force when src=dst and dst is regular file 2022-07-18 08:17:37 +03:00
Sylvestre Ledru
ef6182d209
Merge pull request #3723 from niyaznigmatullin/add_issue_3722_test
tests/rm: add test for issue #3722
2022-07-17 23:41:05 +02:00
Niyaz Nigmatullin
028c08cce2 tests/rm: add test for issue #3722 2022-07-17 23:34:04 +03:00
Niyaz Nigmatullin
147f83f68a tests/cp: add test for cp-parents.sh 2022-07-17 23:04:09 +03:00
Niyaz Nigmatullin
0ea3a735ca
readlink: symlink loop handling (#3717)
readlink: fix symlink loop handling
2022-07-14 22:32:55 +02:00
Sylvestre Ledru
882cd527ff
Merge pull request #3704 from Sciencentistguy/once_cell
Replace lazy_static with once_cell
2022-07-13 16:15:47 +02:00
Sylvestre Ledru
8938b1f9e1
Merge pull request #3716 from cakebaker/numfmt_reject_suffix
numfmt: reject suffix if unit is "none"
2022-07-13 16:14:43 +02:00
Daniel Hofstetter
9e44acf307 numfmt: reject suffix if unit is "none" 2022-07-13 10:47:59 +02:00
Sylvestre Ledru
db2e5fc6ec
Merge pull request #3714 from niyaznigmatullin/canonicalize_windows_symlink_loop_looking
canonicalize: Loop looking in windows
2022-07-13 10:36:18 +02:00
Sylvestre Ledru
4b27776237
Merge pull request #3713 from cakebaker/numfmt_missing_i_suffix
numfmt: show error if "i" suffix is missing
2022-07-13 10:35:22 +02:00
Sylvestre Ledru
073c432e5e
Merge pull request #3715 from uutils/dependabot/github_actions/vmactions/freebsd-vm-0.1.7
build(deps): bump vmactions/freebsd-vm from 0.1.6 to 0.1.7
2022-07-13 10:34:55 +02:00
dependabot[bot]
2e39f6faf2
build(deps): bump vmactions/freebsd-vm from 0.1.6 to 0.1.7
Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 0.1.6 to 0.1.7.
- [Release notes](https://github.com/vmactions/freebsd-vm/releases)
- [Commits](https://github.com/vmactions/freebsd-vm/compare/v0.1.6...v0.1.7)

---
updated-dependencies:
- dependency-name: vmactions/freebsd-vm
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-13 06:41:10 +00:00
Niyaz Nigmatullin
c829ecfd1d uucore/fs: get back to loop looking in windows as FileInformation
for directory is fixed
2022-07-12 17:15:16 +03:00
Jamie Quigley
1a270361c0
Replace lazy_static with once_cell 2022-07-12 14:08:30 +01:00
Daniel Hofstetter
aef24db90f numfmt: show error if "i" suffix is missing 2022-07-12 10:58:07 +02:00
Niyaz Nigmatullin
de65d4d649
Realpath relative options (#3710)
* realpath: introduce relative options, make correct exit codes, make pass
GNU test mist/realpath.sh
2022-07-12 08:29:20 +02:00
Terts Diepraam
6b00aec48e
Merge pull request #3602 from lendandgit/main
df: better error message when executed in a chroot without /proc #3601
2022-07-11 23:02:39 +02:00
Sylvestre Ledru
e239ed9417
Merge pull request #3692 from jfinkels/cp-preserve-perm-link
cp: correctly copy attributes of a dangling symbolic link
2022-07-11 22:50:24 +02:00
Sylvestre Ledru
8074020a8b
Merge pull request #3705 from cakebaker/numfmt_unit
numfmt: implement "--to-unit" & "--from-unit"
2022-07-11 22:46:56 +02:00
Niyaz Nigmatullin
da5808d4ac
ls: add already listed message (#3707)
* ls: handle looping symlinks infinite printing

* ls: better coloring and printing symlinks when dereferenced

* tests/ls: add dereferencing and symlink loop tests

* ls: reformat changed using rustfmt

* ls: follow clippy advice for cleaner code

* uucore/fs: fix FileInformation to open directory handles in Windows as
well
2022-07-11 17:18:58 +02:00
Sylvestre Ledru
8f4a3266a4
Merge pull request #3709 from uutils/dependabot/cargo/memmap2-0.5.5
build(deps): bump memmap2 from 0.5.4 to 0.5.5
2022-07-11 10:37:05 +02:00
dependabot[bot]
7be2139919
build(deps): bump memmap2 from 0.5.4 to 0.5.5
Bumps [memmap2](https://github.com/RazrFalcon/memmap2-rs) from 0.5.4 to 0.5.5.
- [Release notes](https://github.com/RazrFalcon/memmap2-rs/releases)
- [Changelog](https://github.com/RazrFalcon/memmap2-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.4...v0.5.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 06:40:50 +00:00
Niyaz Nigmatullin
9d285e953d
Realpath symlinks handling, solves issue #3669 (#3703) 2022-07-10 16:49:25 +02:00
Daniel Hofstetter
1f292dd834 numfmt: implement "--to-unit" & "--from-unit" 2022-07-09 08:01:27 +02:00
Sylvestre Ledru
392ae87a9f
Merge pull request #3700 from cakebaker/comm_enable_output_delimiter_test
comm: enable "output_delimiter" test
2022-07-08 18:41:51 +02:00
Sylvestre Ledru
05823dd619
Merge pull request #3656 from eds-collabora/eds/tee_p
Implement tee -p
2022-07-08 18:41:34 +02:00
Sylvestre Ledru
25f84da10d
Merge pull request #3699 from uutils/dependabot/cargo/regex-1.6.0
build(deps): bump regex from 1.5.6 to 1.6.0
2022-07-08 18:40:43 +02:00
leon
de4cfdbea6 stat: improved error message 2022-07-07 15:24:00 +02:00
leon
97998a64dd df: removed unused import 2022-07-07 15:24:00 +02:00
leon
388e14f208 df: error handling cleanup 2022-07-07 15:24:00 +02:00
leon
72b0ba0b05 df: fixed clippy warning 2022-07-07 15:24:00 +02:00
leon
9d554751ca df: better error message when executed in a chroot without /proc #3601 2022-07-07 15:24:00 +02:00
Ed Smith
607bf3ca4d Terminate on elimination of all writers in tee
tee is supposed to exit when there is nothing left to write to. For
finite inputs, it can be hard to determine whether this functions
correctly, but for tee of infinite streams, it is very important to
exit when there is nothing more to write to.
2022-07-07 15:23:50 +02:00
Ed Smith
5c13e88f8b Do not trap pipe errors in yes
This is part of fixing the tee tests. 'yes' is used by the GNU test
suite to identify what the SIGPIPE exit code is on the target
platform. By trapping SIGPIPE, it creates a requirement that other
utilities also trap SIGPIPE (and exit 0 after SIGPIPE). This is
sometimes at odds with their desired behaviour.
2022-07-07 15:23:50 +02:00
Ed Smith
7a961a94a5 Preserve signal exit statuses in timeout
When the monitored process exits, the GNU version of timeout will
preserve its exit status, including the signal state.

This is a partial fix for timeout to enable the tee tests to pass.  It
removes the default Rust trap for SIGPIPE, and kill itself with the
same signal as its child exited with to preserve the signal state.
2022-07-07 15:23:50 +02:00
Ed Smith
a360504574 Implement tee -p and --output-error
This has the following behaviours. On Unix:

- The default is to exit on pipe errors, and warn on other errors.

- "--output-error=warn" means to warn on all errors

- "--output-error", "--output-error=warn-nopipe" and "-p" all mean
  that pipe errors are suppressed, all other errors warn.

- "--output-error=exit" means to warn and exit on all errors.

- "--output-error=exit-nopipe" means to suppress pipe errors, and to
  warn and exit on all other errors.

On non-Unix platforms, all pipe behaviours are ignored, so the default
is effectively "--output-error=warn" and "warn-nopipe" is identical.
The only meaningful option is "--output-error=exit" which is identical
to "--output-error=exit-nopipe" on these platforms.

Note that warnings give a non-zero exit code, but do not halt writing
to non-erroring targets.
2022-07-07 15:23:50 +02:00
Sylvestre Ledru
922afa29ff
Merge branch 'main' into cp-preserve-perm-link 2022-07-07 15:22:57 +02:00
dependabot[bot]
ea503bf633 build(deps): bump regex from 1.5.6 to 1.6.0
Bumps [regex](https://github.com/rust-lang/regex) from 1.5.6 to 1.6.0.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.5.6...1.6.0)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-07 15:22:48 +02:00
Daniel Hofstetter
249b398906 comm: enable "output_delimiter" test 2022-07-07 15:22:43 +02:00
Sylvestre Ledru
37b754f462
Build & install grcov ourselves + force the version of crossbeam-epoch (#3702)
Fixes:
https://github.com/uutils/coreutils/issues/3680
https://github.com/mozilla/grcov/issues/849
2022-07-07 15:21:39 +02:00
Sylvestre Ledru
2f46e4020d
Merge pull request #3701 from cakebaker/comm_nul_delimiter
comm: use NUL if delimiter is empty
2022-07-06 22:57:25 +02:00
Daniel Hofstetter
ac35a1b985 comm: use NUL if delimiter is empty 2022-07-06 13:50:23 +02:00
Sylvestre Ledru
450bd3b597
Remove the is_symlink function 2022-07-06 11:18:31 +02:00