Commit graph

7326 commits

Author SHA1 Message Date
Jeffrey Finkelstein
0a226524a6 split: elide all chunks when input file is empty
Fix a bug in the behavior of `split -e -n NUM` when the input file is
empty. Previously, it would panic due to overflow when subtracting 1
from 0. After this change, it will terminate successfully and produce
no output chunks.
2022-03-19 14:32:28 -04:00
Jeffrey Finkelstein
6d2eff9c27 split: catch and handle broken pipe errors
Catch `BrokenPipe` errors and silently ignore them so that `split`
terminates successfully on a broken pipe. This matches the behavior of
GNU `split`.
2022-03-19 12:11:03 -04:00
Terts Diepraam
ee1ae64970 bump textwrap to 0.15 2022-03-19 16:28:21 +01:00
Terts Diepraam
76edba0e1e Merge branch 'unittests-in-ci' of github.com:tertsdiepraam/coreutils into unittests-in-ci 2022-03-19 10:58:59 +01:00
Terts Diepraam
094bb61a63 fxi tests for unittests in dd and hashsum 2022-03-19 10:58:45 +01:00
Terts Diepraam
971f817a95 fix unittests not running in CI 2022-03-19 09:30:49 +01:00
Sylvestre Ledru
3c88fb460b
Merge branch 'main' into dependabot/cargo/clap-3.1.6 2022-03-19 09:26:05 +01:00
Sylvestre Ledru
ad237f8fff
Merge pull request #3267 from sylvestre/gnu-size
GNU ci: compress logs before upload
2022-03-19 09:25:25 +01:00
Sylvestre Ledru
01da0171b5
Merge pull request #3272 from jfinkels/uucore-parse-time-overflow
uucore, sleep: use Duration::saturating_mul and saturating_add to avoid overflow
2022-03-19 09:24:03 +01:00
Sylvestre Ledru
ca72f2b454
Merge pull request #3265 from bnjbvr/setup-cargo-deny
Setup `cargo-deny`
2022-03-19 09:22:27 +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
Daniel Hofstetter
50c6599a32 df: omit reserved filesystem blocks in "Available"
fixes #3251
2022-03-18 20:45:15 +01:00
Sylvestre Ledru
cb576effc2 GNU ci: compress logs before upload 2022-03-18 20:45:12 +01:00
Daniel Hofstetter
ac8dcb6bd3 df: remove unused "--direct" option 2022-03-18 20:45:09 +01:00
chordtoll
a84202ee00 Combine 4 duplicate seek/skip parsing functions into one 2022-03-18 20:45:04 +01:00
chordtoll
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
Benjamin Bouvier
709a921959 Try to please spellcheck? 2022-03-18 20:44:01 +01:00
Benjamin Bouvier
d855dbca81 add note to CONTRIBUTING.md 2022-03-18 20:44:01 +01:00
Benjamin Bouvier
6a907b69c2 cargo deny --all-features check all 2022-03-18 20:44:01 +01:00
Benjamin Bouvier
323f0ef993 Setup cargo-deny in CI too 2022-03-18 20:44:01 +01:00
Benjamin Bouvier
312068c2dd Add cargo-deny configuration 2022-03-18 20:44:01 +01:00
Benjamin Bouvier
65f94c9d39 Remove duplicate paste dependency 2022-03-18 20:44:01 +01:00
Sylvestre Ledru
8c36558871
Merge pull request #3269 from uutils/revert-3205-split-round-robin
Revert "split: implement round-robin arg to --number"
2022-03-18 20:43:04 +01:00
Terts Diepraam
a4737c0b50 fix unittests not running in CI 2022-03-18 20:15:14 +01:00
Sylvestre Ledru
9796e01df6
Revert "split: implement round-robin arg to --number" 2022-03-18 14:45:29 +01:00
Terts Diepraam
04de1251dd
Merge branch 'main' into dependabot/cargo/clap-3.1.6 2022-03-18 09:54:04 +01:00
Benjamin Bouvier
ba5b2dc2ed
Remove unused dependencies by individual crates (#3264) 2022-03-17 22:48:17 +01:00
Terts Diepraam
20212be4c8 fix clippy errors related to clap upgrade from 3.0.10 to 3.1.6 2022-03-17 22:46:56 +01:00
dependabot[bot]
59440d35c0
build(deps): bump clap from 3.0.10 to 3.1.6
Bumps [clap](https://github.com/clap-rs/clap) from 3.0.10 to 3.1.6.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.0.10...v3.1.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 13:06:29 +00:00
Sylvestre Ledru
a5948ce11b
Merge pull request #3155 from jtracey/gecos-off-by-one
pinky: fix off-by-one in GECOS parsing
2022-03-17 13:35:05 +01:00
Sylvestre Ledru
7e05833b96
Merge pull request #3205 from jfinkels/split-round-robin
split: implement round-robin arg to --number
2022-03-16 12:35:00 +01:00
Sylvestre Ledru
161db4cdd7
Merge pull request #3259 from jfinkels/df-loops
df: separate functions for two main modes of df
2022-03-16 12:00:36 +01:00
Sylvestre Ledru
45cf7d51d8
Merge pull request #3261 from dgunay/linebreak-pow-optimization
fmt: use powi instead of powf
2022-03-16 12:00:02 +01:00
Sylvestre Ledru
b84ff35766
Add canonicalized to the ignore spell list 2022-03-16 09:16:01 +01:00
Devin Gunay
b277aa235a use powi instead of unnecessary powf
clippy::suboptimal_flops found a few unnecessary usages of powf (powi is faster)
2022-03-16 00:37:29 -07:00
Jeffrey Finkelstein
f4ca963dca df: separate functions for two main modes of df
Split the code for getting a list of `Filesystem` objects into two
separate functions: one for getting the list of all filesystems (when
running `df` with no arguments) and one for getting only named
filesystems (when running `df` with one or more arguments). This does
not change the behavior of `df` only the organization of the code.
2022-03-15 22:06:55 -04:00
Jeffrey Finkelstein
6f3dcf5998 df: add Filesystem::from_path() function
Add the `Filesystem::from_path()` function which produces the
filesystem on which a given path is mounted. The `Filesystem` is taken
from a list of candidate `MountInfo` objects.
2022-03-15 21:56:39 -04:00
Jeffrey Finkelstein
6371eb8298 df: use for loop over filesystems to display rows
Replace a loop over `Row` objects with a loop over `Filesystem`
objects when it comes time to display each row of the output
table. This helps with code structure, since the `Filesystem` is the
primary object of interest in the `df` program. This makes it easier
for us to independently vary how the list of filesystems is produced
and how the list of filesystems is displayed.
2022-03-15 19:43:28 -04:00
Jeffrey Finkelstein
18bfd1ac68 split: implement round-robin arg to --number
Implement distributing lines of a file in a round-robin manner to a
specified number of chunks. For example,

    $ (seq 1 10 | split -n r/3) && head -v xa[abc]
    ==> xaa <==
    1
    4
    7
    10

    ==> xab <==
    2
    5
    8

    ==> xac <==
    3
    6
    9
2022-03-15 18:22:44 -04:00
kimono-koans
fa6af85b8e
ls: Fix display of inodes and add allocation size feature (#3052) 2022-03-15 16:27:43 +01:00
Sylvestre Ledru
748d414946
Merge pull request #3258 from cakebaker/fix_exclude_type_panic
df: fix panic when using -x argument (#3257)
2022-03-15 16:24:15 +01:00
Sylvestre Ledru
9dea9b4b83
Merge branch 'main' into mkdir-fix 2022-03-15 12:03:47 +01:00
Sylvestre Ledru
42dd19ca7f
Merge pull request #3101 from refi64/cp-dest-symlink
cp: Avoid following a destination symlink with -P
2022-03-15 08:16:52 +01:00
Ryan Gonzalez
2dc3d867d8 cp: Avoid following a destination symlink with -P
Previously, given 'cp -P a b', where 'a' and 'b' were both symlinks, cp
would end up replacing the target of 'b'.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2022-03-14 17:49:42 -05:00
Daniel Hofstetter
433504949d df: fix panic when using -x argument (#3257)
Also allow multiple '-x' options
2022-03-14 10:32:42 +01:00
Sylvestre Ledru
8f97283cf3
Merge pull request #3253 from jfinkels/df-filesystem-module-3
df: move Filesystem to filesystem.rs
2022-03-14 09:59:28 +01:00
Sylvestre Ledru
dd6d29f389
Merge pull request #3248 from sylvestre/nproc
nproc: Improve the GNU compat
2022-03-14 08:32:40 +01:00
Sylvestre Ledru
9be49b1bbd
Merge pull request #3255 from sylvestre/field
ci: rename of the tracking size field to match the tracking project
2022-03-13 22:40:27 +01:00