mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 08:17:40 -04:00
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 <david@gibson.dropbear.id.au>
This commit is contained in:
parent
a0dd7b6081
commit
33e66ec845
1 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue