53 lines
1.6 KiB
Diff
53 lines
1.6 KiB
Diff
From 33e66ec845b8914ad45f559a275673a2a2881576 Mon Sep 17 00:00:00 2001
|
|
From: David Gibson <[email protected]>
|
|
Date: Thu, 24 Jul 2025 13:26:31 +1000
|
|
Subject: tests: Add compatibility with uutils
|
|
|
|
In some places run_tsets.sh needs to get the size of files, which it does
|
|
with stat(1). However the syntax to do this is different between GNU
|
|
coreutils stat(1) and BSD's stat(1). We have some logic that looks for
|
|
"GNU" in the version string to figure out the correct version.
|
|
|
|
This will break upcoming Ubuntu versions which are now using uutils, a Rust
|
|
reimplementation of coreutils. These support the same GNU syntax, but
|
|
don't have the "GNU" in the version string.
|
|
|
|
Update the detection to simply try the GNU version and otherwise assume
|
|
BSD.
|
|
|
|
Link: https://github.com/dgibson/dtc/issues/166
|
|
|
|
Signed-off-by: David Gibson <[email protected]>
|
|
---
|
|
tests/run_tests.sh | 13 +++++++------
|
|
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
|
|
index fecfe7c..2e172d7 100755
|
|
--- a/tests/run_tests.sh
|
|
+++ b/tests/run_tests.sh
|
|
@@ -43,13 +43,14 @@ fi
|
|
|
|
# stat differs between platforms
|
|
if [ -z "$STATSZ" ]; then
|
|
- stat --version 2>/dev/null | grep -q 'GNU'
|
|
- GNUSTAT=$?
|
|
- if [ "$GNUSTAT" -ne 0 ]; then
|
|
- # Assume BSD stat if we can't detect as GNU stat
|
|
- STATSZ="stat -f %Uz"
|
|
- else
|
|
+ # First attempt GNU style, this is supported by both the
|
|
+ # actual GNU coreutils version, and the Rust re-implementation
|
|
+ # uutils, used in recent Ubuntu versions
|
|
+ if stat -c %s $0; then
|
|
STATSZ="stat -c %s"
|
|
+ else
|
|
+ # Otherwise assume BSD style stat
|
|
+ STATSZ="stat -f %Uz"
|
|
fi
|
|
fi
|
|
|
|
--
|
|
cgit 1.2.3-korg
|
|
|