nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1commit 898804bed022d1ef26e5c0b12550f87fc86f29ed
2Author: Arnout Engelen <arnout@bzzt.net>
3Date: Thu Dec 4 21:42:40 2025 +0100
4
5 tests: improve reliability of run-sysroot.sh
6
7 Previously, the 'second' test would test the `RESOLVE_IN_ROOT` feature
8 when the current libc supports it, even when the currently running
9 kernel did not yet support it.
10
11 Signed-off-by: Arnout Engelen <arnout@bzzt.net>
12
13diff --git a/tests/run-sysroot.sh b/tests/run-sysroot.sh
14index fe302446..d2041e8a 100755
15--- a/tests/run-sysroot.sh
16+++ b/tests/run-sysroot.sh
17@@ -46,10 +46,14 @@ TID 431185:
18 #8 0x0000aaaae56127f0 _start
19 EOF
20
21-HAVE_OPENAT2=$(grep '^#define HAVE_OPENAT2_RESOLVE_IN_ROOT' \
22- ${abs_builddir}/../config.h | awk '{print $3}')
23+libc_has_openat2_resolve_in_root() {
24+ grep '^#define HAVE_OPENAT2_RESOLVE_IN_ROOT' ${abs_builddir}/../config.h | awk '{print $3}'
25+}
26+kernel_has_openat2_resolve_in_root() {
27+ printf "%s\n%s" "5.6.0" "$(uname -r)" | sort -V -C
28+}
29
30-if [[ "$HAVE_OPENAT2" = 1 ]]; then
31+if libc_has_openat2_resolve_in_root && kernel_has_openat2_resolve_in_root; then
32 # Change the layout of files in sysroot to test symlink escape scenario
33 rm -f "${tmpdir}/sysroot/bin"
34 mkdir "${tmpdir}/sysroot/bin"
35@@ -57,7 +61,8 @@ if [[ "$HAVE_OPENAT2" = 1 ]]; then
36 ln -s /bin/bash "${tmpdir}/sysroot/usr/bin/bash"
37
38 # Check that stack with --sysroot generates correct backtrace even if target
39- # binary is actually absolute symlink pointing outside of sysroot directory
40+ # binary is actually absolute symlink to be interpreted relative to the sysroot
41+ # directory
42 testrun "${abs_top_builddir}"/src/stack --core "${tmpdir}/core.bash" \
43 --sysroot "${tmpdir}/sysroot" >"${tmpdir}/stack.out"
44