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
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>
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.
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`.
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.
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.
* 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
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.
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.
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.