From 3d24c0c23dc747bfdd1a9ad1cba6454e90d0b760 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 2 Jul 2026 21:16:53 +0900 Subject: [PATCH] GnuTests: remove LD_PRELOAD from nproc-quota.sh & avoid 0 period --- src/uu/nproc/src/nproc.rs | 4 ++-- util/fetch-gnu.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 19b0494966..df65196b37 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -109,8 +109,8 @@ fn cgroups2_quota() -> Option { let mut pair = pair.split_whitespace(); // map the string "max" to None as we unwrap_or(usize::MAX) later let quota = pair.next()?.parse::().ok()?; - let period = pair.next()?.parse::().ok()?; - debug_assert!(period > 0, "kernel should validate it"); + // kernel does not provide 0 period. But it seems GNU cares about it + let period = pair.next()?.parse::().ok().filter(|&p| p > 0)?; // mimic GNU's rounding Some(quota.saturating_add(period / 2) / period) } diff --git a/util/fetch-gnu.sh b/util/fetch-gnu.sh index 8a30184f5f..0a38357c97 100755 --- a/util/fetch-gnu.sh +++ b/util/fetch-gnu.sh @@ -6,6 +6,7 @@ curl -L "${repo}/releases/download/v${ver}/coreutils-${ver}.tar.xz" | tar --stri # TODO stop backporting tests from master at GNU coreutils > $ver exit 0 backport=( + nproc/nproc-quota.sh # remove LD_PRELOAD ) for f in "${backport[@]}" do curl -L ${repo}/raw/refs/heads/master/tests/$f > tests/$f