]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
OpenBSD is unable to write to /dev/zero
authorBjörn Ketelaars <bjorn.ketelaars@hydroxide.nl>
Sat, 30 Jun 2018 11:01:58 +0000 (13:01 +0200)
committerBjörn Ketelaars <bjorn.ketelaars@hydroxide.nl>
Sat, 30 Jun 2018 11:54:34 +0000 (13:54 +0200)
https://github.com/facebook/zstd/pull/1124 fixes an issue with GNU/Hurd
being unable to write to /dev/zero. Implemented fix is writing to
/dev/random instead.

On OpenBSD a regular user is unable to write to /dev/random because of
permissions set on this device. Result is failing a regression test.

Proposed solution should work for all platforms.

tests/playTests.sh

index aa5535d59ebdea6294b5a6a0d6b856e94bfaa592..d167cc289f949d5dcbe5b5dc48502307b7683cc7 100755 (executable)
@@ -48,6 +48,8 @@ fileRoundTripTest() {
     $DIFF -q tmp.md5.1 tmp.md5.2
 }
 
+UNAME=$(uname)
+
 isTerminal=false
 if [ -t 0 ] && [ -t 1 ]
 then
@@ -56,7 +58,10 @@ fi
 
 isWindows=false
 INTOVOID="/dev/null"
-DEVDEVICE="/dev/random"
+case "$UNAME" in
+  OpenBSD) DEVDEVICE="/dev/zero" ;;
+  *) DEVDEVICE="/dev/random" ;;
+esac
 case "$OS" in
   Windows*)
     isWindows=true
@@ -65,7 +70,6 @@ case "$OS" in
     ;;
 esac
 
-UNAME=$(uname)
 case "$UNAME" in
   Darwin) MD5SUM="md5 -r" ;;
   FreeBSD) MD5SUM="gmd5sum" ;;