Environment: Ubuntu 24.04, uutils main branch (git commit 2afab7c), GNU coreutils 9.6.16-3f7c3-modified.
Steps to reproduce:
echo x > fx
echo y > fy
cat fx fy 1<>fx
(1<>fx means open file fx for both reading and writing in file descriptor 1.)
What happens now: uutils cat terminates with an error message:
cat: fx: input file is output file
and it has replaced the contents of the file fx with y\n.
What I expected to happen: GNU cat succeeds with no output and replaced the contents of the file fx with x\ny\n.
Notes: this is causing a failure in the GNU test file tests/cat/cat-self.sh. Also related to #7165. Contrast this behavior with GNU cat when the second file is redirected to file descriptor 1 instead of the first file:
In this case, it terminates with error message cat: fy: input file is output file and it has replaced the contents of the file fy with x\n.
Environment: Ubuntu 24.04, uutils
mainbranch (git commit 2afab7c), GNU coreutils 9.6.16-3f7c3-modified.Steps to reproduce:
(
1<>fxmeans open filefxfor both reading and writing in file descriptor 1.)What happens now: uutils
catterminates with an error message:and it has replaced the contents of the file
fxwithy\n.What I expected to happen: GNU
catsucceeds with no output and replaced the contents of the filefxwithx\ny\n.Notes: this is causing a failure in the GNU test file
tests/cat/cat-self.sh. Also related to #7165. Contrast this behavior with GNU cat when the second file is redirected to file descriptor 1 instead of the first file:In this case, it terminates with error message
cat: fy: input file is output fileand it has replaced the contents of the filefywithx\n.