FreeBSD check fails when GNU stat comes first in PATH
- Dominant language
- C
- Stars
- 27.9k
- Forks
- 2.6k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 8
Description
**Describe the bug**
Running `make check` on FreeBSD fails when GNU `stat` is used for file
permissions or mtime.
**To Reproduce**
Steps to reproduce the behavior:
1. On a FreeBSD system, install the GNU version of `stat` in
/usr/local/bin as `stat` instead of `gstat`.
2. Run `make check`
**Expected behavior**
I was expecting regular test output, ending with
===> zstd long distance matching with optimal parser compressed size tests
**Screenshots and charts**
me% make check
===> --exclude-compressed flag
2 files compressed :32.15% ( 128 KiB => 41.2 KiB)
4 files compressed :32.15% ( 128 KiB => 41.2 KiB)
stat: cannot read file system information for '%m': No such file or directory
make[1]: *** [Makefile:323: test-zstd] Error 1
make[1]: Leaving directory '/usr/local/src/z/zstd/v1.5.2/tests'
make: *** [Makefile:91: shortest] Error 2
**Desktop (please complete the following information):**
- OS: FreeBSD
- Version: 11.3-RELEASE
- Compiler: gcc8
- Flags: -O2
- Build system: Makefile
**Additional context**
Changing PATH to put /usr/bin first failed because I have things like
GNU make and cmake installed under /usr/local/bin. Patching playTests.sh
seemed easiest:
--- playTests.sh.orig 2022-01-20 16:17:18.000000000 -0500
+++ playTests.sh 2022-10-28 14:43:42.122090000 -0400
@@ -121,7 +121,8 @@
MTIME="stat -c %Y"
case "$UNAME" in
- Darwin | FreeBSD | OpenBSD | NetBSD) MTIME="stat -f %m" ;;
+ Darwin | FreeBSD | OpenBSD | NetBSD)
+ stat --help > /dev/null || MTIME="stat -f %m" ;;
esac
assertSameMTime() {
@@ -133,7 +134,9 @@
GET_PERMS="stat -c %a"
case "$UNAME" in
- Darwin | FreeBSD | OpenBSD | NetBSD) GET_PERMS="stat -f %Lp" ;;
+ Darwin | FreeBSD | OpenBSD | NetBSD)
+ stat --help > /dev/null || GET_PERMS="stat -f %Lp"
+ ;;
esac
assertFilePermissions() {
Contributor guide
Assessment
This issue has not been assessed yet.