Commit graph

7350 commits

Author SHA1 Message Date
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
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
Sylvestre Ledru
0571434a75 ci: rename of the tracking size field to match the tracking project 2022-03-13 21:03:40 +01:00
Jeffrey Finkelstein
b81f4ef6a7 df: add documentation comments for filesystem.rs 2022-03-13 14:30:15 -04:00
Jeffrey Finkelstein
2fac674317 df: move Filesystem to filesystem.rs
Move the `Filesystem` struct into a new module `filesystem.rs`.
2022-03-13 14:30:14 -04:00
Sylvestre Ledru
24b4af768c nproc: Improve the support of OMP_NUM_THREADS 2022-03-13 18:33:16 +01:00
Sylvestre Ledru
d6dad9f412
Merge pull request #3250 from jfinkels/df-remove-fs-selector
df: remove use of FsSelector abstraction
2022-03-13 18:17:49 +01:00
Sylvestre Ledru
c957efe7b5
Merge pull request #3249 from jfinkels/timeout-return-values
timeout: fix bug in --preserve-status mode
2022-03-13 18:17:23 +01:00
Jeffrey Finkelstein
81e2de498a df: remove use of FsSelector abstraction
Remove the use of the `FsSelector` struct when deciding whether a
filesystem type should be included or excluded from the output
table. Instead, just maintain optional `Vec`s of filesystem types to
exclude and include, and check whether the filesystem type is
contained in one of those. This reduces the amount of code required to
implement these checks, and since the number of types given in the
`include` or `exclude` lists is likely to be small, there should not
be much of a difference in performance.
2022-03-12 20:52:40 -05: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
Jeffrey Finkelstein
2d390233fe timeout: add ExitStatus enumeration
Add the `ExitStatus` enumeration in a new module `status.rs` to
contain all the magic numbers in the `timeout` utility.
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
OHNONOTAMOTH
094198b22a
Consistent tempfile crate declaration (version 3) (#3244) 2022-03-12 09:40:23 +01:00
Sylvestre Ledru
2c10ddf3f4
Merge pull request #3243 from jfinkels/timeout-restructure
timeout: refactor helper func for wait-then-signal
2022-03-12 09:38:05 +01:00
Sylvestre Ledru
0bc6f7b9ba
Merge pull request #3245 from jfinkels/df-fix-internal-tests
df: fix tests of internal helper functions
2022-03-12 09:37:29 +01:00
Jeffrey Finkelstein
9fae445ca9 df: fix tests of internal helper functions
Fix unit tests for the `is_included()` and `filter_mount_list()`
internal helper functions. The function signatures changed but the
tests did not get updated to match.
2022-03-11 22:52:17 -05:00
Jeffrey Finkelstein
a0eed2405c timeout: refactor helper func for wait-then-signal
Factor a helper function `wait_or_kill_process()` out of the main
`timeout()` function. This helper function contains the code to wait
for a child process and send the `SIGKILL` signal if it does not
terminate within a specified amount of time. This does not change the
function of `timeout`, just the organization of the code.
2022-03-11 18:47:30 -05:00