Open ryandesign opened 6 months ago
Looks like there is a second occurrence of this code:
I suppose one could write a stat wrapper:
get_filesize() {
local f v
f="$1"
# GNU stat
if v=$(stat -c%s "$f" 2>/dev/null) && echo "$v" | grep -q '^[0-9]\+$'; then
echo "$v"
return
fi
# BSD stat
stat -f%z "$f"
}
Would you like to create a PR?
When running
regress/runtests
on macOS, this error occurs in one test:It's happening on this line:
https://github.com/SIPp/sipp/blob/d1bdebe2e90d36f4d4bd4061b398d85b4880ac5d/regress/github-%230337/run#L13
The
-c
flag is unique to the GNU flavor ofstat
and is not available in the BSD flavor ofstat
that is used on BSD-derived operating systems like macOS.The BSD
stat
equivalent of the GNU-c%s
is-f%z
.I'm not sure if there's a more portable way of discovering a file's size. If not, I'm not sure of the best way to distinguish BSD
stat
from GNUstat
so that the right command could be used.