]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: cat: add test for O_APPEND bug fix
authorPádraig Brady <P@draigBrady.com>
Tue, 1 Jul 2025 21:52:16 +0000 (22:52 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 1 Jul 2025 22:32:31 +0000 (23:32 +0100)
* tests/cat/cat-self.sh: Add a test case
for commit v9.6-19-g7386c291b

tests/cat/cat-self.sh

index 3c171b40b2e5fa91771ea25c35773d04c4b56d1a..2d09fc08771128cea4e099b9d28fe09fdaddad39 100755 (executable)
@@ -50,4 +50,14 @@ returns_ 1 cat - fx4 <fx 1<>fx4 || fail=1
 returns_ 1 cat fx5 >>fx5 || fail=1
 returns_ 1 cat <fx6 >>fx6 || fail=1
 
+# coreutils 9.6 would fail with a plain cat if the tty was in append mode
+# Simulate with a regular file to simplify
+echo foo > file || framework_failure_
+# Set fd 3 at EOF
+exec 3< file && cat <&3 > /dev/null || framework_failure_
+# Set fd 4 in append mode
+exec 4>> file || framework_failure_
+cat <&3 >&4 || fail=1
+exec 3<&- 4>&-
+
 Exit $fail