From: oech3 <79379754+oech3@users.noreply.github.com> Date: Thu, 26 Feb 2026 12:04:56 +0000 (+0900) Subject: tests: shuf: ensure randomization doesn't depend solely on ASLR X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba0a1dc28e06dcd14cbbee50706c1a6043f4f136;p=thirdparty%2Fcoreutils.git tests: shuf: ensure randomization doesn't depend solely on ASLR * tests/shuf/shuf.sh: Use setarch --addr-no-randomize to disable ASLR, and show the output is still random. https://github.com/coreutils/coreutils/pull/198 --- diff --git a/tests/shuf/shuf.sh b/tests/shuf/shuf.sh index 12688c6311..662d1a5f2a 100755 --- a/tests/shuf/shuf.sh +++ b/tests/shuf/shuf.sh @@ -20,6 +20,12 @@ print_ver_ shuf getlimits_ +# ensure randomization doesn't depend solely on ASLR +# This is a probabilistic test :-) +# However, the odds of failure are low: 1 in $UINTMAX_MAX (~ 1 in 4B on 32 bit) +shuf_rand() { setarch -R shuf -i 1-$UINTMAX_MAX -n 1; } +shuf_rand >out1 && shuf_rand >out2 && compare out1 out2 && fail=1 + seq 100 > in || framework_failure_ shuf in >out || fail=1