]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: dd: fix false failure on NetBSD
authorPádraig Brady <P@draigBrady.com>
Tue, 14 Jul 2026 11:07:07 +0000 (12:07 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 14 Jul 2026 11:07:07 +0000 (12:07 +0100)
* tests/cat/cat-distinct-err.sh: /proc/self/mem fails with EINVAL
on NetBSD, so extract the error from dd for comparison.
Reported by Bruno Haible.

tests/cat/cat-distinct-err.sh

index cf21be225b04967e9fa7b1536690b8d4008d4d0c..5b15ddc14611aa267a55f50c4d594ea21fbfaca0 100755 (executable)
@@ -29,10 +29,11 @@ if test -w /dev/full && test -c /dev/full; then
 fi
 
 # read error
-if test -e /proc/self/mem &&
-   returns_ 1 dd if=/proc/self/mem bs=1 count=1; then
-  echo "cat: /proc/self/mem: $EIO" >exp || framework_failure_
-  returns_ 1 cat /proc/self/mem 2>err || fail=1
+errf='/proc/self/mem'
+if returns_ 1 dd if=$errf bs=1 count=1 status=none 2>errt; then
+  err_mem=$(sed 's/dd: .*: //' <errt) || framework_failure_
+  echo "cat: $errf: $err_mem" >exp || framework_failure_
+  returns_ 1 cat $errf 2>err || fail=1
   compare exp err || fail=1
 fi