[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
diff (diffutils 2.7) breaks with non-regular files on FreeBSD 4.1.1, wit
From: |
Timothy Miller |
Subject: |
diff (diffutils 2.7) breaks with non-regular files on FreeBSD 4.1.1, with patch |
Date: |
Tue, 7 Aug 2001 20:49:30 -0400 (EDT) |
GNU diff, from diffutils 2.7 breaks trying to diff files where at least one of
them is not a regular file. For instance, under zsh, prog1 <(prog2) takes the
output of prog2 and makes it available through a pipe whose name is then
substituted for <(prog1) as the argument to prog2, so I can do
diff -a <(g++ -E -dM -xc++ /dev/null) <(g++ -O -E -dM -xc++ /dev/null)
to see what the differences in preprocessor predefinitions are with optimization
turned on in g++. Unfortunately, that doesn't work with the current version of
diffutils on FreeBSD 4.1.1; instead it always reports the files as being the
same. I tracked this down to the fact that st_blksize is 0 for the nonregular
files zsh uses (/dev/fd/* in this case, but also /dev/null and various others),
and diff tries to double this value to get a buffer size to read the file in.
My patch to fix this is at the end of this email. current->bufsize is
initialized on line 97 of io.c to st_blksize, fyi.
Tim
--- io.c.dist Wed Oct 29 11:14:35 1997
+++ io.c Tue Aug 7 20:30:10 2001
@@ -165,7 +165,7 @@
{
if (current->buffered_chars == current->bufsize)
{
- current->bufsize = current->bufsize * 2;
+ current->bufsize = current->bufsize == 0 ? sizeof(word) :
current->bufsize * 2;
current->buffer = xrealloc (current->buffer, current->bufsize);
}
cc = read (current->desc,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- diff (diffutils 2.7) breaks with non-regular files on FreeBSD 4.1.1, with patch,
Timothy Miller <=