Commit graph

7552 commits

Author SHA1 Message Date
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
Eli Youngs
565af8237b Fix formatting 2022-03-11 23:43:59 +01:00
Eli Youngs
e23219289a Simplify test cases 2022-03-11 23:43:59 +01:00
Eli Youngs
2afa9cd1a0 printf - Update %g formatting to match GNU 2022-03-11 23:43:59 +01:00
jfinkels
ebd0c09549
util: use seq to enumerate integers (#3239)
Replace a bash loop for enumerating integers with a more concise use
of `seq` in `util/build-gnu.sh`.
2022-03-11 09:38:06 +01:00
Kartik Sharma
5c5f4ca6ad
df: Adds support for mount path prefix matching and input path (#3161)
* Adds support for mount path prefix matching and input path
canonicalization

- Sorts mount paths in reverse lexicographical order
- Canonicalize all paths and clear invalid paths
- Checking of mount path prefix matches input path
2022-03-11 09:36:34 +01:00
Sylvestre Ledru
1795272473
Merge pull request #3176 from jfinkels/df-output-columns-2
df: implement the --output command-line argument
2022-03-11 09:26:17 +01:00
Sylvestre Ledru
e8d1aebd9e
Merge pull request #3242 from jfinkels/multiple-clippy-fixes
Clippy fixes in multiple crates
2022-03-11 09:04:42 +01:00
Sylvestre Ledru
492c467361
Merge pull request #3240 from jfinkels/util-dont-replace-seq
util: remove replacement of seq in GNU tests
2022-03-11 09:03:36 +01:00
Jeffrey Finkelstein
77d92883c7 split: implement --line-bytes option
Implement the `--line-bytes` option to `split`. In this mode, the
program tries to write as many lines of the input as possible to each
chunk of output without exceeding a specified byte limit. The new
`LineBytesChunkWriter` struct represents this functionality.
2022-03-10 22:51:49 -05:00
Jeffrey Finkelstein
c0cd017706 tests: update test_df.rs to use --output argument 2022-03-10 22:50:15 -05:00
Jeffrey Finkelstein
ec048b3857 df: implement the --output command-line argument
Implement the `--output` command-line argument, which allows
specifying an exact sequence of columns to display in the output
table. For example,

    $ df --output=source,fstype | head -n3
    Filesystem       Type
    udev             devtmpfs
    tmpfs            tmpfs

(The spacing does not exactly match the spacing of GNU `df` yet.)

Fixes #3057.
2022-03-10 22:50:15 -05:00
Jeffrey Finkelstein
0b07ecdad2 df: use Options.columns field to control output
Replace the `Options.show_fs_type` and `Options.show_inode_instead`
fields with the more general `Options.columns`, a `Vec` of `Column`
variants representing the exact sequence of columns to display in the
output. This makes `Options` able to represent arbitrary output column
display configurations.
2022-03-10 22:50:15 -05:00
Jeffrey Finkelstein
b42168e9dc Clippy fixes in multiple crates 2022-03-10 22:31:21 -05:00
Jeffrey Finkelstein
a5200efaac util: remove replacement of seq in GNU tests 2022-03-10 18:51:26 -05:00
Sylvestre Ledru
2e8945ba7f
Merge pull request #3221 from uutils/dependabot/cargo/unicode-segmentation-1.9.0
build(deps): bump unicode-segmentation from 1.8.0 to 1.9.0
2022-03-10 00:32:13 +01:00
Sylvestre Ledru
08f40a102e
Merge pull request #3228 from uutils/dependabot/cargo/unindent-0.1.8
build(deps): bump unindent from 0.1.7 to 0.1.8
2022-03-10 00:31:07 +01:00
Sylvestre Ledru
3b78023fcb
Merge pull request #3220 from uutils/dependabot/cargo/strum-0.24.0
build(deps): bump strum from 0.23.0 to 0.24.0
2022-03-10 00:30:29 +01:00
Sylvestre Ledru
2e860e7048
Merge pull request #3116 from nickd0/printf-round-fix
printf: fix printf sci notation round up
2022-03-09 19:47:52 +01:00
Sylvestre Ledru
3955354b3a timeout: add a test for empty arg 2022-03-09 19:45:43 +01:00
dependabot[bot]
fc4f1d869e build(deps): bump strum from 0.23.0 to 0.24.0
Bumps [strum](https://github.com/Peternator7/strum) from 0.23.0 to 0.24.0.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-09 19:45:40 +01:00
dependabot[bot]
b4ee7f84fa build(deps): bump unicode-segmentation from 1.8.0 to 1.9.0
Bumps [unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/unicode-rs/unicode-segmentation/releases)
- [Commits](https://github.com/unicode-rs/unicode-segmentation/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-09 19:45:35 +01:00
dependabot[bot]
bd04e0f92f build(deps): bump unindent from 0.1.7 to 0.1.8
Bumps [unindent](https://github.com/dtolnay/indoc) from 0.1.7 to 0.1.8.
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/0.1.7...0.1.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-09 19:45:22 +01:00
Sylvestre Ledru
dfcba58c82
Merge pull request #3231 from sylvestre/cargo-lock
Various CI changes to unbreak the CI
2022-03-09 19:44:47 +01:00
Sylvestre Ledru
a22709aedd CI: Disable Windows job i686-pc-windows-gnu
Fails with:
error: linker `i686-w64-mingw32-gcc` not found
And the Windows GNU is covered by x86_64-pc-windows-gnu anyway
2022-03-08 22:57:32 +01:00
Sylvestre Ledru
9f5fad1e38 add a job to build with rust nightly 2022-03-08 22:57:32 +01:00
Sylvestre Ledru
2a48234c12 add a job to build with rust stable 2022-03-08 22:57:32 +01:00
Sylvestre Ledru
e3649e33c5 remove old comment 2022-03-08 22:57:32 +01:00
Sylvestre Ledru
f896834c77 Use min rust version as default 2022-03-08 22:57:28 +01:00
Sylvestre Ledru
b43db8b552
Merge pull request #3230 from cakebaker/ticket_3208_2nd_attempt
df: always round up usage percentage (#3208)
2022-03-08 19:37:44 +01:00
Daniel Hofstetter
3317fb9924 df: always round up usage percentage (#3208) 2022-03-08 15:13:05 +01:00
Justin Tracey
687dcaef9f users and who: ignore failing tests for now 2022-03-07 12:32:07 -05:00
Justin Tracey
644c99ed2e pinky: simplify and debug printing files 2022-03-07 12:32:07 -05:00
Justin Tracey
f52f655934 pinky: improve tests 2022-03-07 12:32:07 -05:00
Justin Tracey
9430a9f355 pinky: fix off-by-one in GECOS parsing 2022-03-07 12:32:07 -05:00