Skip to content

Commit

Permalink
update from main (#5)
Browse files Browse the repository at this point in the history
* ci: use codecov token in CICD/GnuTests workflows

* tee: fail test if string setup fails

* sort: add skipped test for combined flags

Now that clap#2624 has been resolved, we can and should test both variants.

* cat: don't flake even on exotic pipe buffer sizes

See also 9995c63.

There is a race condition between the writing thread and the command.
It is easily possible that on the developer's machine, the writing
thread is always faster, filling the kernel's buffer of the stdin pipe,
thus succeeding the write. It is also easily possible that on the busy
CI machines, the child command runs first for whatever reason, and exits
early, thus killing the pipe, which causes the later write to fail. This
results in a flaky test. Let's prevent flaky tests.

* numfmt: don't flake even on exotic pipe buffer sizes

* split: don't flake even on exotic pipe buffer sizes

* simulate terminal utility (squash)

* workaround: run builds with retry (a)

* added configurable terminal size

* chore(deps): update rust crate rayon to 1.9

* cargo: fix feature = "cargo-clippy" deprecation

* tests/printf: Fix char_as_byte test, add char and string padding tests

* printf: Change get_char and write_padded to handle bytes instead of chars

* uucore/format: add padlen to spell-checker:ignore

* tests/printf: Verify the correct error behavior of printf when provided with '%0c' or '%0s'

* printf: Raise error on '%0c' and '%0s' formats

* cp: fix flaky test test_cp_arg_interactive_update, document adjacent bug

* chore(deps): update rust crate walkdir to 2.5

* cat: permit repeating command-line flags

* cat: fix -b and -n anti-symmetry

* cat: ignore -u flag, just like GNU does

* tests/common/util.rs: add cfg(feature = "env")

* cat: prefix two test fns with "test_"

* Bump mio from 0.8.10 to 0.8.11

* extend error message for case when writer instanciation fails second time

* Bump chrono from 0.4.34 to 0.4.35

* ls: use chrono::TimeDelta::try_seconds instead of

deprecated chrono::TimeDelta::seconds

* touch: replace use of deprecated chrono functions

* chmod: slightly adjust error message when preserve-root is triggered

One of the GNU tests checks for the exact error message.

* chgrp+chown: also trigger preserve-root during dirwalking, fix error message

This is explicitly tested in the GNU tests.

* uucore: drop unused function resolve_relative_path

This function is by necessity ill-defined: Depending on the context,
'..' is either the logical parent directory, sometimes the physical
parent directory. This function can only work for the latter case,
in which case `Path::canonicalize` is often a better approach.

* split: close as much fds as needed for opening new one

* use std::command::pre_exec() to set limits on child before exec

* chore(deps): update softprops/action-gh-release action to v2

* dd: treat arg as bytes if it contains 'B'

* Fix clippy warnings

* tr: stream output instead of buffering

This should lower memory consumption, and fixes OOM in some scenarios.

* shuf: fix and test off-by-one errors around ranges

* shuf: fix error message text on negative-sized ranges

Found by @cakebaker:
uutils#6011 (comment)

* chcon: allow overriding between --dereference and --no-dereference

* chcon: allow repeated flags and arguments

* touch: Respect -h when getting metadata (uutils#5951)

* Add tests that stat symlinks

* Check follow first in stat

* Don't run tests on FreeBSD

It would be possible to get them to run on FreeBSD by avoiding
get_symlink_times, but the behavior we're testing is not
platform-specific, so it's fine to not test it on FreeBSD.

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>

* pr: fix deprecation warnings & remove comment

* chgrp: fix clippy warning

* cut: allow non utf8 characters for delimiters (uutils#6037)

* cp: improve the support of --attributes-only (uutils#6051)

* cp: improve the support of --attributes-only

* remove useless comments

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* cp: Split the copy_file function a bit

* parser: if closing square bracket not found, stop looking for it again

This solves uutils#5584, where the fuzzing would take hours without this.

* Fix install: invalid link at destination
also remove some FixMEs for FreeBsd

* Bump nix from 0.27 to 0.28

* uucore/pipes: adapt to new return type of nix fn

nix 0.28 changed the return type of unistd::pipe() from Result<(RawFd, RawFd), Error> to Result<(OwnedFd, OwnedFd), Error>

* tty: unistd::ttyname takes AsFd instead of RawFd

change introduced by nix 0.28

* stty: remove ofill output flag

flag was removed from nix::sys::termios::OutputFlags in nix 0.28

* cat: adapt to type change of unistd::write()

nix 0.28 changed "write(fd: RawFd, buf: &[u8]) -> Result<usize>" to "write<Fd: AsFd>(fd: Fd, buf: &[u8]) -> Result<usize>"

* chore(deps): update rust crate blake3 to 1.5.1

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Co-authored-by: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
Co-authored-by: Ulrich Hornung <hornunguli@gmx.de>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Co-authored-by: Dimitris Apostolou <dimitris.apostolou@icloud.com>
Co-authored-by: Dorian Péron <dorianperon.i@gmail.com>
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
Co-authored-by: mhead <mtrxhead@protonmail.com>
Co-authored-by: Yash Thakur <45539777+ysthakur@users.noreply.github.com>
Co-authored-by: Zoltan Kiss <121870572+cj-zoltan-kiss@users.noreply.github.com>
  • Loading branch information
12 people authored Mar 12, 2024
1 parent 7d10c78 commit 44e01f7
Show file tree
Hide file tree
Showing 27 changed files with 896 additions and 274 deletions.
25 changes: 16 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ binary-heap-plus = "0.5.0"
bstr = "1.9"
bytecount = "0.6.7"
byteorder = "1.5.0"
chrono = { version = "^0.4.34", default-features = false, features = [
chrono = { version = "^0.4.35", default-features = false, features = [
"std",
"alloc",
"clock",
Expand Down Expand Up @@ -294,7 +294,7 @@ lscolors = { version = "0.16.0", default-features = false, features = [
] }
memchr = "2"
memmap2 = "0.9"
nix = { version = "0.27", default-features = false }
nix = { version = "0.28", default-features = false }
nom = "7.1.3"
notify = { version = "=6.0.1", features = ["macos_kqueue"] }
num-bigint = "0.4.4"
Expand Down Expand Up @@ -340,7 +340,7 @@ sha1 = "0.10.6"
sha2 = "0.10.8"
sha3 = "0.10.8"
blake2b_simd = "1.0.2"
blake3 = "1.5.0"
blake3 = "1.5.1"
sm3 = "0.4.2"
digest = "0.10.7"

Expand Down
13 changes: 8 additions & 5 deletions src/uu/cat/src/splice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
use super::{CatResult, FdReadable, InputHandle};

use nix::unistd;
use std::os::unix::io::{AsRawFd, RawFd};
use std::os::{
fd::AsFd,
unix::io::{AsRawFd, RawFd},
};

use uucore::pipes::{pipe, splice, splice_exact};

Expand All @@ -20,9 +23,9 @@ const BUF_SIZE: usize = 1024 * 16;
/// The `bool` in the result value indicates if we need to fall back to normal
/// copying or not. False means we don't have to.
#[inline]
pub(super) fn write_fast_using_splice<R: FdReadable>(
pub(super) fn write_fast_using_splice<R: FdReadable, S: AsRawFd + AsFd>(
handle: &InputHandle<R>,
write_fd: &impl AsRawFd,
write_fd: &S,
) -> CatResult<bool> {
let (pipe_rd, pipe_wr) = pipe()?;

Expand All @@ -38,7 +41,7 @@ pub(super) fn write_fast_using_splice<R: FdReadable>(
// we can recover by copying the data that we have from the
// intermediate pipe to stdout using normal read/write. Then
// we tell the caller to fall back.
copy_exact(pipe_rd.as_raw_fd(), write_fd.as_raw_fd(), n)?;
copy_exact(pipe_rd.as_raw_fd(), write_fd, n)?;
return Ok(true);
}
}
Expand All @@ -52,7 +55,7 @@ pub(super) fn write_fast_using_splice<R: FdReadable>(
/// Move exactly `num_bytes` bytes from `read_fd` to `write_fd`.
///
/// Panics if not enough bytes can be read.
fn copy_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> {
fn copy_exact(read_fd: RawFd, write_fd: &impl AsFd, num_bytes: usize) -> nix::Result<()> {
let mut left = num_bytes;
let mut buf = [0; BUF_SIZE];
while left > 0 {
Expand Down
5 changes: 3 additions & 2 deletions src/uu/chcon/src/chcon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ pub fn uu_app() -> Command {
.override_usage(format_usage(USAGE))
.infer_long_args(true)
.disable_help_flag(true)
.args_override_self(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
Expand All @@ -163,7 +164,7 @@ pub fn uu_app() -> Command {
.arg(
Arg::new(options::dereference::DEREFERENCE)
.long(options::dereference::DEREFERENCE)
.conflicts_with(options::dereference::NO_DEREFERENCE)
.overrides_with(options::dereference::NO_DEREFERENCE)
.help(
"Affect the referent of each symbolic link (this is the default), \
rather than the symbolic link itself.",
Expand All @@ -180,7 +181,7 @@ pub fn uu_app() -> Command {
.arg(
Arg::new(options::preserve_root::PRESERVE_ROOT)
.long(options::preserve_root::PRESERVE_ROOT)
.conflicts_with(options::preserve_root::NO_PRESERVE_ROOT)
.overrides_with(options::preserve_root::NO_PRESERVE_ROOT)
.help("Fail to operate recursively on '/'.")
.action(ArgAction::SetTrue),
)
Expand Down
Loading

0 comments on commit 44e01f7

Please sign in to comment.