GNU bug report logs -
#79407
to-file option not working any more?
Previous Next
To reply to this bug, email your comments to 79407 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-diffutils <at> gnu.org
:
bug#79407
; Package
diffutils
.
(Mon, 08 Sep 2025 08:45:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mandar Mitra <mandar.mitra <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-diffutils <at> gnu.org
.
(Mon, 08 Sep 2025 08:45:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
When I specify a directory with the --to-file option, and ask diff to compare multiple files with the corresponding files under the to-file directory, only the first file is diffed; a "No such file or directory" message is displayed for everything else.
Example:
$ /bin/diff -s --to-file=tmp/ 012018.pdf ben.pdf
Files 012018.pdf and tmp/012018.pdf are identical
/bin/diff: tmp/: No such file or directory
But running diff separately on the two files works:
$ /bin/diff -s --to-file=tmp/ 012018.pdf
Files 012018.pdf and tmp/012018.pdf are identical
$ /bin/diff -s --to-file=tmp/ ben.pdf
Files ben.pdf and tmp/ben.pdf are identical
I'm reasonably sure this used to work earlier as I expected, but a quick search did not find any related discussions / bug reports.
Could someone kindly confirm whether this is a bug or incorrect understanding on my part?
Many thanks,
Mandar.
Information forwarded
to
bug-diffutils <at> gnu.org
:
bug#79407
; Package
diffutils
.
(Tue, 09 Sep 2025 04:07:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 79407 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Mon, Sep 8, 2025 at 6:12 AM Mandar Mitra <mandar.mitra <at> gmail.com> wrote:
>
> When I specify a directory with the --to-file option, and ask diff to compare multiple files with the corresponding files under the to-file directory, only the first file is diffed; a "No such file or directory" message is displayed for everything else.
>
> [...]
> I'm reasonably sure this used to work earlier as I expected, but a quick search did not find any related discussions / bug reports.
> Could someone kindly confirm whether this is a bug or incorrect understanding on my part?
Mandar, I can confirm that the --to-file option as a directory results
in only the first command-line file
being diffed, with errors for the others.
This script (also attached as 'runtest02.sh') shows it whether the
first file is identical (b) or different (c):
DIFFOPTS='-s'
diff --version
ecmd() { printf '\n=== %s\n' "$*" ;"$@" ;}
setup() {
test ! -d t || rm -r t && mkdir t || exit
# Create 3 directories of 3 one-line files
cd t && mkdir a b c || exit
split --numeric-suffixes=1 -a 1 -l 1 --verbose -- - a/ <<'END'
x
xx
xxx
END
split --numeric-suffixes=1 -a 1 -l 1 --verbose -- - b/ <<'END'
x
!!
xxx
END
split --numeric-suffixes=1 -a 1 -l 1 --verbose -- - c/ <<'END'
!
xx
!!!
END
}
setup
ecmd diff ${DIFFOPTS} --to-file b -- a/3 a/2 a/1
ecmd diff ${DIFFOPTS} --to-file c -- a/3 a/2 a/1
And I just found out that an older version of diff handles this without errors.
First the old one:
$ runtest02.sh -s
diff (GNU diffutils) 3.6
Packaged by openSUSE
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
creating file 'a/1'
creating file 'a/2'
creating file 'a/3'
creating file 'b/1'
creating file 'b/2'
creating file 'b/3'
creating file 'c/1'
creating file 'c/2'
creating file 'c/3'
=== diff -s --to-file b -- a/3 a/2 a/1
Files a/3 and b/3 are identical
1c1
< xx
---
> !!
Files a/1 and b/1 are identical
=== diff -s --to-file c -- a/3 a/2 a/1
1c1
< xxx
---
> !!!
Files a/2 and c/2 are identical
1c1
< x
---
> !
And the new one:
$ runtest02.sh -s
diff (GNU diffutils) 3.12
Packaged by openSUSE
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
creating file 'a/1'
creating file 'a/2'
creating file 'a/3'
creating file 'b/1'
creating file 'b/2'
creating file 'b/3'
creating file 'c/1'
creating file 'c/2'
creating file 'c/3'
=== diff -s --to-file b -- a/3 a/2 a/1
Files a/3 and b/3 are identical
diff: b: No such file or directory
diff: b: No such file or directory
=== diff -s --to-file c -- a/3 a/2 a/1
1c1
< xxx
---
> !!!
diff: c: No such file or directory
diff: c: No such file or directory
--
Robert Webb
[runtest02.sh (application/x-shellscript, attachment)]
Information forwarded
to
bug-diffutils <at> gnu.org
:
bug#79407
; Package
diffutils
.
(Tue, 09 Sep 2025 06:49:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 79407 <at> debbugs.gnu.org (full text, mbox):
Robert Webb wrote (Mon, Sep 08, 2025 at 09:06:11PM -0700):
> Mandar, I can confirm that the --to-file option as a directory results
> in only the first command-line file
> being diffed, with errors for the others.
Many thanks for confirming! Is there anything I can do to help fix this, or would it be absolutely straightforward for you to patch the correct handling from 3.6 (say) into 3.12?
Warm regards,
Mandar.
Information forwarded
to
bug-diffutils <at> gnu.org
:
bug#79407
; Package
diffutils
.
(Tue, 09 Sep 2025 09:12:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 79407 <at> debbugs.gnu.org (full text, mbox):
On Mon, Sep 8, 2025 at 11:48 PM Mandar Mitra <mandar.mitra <at> gmail.com> wrote:
>
> Robert Webb wrote (Mon, Sep 08, 2025 at 09:06:11PM -0700):
> > Mandar, I can confirm that the --to-file option as a directory results
> > in only the first command-line file
> > being diffed, with errors for the others.
>
> Many thanks for confirming! Is there anything I can do to help fix this, or would it be absolutely straightforward for you to patch the correct handling from 3.6 (say) into 3.12?
I am just a user of diffutils, like you. You could maybe find the
exact version that changed diff's behavior.
That would focus on a small set of source code changes where the
problem might be.
--
Robert Webb
This bug report was last modified 4 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.