From MAILER-DAEMON Mon Aug 09 03:31:12 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OiMpC-0004dQ-Ea
	for mharc-bug-diffutils@gnu.org; Mon, 09 Aug 2010 03:31:10 -0400
Received: from [140.186.70.92] (port=37665 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oi9W1-0006lr-Q1
	for bug-diffutils@gnu.org; Sun, 08 Aug 2010 13:18:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <calestyo@scientia.net>) id 1OhmbN-0001wQ-3p
	for bug-diffutils@gnu.org; Sat, 07 Aug 2010 12:50:32 -0400
Received: from mailgw02.dd24.net ([193.46.215.43]:42694)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <calestyo@scientia.net>) id 1OhmbM-0001vz-UH
	for bug-diffutils@gnu.org; Sat, 07 Aug 2010 12:50:29 -0400
Received: from localhost (amavis02.dd24.net [192.168.1.113])
	by mailgw02.dd24.net (Postfix) with ESMTP id BE8FF355439
	for <bug-diffutils@gnu.org>; Sat,  7 Aug 2010 16:50:24 +0000 (GMT)
X-Virus-Scanned: domaindiscount24.com mail filter gateway
Received: from mailgw02.dd24.net ([192.168.1.197])
	by localhost (amavis02.dd24.net [192.168.1.106]) (amavisd-new,
	port 10197) with ESMTP id n3qTPDwwyMsS for <bug-diffutils@gnu.org>;
	Sat,  7 Aug 2010 16:50:19 +0000 (GMT)
Received: from webmail.dd24.net (webmail01.dd24.net [193.46.215.65])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mailgw02.dd24.net (Postfix) with ESMTPSA id 330EC355425
	for <bug-diffutils@gnu.org>; Sat,  7 Aug 2010 16:50:17 +0000 (GMT)
MIME-Version: 1.0
Date: Sat, 07 Aug 2010 16:50:14 +0000
From: Christoph Anton Mitterer <calestyo@scientia.net>
To: <bug-diffutils@gnu.org>
Message-ID: <10d13d6fb4036cc51d36b387775aad74@imap.dd24.net>
X-Sender: calestyo@scientia.net
User-Agent: RoundCube Webmail/0.3.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Mailman-Approved-At: Mon, 09 Aug 2010 03:31:05 -0400
Subject: [bug-diffutils] bug: diff -r swaps the files it should check
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 08 Aug 2010 17:18:33 -0000

Hi.

I found a rather strange bug in diff (Debian version 1:3.0-1) when doing
large backups of millions of files.
First I've copied the data to an external HDD, then I've did an "diff -q
-r >out 2> err" in order to find any errors.

out has about the following content:
Files /data/......../Wei=E1=B3=AEJPEG and
/mnt/backups/2010-08-06/1/......../Wei=E1=B2=AEJPEG differ
Files /data/......../Wei=E1=B2=AEJPEG and
/mnt/backups/2010-08-06/1/......../Wei=E1=B3=AEJPEG differ

The strange unicode characters had their character codes inside which rea=
d
as follows:
1CEE      1CAE
1CAE      1CEE
(in the same order as above)


stat on these files gave:
$ stat Wei*
  File: `Wei\341\262\256JPEG'
  Size: 20927     	Blocks: 48         IO Block: 4096   regular file
Device: 821h/2081d	Inode: 4096614     Links: 1
Access: (0660/-rw-rw----)  Uid: ( 1000/calestyo)   Gid: ( 1000/calestyo)
Access: 2009-11-30 19:29:18.000000000 +0100
Modify: 2001-07-18 16:40:08.000000000 +0200
Change: 2007-07-19 19:12:28.000000000 +0200
  File: `Wei\341\263\256JPEG'
  Size: 15524     	Blocks: 32         IO Block: 4096   regular file
Device: 821h/2081d	Inode: 4096615     Links: 1
Access: (0660/-rw-rw----)  Uid: ( 1000/calestyo)   Gid: ( 1000/calestyo)
Access: 2009-11-30 19:29:18.000000000 +0100
Modify: 2001-07-18 16:40:08.000000000 +0200
Change: 2007-07-19 19:12:28.000000000 +0200

There was even a third file of similar name:
  File: `Wei=E1=AE=8APEG'
  Size: 18843     	Blocks: 40         IO Block: 4096   regular file
Device: 821h/2081d	Inode: 4096613     Links: 1
Access: (0660/-rw-rw----)  Uid: ( 1000/calestyo)   Gid: ( 1000/calestyo)
Access: 2009-11-30 19:29:18.000000000 +0100
Modify: 2001-07-18 16:40:08.000000000 +0200
Change: 2007-07-19 19:12:28.000000000 +0200
but it seems that this one made no problems?


When manually comparing those files with diff (of course in the correct
order),... no difference was found.


Any ideas?



Cheers,
Chris.

btw: I'm not subscribed, so please CC me.


From MAILER-DAEMON Wed Aug 11 18:06:09 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OjJR3-0002Jp-EG
	for mharc-bug-diffutils@gnu.org; Wed, 11 Aug 2010 18:06:09 -0400
Received: from [140.186.70.92] (port=56993 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OjAVd-0001nj-2H
	for bug-diffutils@gnu.org; Wed, 11 Aug 2010 08:34:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <pth@suse.de>) id 1OjAVb-00081H-PB
	for bug-diffutils@gnu.org; Wed, 11 Aug 2010 08:34:16 -0400
Received: from cantor.suse.de ([195.135.220.2]:37529 helo=mx1.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <pth@suse.de>)
	id 1OjAVb-00080u-F7
	for bug-diffutils@gnu.org; Wed, 11 Aug 2010 08:34:15 -0400
Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.suse.de (Postfix) with ESMTP id B975F5362F
	for <bug-diffutils@gnu.org>; Wed, 11 Aug 2010 14:34:13 +0200 (CEST)
Date: Wed, 11 Aug 2010 14:34:13 +0200
From: Philipp Thomas <pth@suse.de>
To: bug-diffutils@gnu.org
Message-ID: <20100811123413.GC31821@paradies.suse.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Operating-System: openSUSE - Kernel Linux 2.6.34-14.6-default x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
	=?iso-8859-1?Q?F=3A_Markus_Rex=2C_HRB_16746_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-Mailman-Approved-At: Wed, 11 Aug 2010 18:06:07 -0400
Subject: [bug-diffutils] Funny behaviour of diff 2.8.1
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Aug 2010 12:34:18 -0000

I got the following question from our ksh maintainer
(https://bugzilla.novell.com/show_bug.cgi?id=627524) which I'd like to pass
on because I have little knowledge of diffs inner workings. The original bug
report was that ksh shows an anomaly when using the "-" within a pipe
context, e. g.

$> echo "test" | diff - /dev/null
diff: -: Bad file descriptor

Which works in bash.

Our maintainer replied:

ksh uses socketpairs as a fast replacement for pipes which is a major
feature of the ksh ...  I do not understand why /usr/bin/diff
executes dup(), then opens /proc/self/fd/3, and then tries to open this:

  /bin/echo "test" | strace /usr/bin/diff - /dev/null
  [...]
  ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfdf8b18) = -1 EINVAL (Invalid
argument)
  dup(0)
  lstat64("/proc/self/fd/3", {st_mode=S_IFLNK|0700, st_size=64, ...}) = 0
  close(0)                                = 0
  open("/proc/self/fd/3", O_RDONLY|O_LARGEFILE) = -1 ENXIO (No such device
  or
address)
  close(3)                                = 0
  fstat64(0, 0xbfdf8bf0)                  = -1 EBADF (Bad file descriptor)
  stat64("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) =
  0
  write(2, "/usr/bin/diff: ", 15/usr/bin/diff: )         = 15
  write(2, "-", 1-)                        = 1
  write(2, ": Bad file descriptor", 21: Bad file descriptor)   = 21
  write(2, "\n", 1
)                       = 1
  close(1)                                = 0
  exit_group(2)                           = ?

the correct behaviour would be to read from file descriptor 0 as /bin/cat
does:

  /bin/echo "test" | strace /bin/cat -
  [...]
  read(0, "test\n", 4096)                 = 5
  write(1, "test\n", 5test
)                   = 5
  read(0, "", 4096)                       = 0
  close(0)                                = 0
  close(1)                                = 0
  close(2)                                = 0
  exit_group(0)                           = ?


Does somebody here know a way to avoid the open on the socketpair as this
always leads to an error ENXIO which finally destroys the socketpair.

Philipp


From MAILER-DAEMON Wed Aug 11 19:26:16 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OjKga-00059y-SC
	for mharc-bug-diffutils@gnu.org; Wed, 11 Aug 2010 19:26:16 -0400
Received: from [140.186.70.92] (port=38083 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OjKgY-00058O-Hm
	for bug-diffutils@gnu.org; Wed, 11 Aug 2010 19:26:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OjKgX-00088U-9L
	for bug-diffutils@gnu.org; Wed, 11 Aug 2010 19:26:14 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:33072)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OjKgW-000886-Td
	for bug-diffutils@gnu.org; Wed, 11 Aug 2010 19:26:13 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7BNQ60p021802; Wed, 11 Aug 2010 16:26:07 -0700 (PDT)
Message-ID: <4C63318E.9080202@cs.ucla.edu>
Date: Thu, 12 Aug 2010 01:26:06 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Philipp Thomas <pth@suse.de>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
References: <20100811123413.GC31821@paradies.suse.de>
In-Reply-To: <20100811123413.GC31821@paradies.suse.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Aug 2010 23:26:15 -0000

On 08/11/10 14:34, Philipp Thomas wrote:
> I got the following question from our ksh maintainer
> (https://bugzilla.novell.com/show_bug.cgi?id=627524)

I can't read that; it's behind some sort of registration wall.

Your email doesn't mention ksh or diff version numbers, or platform,
which makes things a bit hard to diagnose, but I'll give it a try
anyhow.

> $> echo "test" | diff - /dev/null
> diff: -: Bad file descriptor
> ...
> ksh uses socketpairs as a fast replacement for pipes which is a major
> feature of the ksh ...  I do not understand why /usr/bin/diff
> executes dup(), then opens /proc/self/fd/3, and then tries to open this:

Nor do I.  Nor can I reproduce the problem on my system (RHEL 5, ksh
93t+ 2010-02-02, diff 2.8.1).  Also, I cannot reproduce the problem
with diff 3.0, which I built myself on that host.  For example, under
ksh the command "echo abc | strace diff - /dev/null" (diff 3.0)
produces trace output like this:

...
fstat(0, {st_mode=S_IFSOCK|0400, st_size=0, ...}) = 0
clock_gettime(CLOCK_REALTIME, {1281568629, 304244000}) = 0
stat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
open("/dev/null", O_RDONLY)             = 3
read(0, "abc\n", 4096)                  = 4
read(0, "", 4092)                       = 0
read(3, "", 4096)                       = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b85118bd000
write(1, "1d0\n", 4)                    = 4
write(1, "< abc\n", 6)                  = 6
close(0)                                = 0
close(3)                                = 0
close(1)                                = 0
...

Perhaps your correspondent can drop into a debugger and see what code
is executing "dup"?  The source code of GNU diff proper never invokes
dup, as far as I can see, though no doubt some library functions might
do that.  It might be helpful to try diff 3.0, if you're not trying
that already.



From MAILER-DAEMON Thu Aug 12 04:38:19 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OjTIp-0004KQ-Bd
	for mharc-bug-diffutils@gnu.org; Thu, 12 Aug 2010 04:38:19 -0400
Received: from [140.186.70.92] (port=56191 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OjTIk-0004GQ-G9
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 04:38:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <pth@suse.de>) id 1OjTIb-0002rw-6K
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 04:38:09 -0400
Received: from cantor.suse.de ([195.135.220.2]:44779 helo=mx1.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <pth@suse.de>)
	id 1OjTIa-0002rd-Tm
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 04:38:05 -0400
Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.suse.de (Postfix) with ESMTP id 6939F8E8CC;
	Thu, 12 Aug 2010 10:38:03 +0200 (CEST)
Date: Thu, 12 Aug 2010 10:38:02 +0200
From: Philipp Thomas <pth@suse.de>
To: Paul Eggert <eggert@CS.UCLA.EDU>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Message-ID: <20100812083802.GA7805@paradies.suse.de>
References: <20100811123413.GC31821@paradies.suse.de>
	<4C63318E.9080202@cs.ucla.edu>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="jRHKVT23PllUwdXP"
Content-Disposition: inline
In-Reply-To: <4C63318E.9080202@cs.ucla.edu>
X-Operating-System: openSUSE - Kernel Linux 2.6.34-14.6-default x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
	=?iso-8859-1?Q?F=3A_Markus_Rex=2C_HRB_16746_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Aug 2010 08:38:17 -0000


--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

* Paul Eggert (eggert@CS.UCLA.EDU) [20100812 01:26]:
> On 08/11/10 14:34, Philipp Thomas wrote:
> > I got the following question from our ksh maintainer
> > (https://bugzilla.novell.com/show_bug.cgi?id=627524)
> 
> I can't read that; it's behind some sort of registration wall.

I forgot, sorry to have mentioned it.
 
> Your email doesn't mention ksh or diff version numbers, or platform,
> which makes things a bit hard to diagnose, but I'll give it a try
> anyhow.

As I wrote in the subject diff is 2.8.1. ksh is at 93t 2010-03-09 and
platform is SUSE LINUX Enterprise 11 SP1.

> Nor do I.  Nor can I reproduce the problem on my system (RHEL 5, ksh
> 93t+ 2010-02-02, diff 2.8.1).

I asked my collegue to do a ltrace and that identified the culprit. diff
(and cmp) do a reopen if input or output isn't a terminal. The solution is
to stat the file first and then add  a test for ! S_ISSOCK before reopening.
The patch I came up with is attached.

Philipp

--jRHKVT23PllUwdXP
Content-Type: text/x-patch; charset=us-ascii
Content-Disposition: attachment; filename="diffutils-no_freopen_on_socket.patch"

Index: src/diff.c
===================================================================
--- src/diff.c.orig	2008-01-10 15:43:11.000000000 +0100
+++ src/diff.c	2010-08-11 15:56:27.154686094 +0200
@@ -509,9 +509,14 @@ main (int argc, char **argv)
 
 	case BINARY_OPTION:
 #if O_BINARY
-	  binary = true;
-	  if (! isatty (STDOUT_FILENO))
-	    freopen (NULL, "wb", stdout);
+      {
+        struct stat st;
+	    binary = true;
+
+	    fstat (STDOUT_FILENO, &st);
+	    if (! S_ISSOCK(st.st_mode) && ! isatty (STDOUT_FILENO))
+	      freopen (NULL, "wb", stdout);
+      }
 #endif
 	  break;
 
@@ -1080,26 +1085,27 @@ compare_files (struct comparison const *
 	  else if (strcmp (cmp.file[f].name, "-") == 0)
 	    {
 	      cmp.file[f].desc = STDIN_FILENO;
-	      if (binary && ! isatty (STDIN_FILENO))
-		freopen (NULL, "rb", stdin);
+
 	      if (fstat (STDIN_FILENO, &cmp.file[f].stat) != 0)
 		cmp.file[f].desc = ERRNO_ENCODE (errno);
-	      else
-		{
-		  if (S_ISREG (cmp.file[f].stat.st_mode))
-		    {
-		      off_t pos = lseek (STDIN_FILENO, 0, SEEK_CUR);
-		      if (pos < 0)
-			cmp.file[f].desc = ERRNO_ENCODE (errno);
-		      else
-			cmp.file[f].stat.st_size =
-			  MAX (0, cmp.file[f].stat.st_size - pos);
-		    }
-
-		  /* POSIX 1003.1-2001 requires current time for
-		     stdin.  */
-		  set_mtime_to_now (&cmp.file[f].stat);
-		}
+
+	      if (binary && ! S_ISSOCK(cmp.file[f].stat.st_mode)
+	          && ! isatty (STDIN_FILENO))
+		freopen (NULL, "rb", stdin);
+
+              if (S_ISREG (cmp.file[f].stat.st_mode))
+                {
+                  off_t pos = lseek (STDIN_FILENO, 0, SEEK_CUR);
+                  if (pos < 0)
+                    cmp.file[f].desc = ERRNO_ENCODE (errno);
+                  else
+                    cmp.file[f].stat.st_size =
+                      MAX (0, cmp.file[f].stat.st_size - pos);
+                }
+
+              /* POSIX 1003.1-2001 requires current time for
+                 stdin.  */
+              set_mtime_to_now (&cmp.file[f].stat);
 	    }
 	  else if (stat (cmp.file[f].name, &cmp.file[f].stat) != 0)
 	    cmp.file[f].desc = ERRNO_ENCODE (errno);
Index: src/cmp.c
===================================================================
--- src/cmp.c.orig	2007-11-25 01:09:43.000000000 +0100
+++ src/cmp.c	2010-08-11 16:05:34.941178248 +0200
@@ -283,7 +283,9 @@ main (int argc, char **argv)
       if (strcmp (file[f1], "-") == 0)
 	{
 	  file_desc[f1] = STDIN_FILENO;
-	  if (O_BINARY && ! isatty (STDIN_FILENO))
+	  fstat (file_desc[f1], stat_buf + f1);
+	  if (O_BINARY && ! S_ISSOCK((stat_buf + f1).st_mode)
+	      && ! isatty (STDIN_FILENO))
 	    freopen (NULL, "rb", stdin);
 	}
       else

--jRHKVT23PllUwdXP--


From MAILER-DAEMON Thu Aug 12 05:44:03 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OjUKQ-0008Oh-QN
	for mharc-bug-diffutils@gnu.org; Thu, 12 Aug 2010 05:44:02 -0400
Received: from [140.186.70.92] (port=57692 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OjUKM-0008OQ-Vl
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 05:43:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <pth@suse.de>) id 1OjUKL-0004yW-OE
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 05:43:58 -0400
Received: from cantor.suse.de ([195.135.220.2]:46333 helo=mx1.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <pth@suse.de>)
	id 1OjUKL-0004vU-Fo
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 05:43:57 -0400
Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.suse.de (Postfix) with ESMTP id B2A0E93A00
	for <bug-diffutils@gnu.org>; Thu, 12 Aug 2010 11:43:55 +0200 (CEST)
Date: Thu, 12 Aug 2010 11:43:55 +0200
From: Philipp Thomas <pth@suse.de>
To: bug-diffutils@gnu.org
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Message-ID: <20100812094355.GB7805@paradies.suse.de>
References: <20100811123413.GC31821@paradies.suse.de>
	<4C63318E.9080202@cs.ucla.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4C63318E.9080202@cs.ucla.edu>
X-Operating-System: openSUSE - Kernel Linux 2.6.34-14.6-default x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
	=?iso-8859-1?Q?F=3A_Markus_Rex=2C_HRB_16746_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Aug 2010 09:44:00 -0000

* Paul Eggert (eggert@CS.UCLA.EDU) [20100812 01:26]:

> Nor do I.  Nor can I reproduce the problem on my system (RHEL 5, ksh
> 93t+ 2010-02-02, diff 2.8.1).

Then it seems as if RH disables the use of sockets in ksh which is a compile
time option.

Philipp


From MAILER-DAEMON Thu Aug 12 16:04:03 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Oje0R-0001oi-Rk
	for mharc-bug-diffutils@gnu.org; Thu, 12 Aug 2010 16:04:03 -0400
Received: from [140.186.70.92] (port=54202 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oje0P-0001od-Hp
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 16:04:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1Oje0O-0004Zk-Fc
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 16:04:01 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:38436)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1Oje0O-0004ZA-38
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 16:04:00 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7CK3eRU004714; Thu, 12 Aug 2010 13:03:41 -0700 (PDT)
Message-ID: <4C64539A.50403@cs.ucla.edu>
Date: Thu, 12 Aug 2010 22:03:38 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Philipp Thomas <pth@suse.de>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
References: <20100811123413.GC31821@paradies.suse.de>
	<4C63318E.9080202@cs.ucla.edu>
	<20100812083802.GA7805@paradies.suse.de>
In-Reply-To: <20100812083802.GA7805@paradies.suse.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Aug 2010 20:04:02 -0000

On 08/12/10 10:38, Philipp Thomas wrote:
> As I wrote in the subject diff is 2.8.1. ksh is at 93t 2010-03-09 and
> platform is SUSE LINUX Enterprise 11 SP1.

Ah, sorry, I missed that.

> I asked my collegue to do a ltrace and that identified the culprit. diff
> (and cmp) do a reopen if input or output isn't a terminal.

But diff and cmp do this only if O_BINARY is nonzero, which should be
true only on MS-DOS or Microsoft Windows hosts.  O_BINARY should be
zero on SuSE, since it's a Linux host and Linux doesn't distinguish
between text and binary mode.  Can you please investigate why O_BINARY
is nonzero on your platform?

Furthermore, even if O_BINARY is zero, diff does a reopen only if the
--binary option is set, which it wasn't in your test cases.  So I'm
still mystified as to why you observed that misbehavior.  Can you
please investigate why diff did a reopen even though --binary was
not used?

One other thing.  Even if diff and cmp are, despite the above
discussion, using freopen (NULL, "rb", stdin), then if freopen is
doing the funny dance with dup that your strace output described,
surely that would be a bug in freopen, not in cmp or diff proper.

> The solution is to stat the file first and then add a test for !
> S_ISSOCK before reopening.  The patch I came up with is attached.

Now I'm confused even more.  The patch you came up with was not
against diff 2.8.1; it appears to be against a more-recent version.
Have you observed the exact same bug with diffutils 3.0, and did this
patch fix the bug?  If so, can you please send strace output before
and after the patch, for both diff and cmp?  We can't simply apply the
patch as-is, since I'm pretty sure it will mess things up on MS-DOS or
Windows; and given the questions above I'm afraid that I still don't
understand the need for a patch on SUSE.

Thanks.



From MAILER-DAEMON Thu Aug 12 21:06:30 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ojij8-0003Dd-JB
	for mharc-bug-diffutils@gnu.org; Thu, 12 Aug 2010 21:06:30 -0400
Received: from [140.186.70.92] (port=48251 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ojij6-0003Bo-AC
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 21:06:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1Ojij4-0005hw-I4
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 21:06:28 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:39907)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1Ojij4-0005hn-5s
	for bug-diffutils@gnu.org; Thu, 12 Aug 2010 21:06:26 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7D16Kf0007635; Thu, 12 Aug 2010 18:06:21 -0700 (PDT)
Message-ID: <4C649A8C.8060905@cs.ucla.edu>
Date: Fri, 13 Aug 2010 03:06:20 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Christoph Anton Mitterer <calestyo@scientia.net>
Subject: Re: [bug-diffutils] bug: diff -r swaps the files it should check
References: <10d13d6fb4036cc51d36b387775aad74@imap.dd24.net>
In-Reply-To: <10d13d6fb4036cc51d36b387775aad74@imap.dd24.net>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 13 Aug 2010 01:06:30 -0000

On 08/07/10 18:50, Christoph Anton Mitterer wrote:

> I found a rather strange bug in diff (Debian version 1:3.0-1) when doing
> large backups of millions of files.
> First I've copied the data to an external HDD, then I've did an "diff -q
> -r >out 2> err" in order to find any errors.

A wise precaution!  I do that sort of thing a lot.

> The strange unicode characters had their character codes inside which read
> as follows:
> 1CEE      1CAE
> 1CAE      1CEE
> ...
> Any ideas?

My idea is that you've found and reported a bug that has been in GNU
diff ever since 2.8 was released back in 2002.  Thanks very much for
reporting this: you've undoubtedly saved others some work and
hair-pulling.

I've installed the following patch, which I hope fixes things.  If you
can test it on your data, that'd be nice.  I have verified this bug on
a much simpler test case, and this patch includes the test case to try
to make sure that a similar bug doesn't creep back in later.



>From 29ac7f191c444400c6df067647e3158a1e188ddf Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 12 Aug 2010 17:55:05 -0700
Subject: [PATCH] diff: avoid spurious diffs when two distinct dir entries compare equal

Problem reported by Christoph Anton Mitterer in:
http://lists.gnu.org/archive/html/bug-diffutils/2010-08/msg00000.html

* NEWS: Mention this bug fix.
* src/dir.c (compare_names_for_qsort): Fall back on file_name_cmp
if two distinct entries in the same directory compare equal.
(diff_dirs): Prefer a file_name_cmp match when available.
* tests/Makefile.am (TESTS): New test colliding-file-names.
* tests/colliding-file-names: New file.
---
 NEWS                       |    5 +++++
 src/dir.c                  |   41 +++++++++++++++++++++++++++++++++++++++--
 tests/Makefile.am          |    1 +
 tests/colliding-file-names |   20 ++++++++++++++++++++
 4 files changed, 65 insertions(+), 2 deletions(-)
 create mode 100644 tests/colliding-file-names

diff --git a/NEWS b/NEWS
index 27b9886..1c41e9e 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ GNU diffutils NEWS                                    -*- outline -*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Bug fixes
+
+  diff no longer reports spurious differences merely because two entries
+  in the same directory have names that compare equal in the current
+  locale, or compare equal because --ignore-file-name-case was given.
 
 * Noteworthy changes in release 3.0 (2010-05-03) [stable]
 
diff --git a/src/dir.c b/src/dir.c
index 5b4eaec..1b078ab 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -166,14 +166,16 @@ compare_names (char const *name1, char const *name2)
 	  : file_name_cmp (name1, name2));
 }
 
-/* A wrapper for compare_names suitable as an argument for qsort.  */
+/* Compare names FILE1 and FILE2 when sorting a directory.
+   Prefer filtered comparison, breaking ties with file_name_cmp.  */
 
 static int
 compare_names_for_qsort (void const *file1, void const *file2)
 {
   char const *const *f1 = file1;
   char const *const *f2 = file2;
-  return compare_names (*f1, *f2);
+  int diff = compare_names (*f1, *f2);
+  return diff ? diff : file_name_cmp (*f1, *f2);
 }
 
 /* Compare the contents of two directories named in CMP.
@@ -253,6 +255,41 @@ diff_dirs (struct comparison const *cmp,
 	     pretend the "next name" in that dir is very large.  */
 	  int nameorder = (!*names[0] ? 1 : !*names[1] ? -1
 			   : compare_names (*names[0], *names[1]));
+
+	  /* Prefer a file_name_cmp match if available.  This algorithm is
+	     O(N**2), where N is the number of names in a directory
+	     that compare_names says are all equal, but in practice N
+	     is so small it's not worth tuning.  */
+	  if (nameorder == 0)
+	    {
+	      int raw_order = file_name_cmp (*names[0], *names[1]);
+	      if (raw_order != 0)
+		{
+		  int greater_side = raw_order < 0;
+		  int lesser_side = 1 - greater_side;
+		  char const **lesser = names[lesser_side];
+		  char const *greater_name = *names[greater_side];
+		  char const **p;
+
+		  for (p = lesser + 1;
+		       *p && compare_names (*p, greater_name) == 0;
+		       p++)
+		    {
+		      int cmp = file_name_cmp (*p, greater_name);
+		      if (0 <= cmp)
+			{
+			  if (cmp == 0)
+			    {
+			      memmove (lesser + 1, lesser,
+				       (char *) p - (char *) lesser);
+			      *lesser = greater_name;
+			    }
+			  break;
+			}
+		    }
+		}
+	    }
+
 	  int v1 = (*handle_file) (cmp,
 				   0 < nameorder ? 0 : *names[0]++,
 				   nameorder < 0 ? 0 : *names[1]++);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6a4858c..242d501 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,7 @@
 TESTS = \
   basic \
   binary \
+  colliding-file-names \
   help-version	\
   function-line-vs-leading-space \
   label-vs-func	\
diff --git a/tests/colliding-file-names b/tests/colliding-file-names
new file mode 100644
index 0000000..f14dce7
--- /dev/null
+++ b/tests/colliding-file-names
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Check that diff responds well if a directory has multiple file names
+# that compare equal.
+
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+mkdir d1 d2 || fail=1
+
+for i in abc abC aBc aBC Abc AbC ABc ABC; do
+ echo $i >d1/$i || fail=1
+done
+
+for i in ABC ABc AbC Abc aBC aBc abC abc; do
+ echo $i >d2/$i || fail=1
+done
+
+diff -r --ignore-file-name-case d1 d2 || fail=1
+
+Exit $fail
-- 
1.7.2




From MAILER-DAEMON Sat Aug 14 13:28:17 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkKWm-0004HM-VD
	for mharc-bug-diffutils@gnu.org; Sat, 14 Aug 2010 13:28:17 -0400
Received: from [140.186.70.92] (port=55238 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkKWg-0004FP-BS
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 13:28:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <calestyo@scientia.net>) id 1OkKWb-0002aN-EF
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 13:28:10 -0400
Received: from mailgw02.dd24.net ([193.46.215.43]:58670)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <calestyo@scientia.net>) id 1OkKWb-0002a3-94
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 13:28:05 -0400
Received: from localhost (amavis02.dd24.net [192.168.1.113])
	by mailgw02.dd24.net (Postfix) with ESMTP id 0F20B35541E;
	Sat, 14 Aug 2010 17:28:03 +0000 (GMT)
X-Virus-Scanned: domaindiscount24.com mail filter gateway
Received: from mailgw02.dd24.net ([192.168.1.197])
	by localhost (amavis02.dd24.net [192.168.1.106]) (amavisd-new,
	port 10197)
	with ESMTP id IQr05BbENZh0; Sat, 14 Aug 2010 17:27:58 +0000 (GMT)
Received: from [192.168.0.101] (ppp-93-104-34-104.dynamic.mnet-online.de
	[93.104.34.104])
	by mailgw02.dd24.net (Postfix) with ESMTPA id 7F2E535541B;
	Sat, 14 Aug 2010 17:27:58 +0000 (GMT)
Subject: Re: [bug-diffutils] bug: diff -r swaps the files it should check
From: Christoph Anton Mitterer <calestyo@scientia.net>
To: Paul Eggert <eggert@CS.UCLA.EDU>
In-Reply-To: <4C649A8C.8060905@cs.ucla.edu>
References: <10d13d6fb4036cc51d36b387775aad74@imap.dd24.net>
	<4C649A8C.8060905@cs.ucla.edu>
Content-Type: text/plain; charset="UTF-8"
Date: Sat, 14 Aug 2010 19:27:57 +0200
Message-ID: <1281806877.7491.1.camel@fermat.scientia.net>
Mime-Version: 1.0
X-Mailer: Evolution 2.30.2 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Aug 2010 17:28:15 -0000

On Fri, 2010-08-13 at 03:06 +0200, Paul Eggert wrote:
> I've installed the following patch, which I hope fixes things.  If you
> can test it on your data, that'd be nice.  I have verified this bug on
> a much simpler test case, and this patch includes the test case to try
> to make sure that a similar bug doesn't creep back in later.
Uhm... I can't even reproduce it now with the unpatched version ^^

But now I only diff -q -r the relevant directory and not all the
500GB.... can this be the reason?


Cheers,
Chris.


btw:
What's that ^L in the code?
> +  return diff ? diff : file_name_cmp (*f1, *f2);
>  }
>  
>  /* Compare the contents of two directories named in CMP.




From MAILER-DAEMON Sat Aug 14 14:11:45 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkLCr-0007RP-GL
	for mharc-bug-diffutils@gnu.org; Sat, 14 Aug 2010 14:11:45 -0400
Received: from [140.186.70.92] (port=35066 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkLCl-0007NP-B8
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 14:11:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eblake@redhat.com>) id 1OkLCg-0008AA-HG
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 14:11:39 -0400
Received: from mx1.redhat.com ([209.132.183.28]:28192)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eblake@redhat.com>) id 1OkLCg-00089z-AC
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 14:11:34 -0400
Received: from int-mx08.intmail.prod.int.phx2.redhat.com
	(int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21])
	by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7EIBWDY016311
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Sat, 14 Aug 2010 14:11:32 -0400
Received: from [10.3.113.43] (ovpn-113-43.phx2.redhat.com [10.3.113.43])
	by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id o7EIBWpu016122; Sat, 14 Aug 2010 14:11:32 -0400
Message-ID: <4C66DC15.2010808@redhat.com>
Date: Sat, 14 Aug 2010 12:10:29 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
	rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre
	Mnenhy/0.8.3 Thunderbird/3.1.1
MIME-Version: 1.0
To: Christoph Anton Mitterer <calestyo@scientia.net>
Subject: Re: [bug-diffutils] bug: diff -r swaps the files it should check
References: <10d13d6fb4036cc51d36b387775aad74@imap.dd24.net>	<4C649A8C.8060905@cs.ucla.edu>
	<1281806877.7491.1.camel@fermat.scientia.net>
In-Reply-To: <1281806877.7491.1.camel@fermat.scientia.net>
X-Enigmail-Version: 1.1.2
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enigD6BB84BD8E274EF5A44D27AD"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
Cc: bug-diffutils@gnu.org, Paul Eggert <eggert@CS.UCLA.EDU>
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Aug 2010 18:11:44 -0000

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigD6BB84BD8E274EF5A44D27AD
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 08/14/2010 11:27 AM, Christoph Anton Mitterer wrote:
> btw:
> What's that ^L in the code?
>> +  return diff ? diff : file_name_cmp (*f1, *f2);
>>  }
>>  =0C
>>  /* Compare the contents of two directories named in CMP.

GNU Coding Standards permit the use of a line containing just ^L as a
page separator between logical chunks of code within a single file (this
is also acceptable to C89; since ^L, aka '\f' or form-feed, falls under
the category of allowable whitespace).  It was originally used in the
days of old-style printers to force a new page; but still has use today
in making searching between related chunks of code a bit easier.

--=20
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


--------------enigD6BB84BD8E274EF5A44D27AD
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJMZtwVAAoJEKeha0olJ0NqBM8H/3ceFSNKhR4FiWooORCOKTdR
FBWMtVehhg0W5kZJKtvAj+IfamLgSNcLaxkQe9TVDu/uniNmr7nprM95IbQR/l/S
ni1++JHsckXEqGmY7m6bA6Aoz5rA3Z9s1ZXIU+WguWHDSLcRZLstJfrvLM6PsPxL
drNugvQsxC0EzYz5tcewYinvGdxr3zVAh+nsLB97Ux3oNqRUNkFRJYopdMPaUKwo
ylPBqmXzX5q5Lj615OjhyKhDTlSiqXC50tdgavVTQjx2zX6VBybJYrJbAxGfn/Fv
jxL/8DqbgwDmE3SjM8IoqK3iN3QHYJjgXNdwpJnMEE+7UC/WRHY77kD+Pao6PrA=
=bJrJ
-----END PGP SIGNATURE-----

--------------enigD6BB84BD8E274EF5A44D27AD--


From MAILER-DAEMON Sat Aug 14 16:17:36 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkNAe-00083W-8S
	for mharc-bug-diffutils@gnu.org; Sat, 14 Aug 2010 16:17:36 -0400
Received: from [140.186.70.92] (port=41935 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkNAX-00083M-7i
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 16:17:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OkNAS-0006Tx-DW
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 16:17:29 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:48080)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OkNAS-0006To-3X
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 16:17:24 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7EKHL11029802; Sat, 14 Aug 2010 13:17:22 -0700 (PDT)
Message-ID: <4C66F9D1.1040202@cs.ucla.edu>
Date: Sat, 14 Aug 2010 22:17:21 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Christoph Anton Mitterer <calestyo@scientia.net>
Subject: Re: [bug-diffutils] bug: diff -r swaps the files it should check
References: <10d13d6fb4036cc51d36b387775aad74@imap.dd24.net>	
	<4C649A8C.8060905@cs.ucla.edu>
	<1281806877.7491.1.camel@fermat.scientia.net>
In-Reply-To: <1281806877.7491.1.camel@fermat.scientia.net>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Aug 2010 20:17:34 -0000

On 08/14/10 19:27, Christoph Anton Mitterer wrote:
> But now I only diff -q -r the relevant directory and not all the
> 500GB.... can this be the reason?

Yes, that could be relevant.  It also depends on your locale,
on the phase of the moon, etc.  Please don't worry if you
can't reproduce it.  I'm happy you reported it, and I'm pretty
sure we have a fix now.



From MAILER-DAEMON Sat Aug 14 17:46:44 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkOYt-0004Mg-UU
	for mharc-bug-diffutils@gnu.org; Sat, 14 Aug 2010 17:46:43 -0400
Received: from [140.186.70.92] (port=59409 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkOYn-0004Ku-K4
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 17:46:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <jim@meyering.net>) id 1OkOYi-0000cw-05
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 17:46:37 -0400
Received: from smtp1-g21.free.fr ([212.27.42.1]:47737)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <jim@meyering.net>) id 1OkOYh-0000cN-Dl
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 17:46:31 -0400
Received: from mx.meyering.net (unknown [82.230.74.64])
	by smtp1-g21.free.fr (Postfix) with ESMTP id 7B42D9400AC
	for <bug-diffutils@gnu.org>; Sat, 14 Aug 2010 23:46:25 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id 44E99D84A; Sat, 14 Aug 2010 23:46:24 +0200 (CEST)
From: Jim Meyering <jim@meyering.net>
To: bug-diffutils@gnu.org
In-Reply-To: <alpine.DEB.1.10.1006181151080.8774@cantor.unex.es> (Santiago
	Vila's message of "Fri, 18 Jun 2010 11:53:04 +0200 (CEST)")
References: <alpine.DEB.1.10.1006181151080.8774@cantor.unex.es>
Date: Sat, 14 Aug 2010 23:46:24 +0200
Message-ID: <87r5i0zx3j.fsf@meyering.net>
Lines: 196
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: 586301@bugs.debian.org, 586301-forwarded@bugs.debian.org,
	jari.aalto@cante.net
Subject: [bug-diffutils] Re: Bug#586301: diffutils: doubled slashes in
	--recursive output (path//path) (fwd)
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Aug 2010 21:46:42 -0000

Santiago Vila wrote:
> Received this from the Debian BTS.
>
> (I've given the reply-to a suitable value).
>
> ---------- Forwarded message ----------
> From: Jari Aalto <jari.aalto@cante.net>
> To: Debian Bug Tracking System <submit@bugs.debian.org>
> Date: Fri, 18 Jun 2010 11:54:30 +0300
> Subject: Bug#586301: diffutils: doubled slashes in --recursive output
>     (path//path)
>
> Package: diffutils
> Version: 1:3.0-1
> Severity: minor
>
>
> If given a directory with a trailing slash (as it occurs after TAB
> completion in Shell):
>
>     $ diff -rq .  /etc/apache2/
>     Files ./apache2.conf and /etc/apache2//apache2.conf differ
>     Only in /etc/apache2//conf.d: ganglia-webfrontend
>     Only in /etc/apache2//conf.d: javascript-common.conf
>     Only in /etc/apache2//conf.d: munin
>
> SUGGESTION
>
> Strip trailing slashes from command line arguments before using them for
> output.

Thanks to both Santiago and Jari.

Here's a quick stand-alone demo:
Before it would do this:

  $ ./diff -r a b/
  Only in b//f: g
  [Exit 1]

Now it works how we'd like:

  $ ./diff -r a b/
  Only in b/f: g
  [Exit 1]


Here's a proposed patch:

>From 280d5a1e6fd399af2fa5c9d0cfb3d88878bc2380 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 14 Aug 2010 16:23:51 -0500
Subject: [PATCH] diff -r: avoid printing excess slashes in concatenated file names

* bootstrap.conf (gnulib_modules): Add filenamecat.
* src/diff.c: Include "filenamecat.h".
(compare_files): Use file_name_concat, rather than dir_file_pathname.
* src/util.c (dir_file_pathname): Remove now-unused function.
* src/diff.h: Remove its declaration.
* tests/excess-slash: New script to test for this.
* tests/Makefile.am (TESTS): Add it.
Forwarded by Santiago Vila from <bugs.debian.org/586301a>,
reported by Jari Aalto.
---
 bootstrap.conf          |    1 +
 src/diff.c              |    7 ++++---
 src/diff.h              |    1 -
 src/util.c              |   12 ------------
 tests/Makefile.am       |    1 +
 tests/excess-slash      |   19 +++++++++++++++++++
 6 files changed, 25 insertions(+), 16 deletions(-)
 create mode 100755 tests/excess-slash
 mode change 100644 => 100755 tests/no-newline-at-eof

diff --git a/bootstrap.conf b/bootstrap.conf
index 71fbd3f..33448fb 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -33,6 +33,7 @@ extensions
 fcntl
 fdl
 file-type
+filenamecat
 fnmatch-gnu
 getopt
 gettext
diff --git a/src/diff.c b/src/diff.c
index cc1b611..807d38f 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -27,6 +27,7 @@
 #include <error.h>
 #include <exclude.h>
 #include <exitfail.h>
+#include <filenamecat.h>
 #include <file-type.h>
 #include <fnmatch.h>
 #include <getopt.h>
@@ -1067,9 +1068,9 @@ compare_files (struct comparison const *parent,
   else
     {
       cmp.file[0].name = free0
-	= dir_file_pathname (parent->file[0].name, name0);
+	= file_name_concat (parent->file[0].name, name0, NULL);
       cmp.file[1].name = free1
-	= dir_file_pathname (parent->file[1].name, name1);
+	= file_name_concat (parent->file[1].name, name1, NULL);
     }

   /* Stat the files.  */
@@ -1156,7 +1157,7 @@ compare_files (struct comparison const *parent,
       char const *fnm = cmp.file[fnm_arg].name;
       char const *dir = cmp.file[dir_arg].name;
       char const *filename = cmp.file[dir_arg].name = free0
-	= dir_file_pathname (dir, last_component (fnm));
+	= file_name_concat (dir, last_component (fnm), NULL);

       if (STREQ (fnm, "-"))
 	fatal ("cannot compare `-' to a directory");
diff --git a/src/diff.h b/src/diff.h
index 71b33f4..97f8d96 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -349,7 +349,6 @@ void print_sdiff_script (struct change *);
 extern char const change_letter[4];
 extern char const pr_program[];
 char *concat (char const *, char const *, char const *);
-char *dir_file_pathname (char const *, char const *);
 bool lines_differ (char const *, char const *);
 lin translate_line_number (struct file_data const *, lin);
 struct change *find_change (struct change *);
diff --git a/src/util.c b/src/util.c
index 3be03e9..dd14e65 100644
--- a/src/util.c
+++ b/src/util.c
@@ -756,18 +756,6 @@ zalloc (size_t size)
   memset (p, 0, size);
   return p;
 }
-
-/* Yield the newly malloc'd pathname
-   of the file in DIR whose filename is FILE.  */
-
-char *
-dir_file_pathname (char const *dir, char const *file)
-{
-  char const *base = last_component (dir);
-  size_t baselen = base_len (base);
-  bool omit_slash = baselen == 0 || base[baselen - 1] == '/';
-  return concat (dir, "/" + omit_slash, file);
-}
 
 void
 debug_script (struct change *sp)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6a4858c..5a5f0f4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,7 @@
 TESTS = \
   basic \
   binary \
+  excess-slash \
   help-version	\
   function-line-vs-leading-space \
   label-vs-func	\
diff --git a/tests/excess-slash b/tests/excess-slash
new file mode 100755
index 0000000..3ef34cc
--- /dev/null
+++ b/tests/excess-slash
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Ensure that no excess slash appears in diff -r output.
+
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+mkdir -p a/f b/f/g || framework_failure_
+echo Only in b/f: g > expected-out || framework_failure_
+
+fail=0
+
+diff -r a b/ > out 2> err && fail=1
+
+# expect no stderr
+compare err /dev/null || fail=1
+
+compare out expected-out || fail=1
+
+Exit $fail
diff --git a/tests/no-newline-at-eof b/tests/no-newline-at-eof
old mode 100644
new mode 100755
--
1.7.2.1.186.gffe84


From MAILER-DAEMON Sat Aug 14 18:02:27 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkOo7-0000Vi-Qq
	for mharc-bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:02:27 -0400
Received: from [140.186.70.92] (port=34351 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkOo3-0000UZ-UC
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:02:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OkOo2-0002Jj-QX
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:02:23 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:48339)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OkOo2-0002JV-EJ
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:02:22 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7EM27Lq000327; Sat, 14 Aug 2010 15:02:08 -0700 (PDT)
Message-ID: <4C67125F.5040208@cs.ucla.edu>
Date: Sun, 15 Aug 2010 00:02:07 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Jim Meyering <jim@meyering.net>
Subject: Re: [bug-diffutils] Re: Bug#586301: diffutils: doubled slashes in
	--recursive output (path//path) (fwd)
References: <alpine.DEB.1.10.1006181151080.8774@cantor.unex.es>
	<87r5i0zx3j.fsf@meyering.net>
In-Reply-To: <87r5i0zx3j.fsf@meyering.net>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org, 586301@bugs.debian.org,
	586301-forwarded@bugs.debian.org, jari.aalto@cante.net
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Aug 2010 22:02:25 -0000

On 08/14/10 23:46, Jim Meyering wrote:
> [PATCH] diff -r: avoid printing excess slashes in concatenated file names

Thanks, that looks good to me.  Hmm, at some point we should
replace zalloc with xzalloc too, I suppose, and maybe get
rid of diffutils' 'concat' function.


From MAILER-DAEMON Sat Aug 14 18:26:44 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkPBb-0000yn-Po
	for mharc-bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:26:43 -0400
Received: from [140.186.70.92] (port=44455 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkPBT-0000v4-Br
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:26:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <jim@meyering.net>) id 1OkPBN-0004t5-Mc
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:26:35 -0400
Received: from smtp1-g21.free.fr ([212.27.42.1]:52892)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <jim@meyering.net>) id 1OkPBN-0004sm-52
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:26:29 -0400
Received: from mx.meyering.net (unknown [82.230.74.64])
	by smtp1-g21.free.fr (Postfix) with ESMTP id 33A4494009F;
	Sun, 15 Aug 2010 00:26:22 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id B62BED84A; Sun, 15 Aug 2010 00:26:21 +0200 (CEST)
From: Jim Meyering <jim@meyering.net>
To: Paul Eggert <eggert@CS.UCLA.EDU>
In-Reply-To: <4C67125F.5040208@cs.ucla.edu> (Paul Eggert's message of "Sun, 15
	Aug 2010 00:02:07 +0200")
References: <alpine.DEB.1.10.1006181151080.8774@cantor.unex.es>
	<87r5i0zx3j.fsf@meyering.net> <4C67125F.5040208@cs.ucla.edu>
Date: Sun, 15 Aug 2010 00:26:21 +0200
Message-ID: <87lj88zv8y.fsf@meyering.net>
Lines: 203
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: bug-diffutils@gnu.org, 586301@bugs.debian.org,
	586301-forwarded@bugs.debian.org, jari.aalto@cante.net
Subject: [bug-diffutils] Re: Bug#586301: diffutils: doubled slashes in
	--recursive output (path//path) (fwd)
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Aug 2010 22:26:42 -0000

Paul Eggert wrote:
> On 08/14/10 23:46, Jim Meyering wrote:
>> [PATCH] diff -r: avoid printing excess slashes in concatenated file names
>
> Thanks, that looks good to me.  Hmm, at some point we should
> replace zalloc with xzalloc too, I suppose, and maybe get
> rid of diffutils' 'concat' function.

Hi Paul,

Thanks for the quick feedback.
FYI, my patch was relative to a slightly dated repository
and no longer applied to "master".  Also, it included an unnecessary
(but harmless) mode change for an unrelated test.

Better one below (which I'll push).

When I rebased it to work on latest, I found that the
result no longer builds with my compilation options:

    cc1: warnings being treated as errors
    dir.c: In function 'diff_dirs':
    dir.c:278: error: declaration of 'cmp' shadows a parameter [-Wshadow]
    dir.c:199: error: shadowed declaration is here [-Wshadow]
    make[2]: *** [dir.o] Error 1

Without thinking hard (meaning it might be better to change
the shadowed parameter name, "cmp"), I made this local change
to work around that:

diff --git a/src/dir.c b/src/dir.c
index 1b078ab..df89431 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -275,10 +275,10 @@ diff_dirs (struct comparison const *cmp,
 		       *p && compare_names (*p, greater_name) == 0;
 		       p++)
 		    {
-		      int cmp = file_name_cmp (*p, greater_name);
-		      if (0 <= cmp)
+		      int c = file_name_cmp (*p, greater_name);
+		      if (0 <= c)
 			{
-			  if (cmp == 0)
+			  if (c == 0)
 			    {
 			      memmove (lesser + 1, lesser,
 				       (char *) p - (char *) lesser);


>From 53de393ca335e77f22d3789100734c87868f12b3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 14 Aug 2010 17:13:28 -0500
Subject: [PATCH] diff -r: avoid printing excess slashes in concatenated file names

* bootstrap.conf (gnulib_modules): Add filenamecat.
* src/diff.c: Include "filenamecat.h".
(compare_files): Use file_name_concat, rather than dir_file_pathname.
* src/util.c (dir_file_pathname): Remove now-unused function.
* src/diff.h: Remove its declaration.
* tests/excess-slash: New script to test for this.
* tests/Makefile.am (TESTS): Add it.
Forwarded by Santiago Vila from <bugs.debian.org/586301a>,
reported by Jari Aalto.
---
 bootstrap.conf     |    1 +
 gnulib             |    2 +-
 src/diff.c         |    7 ++++---
 src/diff.h         |    1 -
 src/util.c         |   12 ------------
 tests/Makefile.am  |    3 ++-
 tests/excess-slash |   19 +++++++++++++++++++
 7 files changed, 27 insertions(+), 18 deletions(-)
 create mode 100644 tests/excess-slash

diff --git a/bootstrap.conf b/bootstrap.conf
index 2f104b3..ea1744c 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -33,6 +33,7 @@ extensions
 fcntl
 fdl
 file-type
+filenamecat
 fnmatch-gnu
 getopt
 gettext
diff --git a/gnulib b/gnulib
index 880f2b6..0c6cf5a 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 880f2b69df57af506439d6aaf1fe185a6f960e43
+Subproject commit 0c6cf5ab43555377b99d94febb2d6f23fc3d2cb0
diff --git a/src/diff.c b/src/diff.c
index cc1b611..807d38f 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -27,6 +27,7 @@
 #include <error.h>
 #include <exclude.h>
 #include <exitfail.h>
+#include <filenamecat.h>
 #include <file-type.h>
 #include <fnmatch.h>
 #include <getopt.h>
@@ -1067,9 +1068,9 @@ compare_files (struct comparison const *parent,
   else
     {
       cmp.file[0].name = free0
-	= dir_file_pathname (parent->file[0].name, name0);
+	= file_name_concat (parent->file[0].name, name0, NULL);
       cmp.file[1].name = free1
-	= dir_file_pathname (parent->file[1].name, name1);
+	= file_name_concat (parent->file[1].name, name1, NULL);
     }

   /* Stat the files.  */
@@ -1156,7 +1157,7 @@ compare_files (struct comparison const *parent,
       char const *fnm = cmp.file[fnm_arg].name;
       char const *dir = cmp.file[dir_arg].name;
       char const *filename = cmp.file[dir_arg].name = free0
-	= dir_file_pathname (dir, last_component (fnm));
+	= file_name_concat (dir, last_component (fnm), NULL);

       if (STREQ (fnm, "-"))
 	fatal ("cannot compare `-' to a directory");
diff --git a/src/diff.h b/src/diff.h
index 71b33f4..97f8d96 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -349,7 +349,6 @@ void print_sdiff_script (struct change *);
 extern char const change_letter[4];
 extern char const pr_program[];
 char *concat (char const *, char const *, char const *);
-char *dir_file_pathname (char const *, char const *);
 bool lines_differ (char const *, char const *);
 lin translate_line_number (struct file_data const *, lin);
 struct change *find_change (struct change *);
diff --git a/src/util.c b/src/util.c
index 3be03e9..dd14e65 100644
--- a/src/util.c
+++ b/src/util.c
@@ -756,18 +756,6 @@ zalloc (size_t size)
   memset (p, 0, size);
   return p;
 }
-
-/* Yield the newly malloc'd pathname
-   of the file in DIR whose filename is FILE.  */
-
-char *
-dir_file_pathname (char const *dir, char const *file)
-{
-  char const *base = last_component (dir);
-  size_t baselen = base_len (base);
-  bool omit_slash = baselen == 0 || base[baselen - 1] == '/';
-  return concat (dir, "/" + omit_slash, file);
-}
 
 void
 debug_script (struct change *sp)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 242d501..190f16a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,8 @@
-TESTS = \
+jESTS = \
   basic \
   binary \
   colliding-file-names \
+  excess-slash \
   help-version	\
   function-line-vs-leading-space \
   label-vs-func	\
diff --git a/tests/excess-slash b/tests/excess-slash
new file mode 100644
index 0000000..3ef34cc
--- /dev/null
+++ b/tests/excess-slash
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Ensure that no excess slash appears in diff -r output.
+
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+mkdir -p a/f b/f/g || framework_failure_
+echo Only in b/f: g > expected-out || framework_failure_
+
+fail=0
+
+diff -r a b/ > out 2> err && fail=1
+
+# expect no stderr
+compare err /dev/null || fail=1
+
+compare out expected-out || fail=1
+
+Exit $fail
--
1.7.2.1.186.gffe84


From MAILER-DAEMON Sat Aug 14 18:28:30 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkPDK-0001eu-7a
	for mharc-bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:28:30 -0400
Received: from [140.186.70.92] (port=40172 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkPDD-0001da-2n
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:28:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <jim@meyering.net>) id 1OkPD8-00052p-6p
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:28:22 -0400
Received: from smtp1-g21.free.fr ([212.27.42.1]:35393)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <jim@meyering.net>) id 1OkPD7-00052e-O0
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:28:18 -0400
Received: from mx.meyering.net (unknown [82.230.74.64])
	by smtp1-g21.free.fr (Postfix) with ESMTP id B18A19400AF;
	Sun, 15 Aug 2010 00:28:12 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id 884E0D84A; Sun, 15 Aug 2010 00:28:11 +0200 (CEST)
From: Jim Meyering <jim@meyering.net>
To: Paul Eggert <eggert@CS.UCLA.EDU>
In-Reply-To: <4C67125F.5040208@cs.ucla.edu> (Paul Eggert's message of "Sun, 15
	Aug 2010 00:02:07 +0200")
References: <alpine.DEB.1.10.1006181151080.8774@cantor.unex.es>
	<87r5i0zx3j.fsf@meyering.net> <4C67125F.5040208@cs.ucla.edu>
Date: Sun, 15 Aug 2010 00:28:11 +0200
Message-ID: <87fwygzv5w.fsf@meyering.net>
Lines: 11
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: bug-diffutils@gnu.org, 586301@bugs.debian.org,
	586301-forwarded@bugs.debian.org, jari.aalto@cante.net
Subject: [bug-diffutils] Re: Bug#586301: diffutils: doubled slashes in
	--recursive output (path//path) (fwd)
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Aug 2010 22:28:28 -0000

Paul Eggert wrote:

> On 08/14/10 23:46, Jim Meyering wrote:
>> [PATCH] diff -r: avoid printing excess slashes in concatenated file names
>
> Thanks, that looks good to me.  Hmm, at some point we should
> replace zalloc with xzalloc too, I suppose, and maybe get
> rid of diffutils' 'concat' function.

Oh, I see that my change has rendered concat unused as well.
I'll amend it before pushing.  Thanks.


From MAILER-DAEMON Sat Aug 14 18:29:46 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkPEY-0001yn-5O
	for mharc-bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:29:46 -0400
Received: from [140.186.70.92] (port=40376 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkPEV-0001wv-P9
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:29:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <jim@meyering.net>) id 1OkPEU-0005B9-D6
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:29:43 -0400
Received: from smtp1-g21.free.fr ([212.27.42.1]:36015)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <jim@meyering.net>) id 1OkPET-0005Am-Lw
	for bug-diffutils@gnu.org; Sat, 14 Aug 2010 18:29:42 -0400
Received: from mx.meyering.net (unknown [82.230.74.64])
	by smtp1-g21.free.fr (Postfix) with ESMTP id A145394004D;
	Sun, 15 Aug 2010 00:29:36 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id 8776AD84A; Sun, 15 Aug 2010 00:29:35 +0200 (CEST)
From: Jim Meyering <jim@meyering.net>
To: Paul Eggert <eggert@CS.UCLA.EDU>
In-Reply-To: <87fwygzv5w.fsf@meyering.net> (Jim Meyering's message of "Sun, 15
	Aug 2010 00:28:11 +0200")
References: <alpine.DEB.1.10.1006181151080.8774@cantor.unex.es>
	<87r5i0zx3j.fsf@meyering.net> <4C67125F.5040208@cs.ucla.edu>
	<87fwygzv5w.fsf@meyering.net>
Date: Sun, 15 Aug 2010 00:29:35 +0200
Message-ID: <87aaoozv3k.fsf@meyering.net>
Lines: 16
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: bug-diffutils@gnu.org, 586301@bugs.debian.org,
	586301-forwarded@bugs.debian.org, jari.aalto@cante.net
Subject: [bug-diffutils] Re: Bug#586301: diffutils: doubled slashes in
	--recursive output (path//path) (fwd)
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 14 Aug 2010 22:29:44 -0000

Jim Meyering wrote:

> Paul Eggert wrote:
>
>> On 08/14/10 23:46, Jim Meyering wrote:
>>> [PATCH] diff -r: avoid printing excess slashes in concatenated file names
>>
>> Thanks, that looks good to me.  Hmm, at some point we should
>> replace zalloc with xzalloc too, I suppose, and maybe get
>> rid of diffutils' 'concat' function.
>
> Oh, I see that my change has rendered concat unused as well.
> I'll amend it before pushing.  Thanks.

Hm.... not quite.
There's one use left.


From MAILER-DAEMON Sun Aug 15 08:03:51 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkbwN-0000Q1-8Q
	for mharc-bug-diffutils@gnu.org; Sun, 15 Aug 2010 08:03:51 -0400
Received: from [140.186.70.92] (port=39177 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkbwK-0000PC-KW
	for bug-diffutils@gnu.org; Sun, 15 Aug 2010 08:03:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <calestyo@scientia.net>) id 1OkbwG-0005W7-Bm
	for bug-diffutils@gnu.org; Sun, 15 Aug 2010 08:03:48 -0400
Received: from mailgw01.dd24.net ([193.46.215.41]:43887)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <calestyo@scientia.net>) id 1OkbwG-0005W0-76
	for bug-diffutils@gnu.org; Sun, 15 Aug 2010 08:03:44 -0400
Received: from localhost (amavis01.dd24.net [192.168.1.111])
	by mailgw01.dd24.net (Postfix) with ESMTP id 64CBF7CCB69;
	Sun, 15 Aug 2010 12:03:42 +0000 (GMT)
X-Virus-Scanned: domaindiscount24.com mail filter gateway
Received: from mailgw01.dd24.net ([192.168.1.191])
	by localhost (amavis01.dd24.net [192.168.1.105]) (amavisd-new,
	port 10191)
	with ESMTP id dxueYa5F9KtQ; Sun, 15 Aug 2010 12:03:38 +0000 (GMT)
Received: from [192.168.0.101] (ppp-93-104-111-195.dynamic.mnet-online.de
	[93.104.111.195])
	by mailgw01.dd24.net (Postfix) with ESMTPA id 4E3767CCADA;
	Sun, 15 Aug 2010 12:03:38 +0000 (GMT)
Subject: Re: [bug-diffutils] bug: diff -r swaps the files it should check
From: Christoph Anton Mitterer <calestyo@scientia.net>
To: Paul Eggert <eggert@CS.UCLA.EDU>
In-Reply-To: <4C66F9D1.1040202@cs.ucla.edu>
References: <10d13d6fb4036cc51d36b387775aad74@imap.dd24.net>
	<4C649A8C.8060905@cs.ucla.edu>
	<1281806877.7491.1.camel@fermat.scientia.net>
	<4C66F9D1.1040202@cs.ucla.edu>
Content-Type: text/plain; charset="UTF-8"
Date: Sun, 15 Aug 2010 14:03:37 +0200
Message-ID: <1281873817.3284.97.camel@fermat.scientia.net>
Mime-Version: 1.0
X-Mailer: Evolution 2.30.2 
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 15 Aug 2010 12:03:50 -0000

On Sat, 2010-08-14 at 22:17 +0200, Paul Eggert wrote:
> Yes, that could be relevant.  It also depends on your locale,
> on the phase of the moon, etc.  Please don't worry if you
> can't reproduce it.  I'm happy you reported it, and I'm pretty
> sure we have a fix now.
K,.. thx :)

btw: Even the test script seem to work ok with the old diff...


Cheers,
Chris.



From MAILER-DAEMON Sun Aug 15 17:54:38 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OklA6-00062H-Dd
	for mharc-bug-diffutils@gnu.org; Sun, 15 Aug 2010 17:54:38 -0400
Received: from [140.186.70.92] (port=33410 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Okl9z-00062B-UX
	for bug-diffutils@gnu.org; Sun, 15 Aug 2010 17:54:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1Okl9u-0006lp-CY
	for bug-diffutils@gnu.org; Sun, 15 Aug 2010 17:54:31 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:52198)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1Okl9t-0006lh-Un
	for bug-diffutils@gnu.org; Sun, 15 Aug 2010 17:54:26 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7FLsKSa010062; Sun, 15 Aug 2010 14:54:21 -0700 (PDT)
Message-ID: <4C68620C.90709@cs.ucla.edu>
Date: Sun, 15 Aug 2010 23:54:20 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Christoph Anton Mitterer <calestyo@scientia.net>
Subject: Re: [bug-diffutils] bug: diff -r swaps the files it should check
References: <10d13d6fb4036cc51d36b387775aad74@imap.dd24.net>	
	<4C649A8C.8060905@cs.ucla.edu>	
	<1281806877.7491.1.camel@fermat.scientia.net>	
	<4C66F9D1.1040202@cs.ucla.edu>
	<1281873817.3284.97.camel@fermat.scientia.net>
In-Reply-To: <1281873817.3284.97.camel@fermat.scientia.net>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 15 Aug 2010 21:54:37 -0000

On 08/15/10 14:03, Christoph Anton Mitterer wrote:

> btw: Even the test script seem to work ok with the old diff...

Yes, the test script can conceivably work with the old diff.
Again, it depends on circumstances that we can't control simply
by scripts.  However, it failed for me with the old diff, and
that is better than nothing.  I was using a fairly common Linux
platform, and if it failed for me it should fail for others.


From MAILER-DAEMON Mon Aug 16 05:46:37 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OkwH7-0004Yb-5n
	for mharc-bug-diffutils@gnu.org; Mon, 16 Aug 2010 05:46:37 -0400
Received: from [140.186.70.92] (port=60111 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OkwGs-0004XY-S5
	for bug-diffutils@gnu.org; Mon, 16 Aug 2010 05:46:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <pth@suse.de>) id 1OkwGh-0000km-4W
	for bug-diffutils@gnu.org; Mon, 16 Aug 2010 05:46:22 -0400
Received: from cantor2.suse.de ([195.135.220.15]:35706 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <pth@suse.de>)
	id 1OkwGg-0000k0-Td
	for bug-diffutils@gnu.org; Mon, 16 Aug 2010 05:46:11 -0400
Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2])
	by mx2.suse.de (Postfix) with ESMTP id 751598765C
	for <bug-diffutils@gnu.org>; Mon, 16 Aug 2010 11:46:08 +0200 (CEST)
Date: Mon, 16 Aug 2010 11:46:08 +0200
From: Philipp Thomas <pth@suse.de>
To: bug-diffutils@gnu.org
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Message-ID: <20100816094608.GA25540@paradies.suse.de>
References: <20100811123413.GC31821@paradies.suse.de>
	<4C63318E.9080202@cs.ucla.edu>
	<20100812083802.GA7805@paradies.suse.de>
	<4C64539A.50403@cs.ucla.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4C64539A.50403@cs.ucla.edu>
X-Operating-System: openSUSE - Kernel Linux 2.6.34-14.6-default x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
	=?iso-8859-1?Q?F=3A_Markus_Rex=2C_HRB_16746_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Aug 2010 09:46:35 -0000

* Paul Eggert (eggert@CS.UCLA.EDU) [20100812 22:04]:

> > The solution is to stat the file first and then add a test for !
> > S_ISSOCK before reopening.  The patch I came up with is attached.
> 
> Now I'm confused even more.  The patch you came up with was not
> against diff 2.8.1; i

Ah,botched again. The patch I sent was for 2.8.7. I was doing patches for
several distributions and that's where I picked it up.

> Have you observed the exact same bug with diffutils 3.0, and did this
> patch fix the bug?

diffutils 3.0 isn't part of any released openSUSE distribution, so I haven't
tested it yet.

> If so, can you please send strace output before and after the patch, for 
> both diff and cmp?

I will build a 3.0 package with our patches applied and then do the strace
before and after.

> and given the questions above I'm afraid that I still don't understand the
> need for a patch on SUSE.

I'll redo the tests and will send you the traces and the possibly new patch.

Philipp


From MAILER-DAEMON Wed Aug 18 11:27:51 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OlkYR-00058j-Ab
	for mharc-bug-diffutils@gnu.org; Wed, 18 Aug 2010 11:27:51 -0400
Received: from [140.186.70.92] (port=39397 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OlkYL-0004qy-1D
	for bug-diffutils@gnu.org; Wed, 18 Aug 2010 11:27:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <pth@suse.de>) id 1OlkLD-0001nz-41
	for bug-diffutils@gnu.org; Wed, 18 Aug 2010 11:14:12 -0400
Received: from cantor2.suse.de ([195.135.220.15]:52271 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <pth@suse.de>)
	id 1OlkLC-0001ns-SX
	for bug-diffutils@gnu.org; Wed, 18 Aug 2010 11:14:11 -0400
Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2])
	by mx2.suse.de (Postfix) with ESMTP id D10F387D82
	for <bug-diffutils@gnu.org>; Wed, 18 Aug 2010 17:14:09 +0200 (CEST)
Date: Wed, 18 Aug 2010 17:14:09 +0200
From: Philipp Thomas <pth@suse.de>
To: bug-diffutils@gnu.org
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Message-ID: <20100818151409.GM25540@paradies.suse.de>
References: <20100811123413.GC31821@paradies.suse.de>
	<4C63318E.9080202@cs.ucla.edu>
	<20100812083802.GA7805@paradies.suse.de>
	<4C64539A.50403@cs.ucla.edu>
	<20100816094608.GA25540@paradies.suse.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20100816094608.GA25540@paradies.suse.de>
X-Operating-System: openSUSE - Kernel Linux 2.6.34-14.6-default x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
	=?iso-8859-1?Q?F=3A_Markus_Rex=2C_HRB_16746_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Aug 2010 15:27:47 -0000

* Philipp Thomas (pth@suse.de) [20100816 11:46]:

> I will build a 3.0 package with our patches applied and then do the strace
> before and after.

I now had time to do so and diff 3.0 does not show the mentioned behaviour.

Diff 2.8.7 however does show this behaviour and as it is used in both Suse
Linux Enterprise 11 and openSUSE 11.X I will have to fix the behaviour. IMO
the error in 2.8.7 is this code:

#if O_BINARY
/* Use binary I/O when reading and writing data (--binary).
   On POSIX hosts, this has no effect.  */
static bool binary; 
#else
enum { binary = true };
#endif

Which I will fix by setting binary to false instead of true.

Philipp

-- 
Keyboard with power supply made by Commodore64.
                                           -- Seen on eBay


From MAILER-DAEMON Wed Aug 18 18:40:00 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OlrIe-0001hh-5t
	for mharc-bug-diffutils@gnu.org; Wed, 18 Aug 2010 18:40:00 -0400
Received: from [140.186.70.92] (port=59545 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OlrIX-0001hY-KL
	for bug-diffutils@gnu.org; Wed, 18 Aug 2010 18:39:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OlrIS-00087K-Qc
	for bug-diffutils@gnu.org; Wed, 18 Aug 2010 18:39:53 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:38196)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OlrIS-000879-Gu
	for bug-diffutils@gnu.org; Wed, 18 Aug 2010 18:39:48 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7IMdiRq018973; Wed, 18 Aug 2010 15:39:45 -0700 (PDT)
Message-ID: <4C6C6130.6020702@cs.ucla.edu>
Date: Thu, 19 Aug 2010 00:39:44 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Philipp Thomas <pth@suse.de>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
References: <20100811123413.GC31821@paradies.suse.de>	<4C63318E.9080202@cs.ucla.edu>	<20100812083802.GA7805@paradies.suse.de>	<4C64539A.50403@cs.ucla.edu>	<20100816094608.GA25540@paradies.suse.de>
	<20100818151409.GM25540@paradies.suse.de>
In-Reply-To: <20100818151409.GM25540@paradies.suse.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Aug 2010 22:39:58 -0000

On 08/18/10 17:14, Philipp Thomas wrote:
> IMO
> the error in 2.8.7 is this code:
> 
> #if O_BINARY
> /* Use binary I/O when reading and writing data (--binary).
>    On POSIX hosts, this has no effect.  */
> static bool binary; 
> #else
> enum { binary = true };
> #endif

I'm glad to hear that the bug is not present in
diffutils 3.0.  But I'm quite skeptical that the error
occurs in the code that you quote, since you're
quoting the 3.0 version of the code, not the
2.8.7 version.

> Which I will fix by setting binary to false instead of true.

I'm also skeptical of this fix.  Perhaps it makes
one symptom go away in one test case, but it's quite
possible that it causes problems elsewhere.


From MAILER-DAEMON Thu Aug 19 05:55:25 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Om1qG-0002zG-Q3
	for mharc-bug-diffutils@gnu.org; Thu, 19 Aug 2010 05:55:24 -0400
Received: from [140.186.70.92] (port=41266 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Om1qE-0002z5-Cp
	for bug-diffutils@gnu.org; Thu, 19 Aug 2010 05:55:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <pth@suse.de>) id 1Om1qC-0000jG-NV
	for bug-diffutils@gnu.org; Thu, 19 Aug 2010 05:55:22 -0400
Received: from cantor.suse.de ([195.135.220.2]:60883 helo=mx1.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <pth@suse.de>)
	id 1Om1qC-0000iw-Fi
	for bug-diffutils@gnu.org; Thu, 19 Aug 2010 05:55:20 -0400
Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.suse.de (Postfix) with ESMTP id D189E95A49
	for <bug-diffutils@gnu.org>; Thu, 19 Aug 2010 11:55:18 +0200 (CEST)
Date: Thu, 19 Aug 2010 11:55:18 +0200
From: Philipp Thomas <pth@suse.de>
To: bug-diffutils@gnu.org
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Message-ID: <20100819095518.GA8758@paradies.suse.de>
References: <20100811123413.GC31821@paradies.suse.de>
	<4C63318E.9080202@cs.ucla.edu>
	<20100812083802.GA7805@paradies.suse.de>
	<4C64539A.50403@cs.ucla.edu>
	<20100816094608.GA25540@paradies.suse.de>
	<20100818151409.GM25540@paradies.suse.de>
	<4C6C6130.6020702@cs.ucla.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4C6C6130.6020702@cs.ucla.edu>
X-Operating-System: openSUSE - Kernel Linux 2.6.34-14.6-default x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
	=?iso-8859-1?Q?F=3A_Markus_Rex=2C_HRB_16746_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Aug 2010 09:55:23 -0000

* Paul Eggert (eggert@CS.UCLA.EDU) [20100819 00:39]:

> I'm glad to hear that the bug is not present in diffutils 3.0.


> But I'm quite skeptical that the error occurs in the code that you quote,

Oh, gdb proves that it's the freopen because of binary being true that's
causing diff to fail on ksh.

> since you're quoting the 3.0 version of the code, not the 2.8.7 version.

No, I'm quoting the 2.8.7-cvs version that our distribution currently uses.
As I wrote in the mail (OK, I see I left out the -cvs).
 
> > Which I will fix by setting binary to false instead of true.
 
> I'm also skeptical of this fix.  Perhaps it makes one symptom go away in
> one test case, but it's quite possible that it causes problems elsewhere.

This sets binary unconditionally to true, so diff *will* do an freopen if
input or output aren't a tty and will thus fail on things like sockets as I
can reproduce anytime with the test I mentioned. And why should it cause
problems? That branch only gets into play on !O_BINARY and on those
platforms things like a reopen wb/rb are effectively nops when it comes to
the 'b'.

Philipp




From MAILER-DAEMON Thu Aug 19 15:28:04 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmAmS-0001BM-82
	for mharc-bug-diffutils@gnu.org; Thu, 19 Aug 2010 15:28:04 -0400
Received: from [140.186.70.92] (port=55989 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmAmO-0001Ar-Sq
	for bug-diffutils@gnu.org; Thu, 19 Aug 2010 15:28:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OmAmN-0004UX-Ov
	for bug-diffutils@gnu.org; Thu, 19 Aug 2010 15:28:00 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:43001)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OmAmN-0004UI-F3
	for bug-diffutils@gnu.org; Thu, 19 Aug 2010 15:27:59 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7JJRtJ1028059; Thu, 19 Aug 2010 12:27:56 -0700 (PDT)
Message-ID: <4C6D85BB.80105@cs.ucla.edu>
Date: Thu, 19 Aug 2010 21:27:55 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Philipp Thomas <pth@suse.de>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
References: <20100811123413.GC31821@paradies.suse.de>	<4C63318E.9080202@cs.ucla.edu>	<20100812083802.GA7805@paradies.suse.de>	<4C64539A.50403@cs.ucla.edu>	<20100816094608.GA25540@paradies.suse.de>	<20100818151409.GM25540@paradies.suse.de>	<4C6C6130.6020702@cs.ucla.edu>
	<20100819095518.GA8758@paradies.suse.de>
In-Reply-To: <20100819095518.GA8758@paradies.suse.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Aug 2010 19:28:02 -0000

On 08/19/10 11:55, Philipp Thomas wrote:

> Oh, gdb proves that it's the freopen because of binary being true that's
> causing diff to fail on ksh.

OK, but that doesn't mean the proposed fix is appropriate; it may cause
some problems elsewhere.

> I'm quoting the 2.8.7-cvs version that our distribution currently uses.
> As I wrote in the mail (OK, I see I left out the -cvs).

Where is the source code that your distribution currently uses?
 
>> I'm also skeptical of this fix.  Perhaps it makes one symptom go away in
>> one test case, but it's quite possible that it causes problems elsewhere.
> 
> why should it cause
> problems?

I don't know exactly; I just have That Feeling.  Wouldn't it be better if
you backported the fix that is in diffutils upstream?  Here it is:

http://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=b50a16567acff496bdf3ac0004809b6dcc88c2d6

By the way, this patch works around bugs in freopen on Solaris and *BSD,
and it appears that those bugs are in SUSE too, so you might want to
further investigate that.  I don't observe similar problems in Ubuntu.


From MAILER-DAEMON Fri Aug 20 05:00:14 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmNSQ-0001Al-QI
	for mharc-bug-diffutils@gnu.org; Fri, 20 Aug 2010 05:00:14 -0400
Received: from [140.186.70.92] (port=38224 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmNSO-000193-7K
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 05:00:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <pth@suse.de>) id 1OmNSM-0006aI-T6
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 05:00:12 -0400
Received: from cantor.suse.de ([195.135.220.2]:45447 helo=mx1.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <pth@suse.de>)
	id 1OmNSM-0006Zj-N8
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 05:00:10 -0400
Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.suse.de (Postfix) with ESMTP id 4615D9505C
	for <bug-diffutils@gnu.org>; Fri, 20 Aug 2010 11:00:06 +0200 (CEST)
Date: Fri, 20 Aug 2010 11:00:05 +0200
From: Philipp Thomas <pth@suse.de>
To: bug-diffutils@gnu.org
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Message-ID: <20100820090005.GO8758@paradies.suse.de>
References: <20100811123413.GC31821@paradies.suse.de>
	<4C63318E.9080202@cs.ucla.edu>
	<20100812083802.GA7805@paradies.suse.de>
	<4C64539A.50403@cs.ucla.edu>
	<20100816094608.GA25540@paradies.suse.de>
	<20100818151409.GM25540@paradies.suse.de>
	<4C6C6130.6020702@cs.ucla.edu>
	<20100819095518.GA8758@paradies.suse.de>
	<4C6D85BB.80105@cs.ucla.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4C6D85BB.80105@cs.ucla.edu>
X-Operating-System: openSUSE - Kernel Linux 2.6.34-14.6-default x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
	=?iso-8859-1?Q?F=3A_Markus_Rex=2C_HRB_16746_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Aug 2010 09:00:13 -0000

* Paul Eggert (eggert@CS.UCLA.EDU) [20100819 21:28]:

> Where is the source code that your distribution currently uses?

The Source rpm is here:
http://software.opensuse.org/search/download?base=openSUSE%3A11.1&file=openSUSE%3A%2F11.1%2Fstandard%2Fsrc%2Fdiffutils-2.8.7-143.11.src.rpm&query=diffutils

> http://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=b50a16567acff496bdf3ac0004809b6dcc88c2d6

As this basically does the same thing as my patch I'll use this.

> By the way, this patch works around bugs in freopen on Solaris and *BSD,
> and it appears that those bugs are in SUSE too, so you might want to
> further investigate that.  I don't observe similar problems in Ubuntu.

This would be a bug in glibc then. But I don't see where the bug would be.
Freopen basically rewinds the FILE pointer which is impossible on devices
like sockets.

Philipp


From MAILER-DAEMON Fri Aug 20 09:39:54 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmRp4-0002o1-1m
	for mharc-bug-diffutils@gnu.org; Fri, 20 Aug 2010 09:39:54 -0400
Received: from [140.186.70.92] (port=59378 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmRp1-0002nJ-42
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 09:39:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eblake@redhat.com>) id 1OmRoz-0003Jx-Nl
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 09:39:50 -0400
Received: from mx1.redhat.com ([209.132.183.28]:3469)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eblake@redhat.com>) id 1OmRoz-0003JV-HT
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 09:39:49 -0400
Received: from int-mx03.intmail.prod.int.phx2.redhat.com
	(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16])
	by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7KDdm89023858
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Fri, 20 Aug 2010 09:39:48 -0400
Received: from [10.3.113.38] (ovpn-113-38.phx2.redhat.com [10.3.113.38])
	by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id o7KDdla8032429; Fri, 20 Aug 2010 09:39:47 -0400
Message-ID: <4C6E8565.4090408@redhat.com>
Date: Fri, 20 Aug 2010 07:38:45 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
	rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre
	Mnenhy/0.8.3 Thunderbird/3.1.1
MIME-Version: 1.0
To: Philipp Thomas <pth@suse.de>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
References: <20100811123413.GC31821@paradies.suse.de>	<4C63318E.9080202@cs.ucla.edu>	<20100812083802.GA7805@paradies.suse.de>	<4C64539A.50403@cs.ucla.edu>	<20100816094608.GA25540@paradies.suse.de>	<20100818151409.GM25540@paradies.suse.de>	<4C6C6130.6020702@cs.ucla.edu>	<20100819095518.GA8758@paradies.suse.de>	<4C6D85BB.80105@cs.ucla.edu>
	<20100820090005.GO8758@paradies.suse.de>
In-Reply-To: <20100820090005.GO8758@paradies.suse.de>
X-Enigmail-Version: 1.1.2
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig5A2BA197531FD79294A9E56E"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Aug 2010 13:39:52 -0000

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig5A2BA197531FD79294A9E56E
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 08/20/2010 03:00 AM, Philipp Thomas wrote:
> * Paul Eggert (eggert@CS.UCLA.EDU) [20100819 21:28]:
>=20
>> Where is the source code that your distribution currently uses?
>=20
> The Source rpm is here:
> http://software.opensuse.org/search/download?base=3DopenSUSE%3A11.1&fil=
e=3DopenSUSE%3A%2F11.1%2Fstandard%2Fsrc%2Fdiffutils-2.8.7-143.11.src.rpm&=
query=3Ddiffutils
>=20
>> http://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=3Db50a16567a=
cff496bdf3ac0004809b6dcc88c2d6
>=20
> As this basically does the same thing as my patch I'll use this.
>=20
>> By the way, this patch works around bugs in freopen on Solaris and *BS=
D,
>> and it appears that those bugs are in SUSE too, so you might want to
>> further investigate that.  I don't observe similar problems in Ubuntu.=

>=20
> This would be a bug in glibc then. But I don't see where the bug would =
be.
> Freopen basically rewinds the FILE pointer which is impossible on devic=
es
> like sockets.

freopen(NULL,"wb",stdout) has implementation-defined effects.  On
cygwin, it is defined as forcing the file to be in binary mode (and is
always safe, even on sockets).  On other platforms, it may have no
effects (other than rewinding the current FILE offset), or it may be an
error.  Basically, diff should not be calling freopen except in cases
where it knows that the implementation-defined effect is desirable.  The
bug was that because diff was not checking whether O_BINARY was non-zero
before calling freopen, that it ended up calling freopen on platforms
where the effects were not defined to have the same effects as on cygwin
where the call is needed.

--=20
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


--------------enig5A2BA197531FD79294A9E56E
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJMboVlAAoJEKeha0olJ0NqkC0IAJflMDZ0HsGDmeMn9EDpFLla
kVCUKxcdVzU1vQHZB+v6gOieVC5sCG6XZhQFWQaP1kikQKQP/In4EHQ9yLMlmCyK
a10u2xcjHCwUCONe6kEdMkxi8U31BvalK/tZ2mNTxq4I/GSOml6IBSRSn0+HayK7
8hK3UdmMcdlBMZCEEujZ0ssIj/nNHXFi7biO3t/q+O9mmDjwv2AM1M7yAUmBHFaJ
jCH3Qit7yqjbL0nmXa52KFaHnreshCAu6MBaD82pwM4BAupXkzL5Vb9YUAdOCIpv
Bn5IjYOpRn7BxPF+Yk1lJprT3Pl/mMjmPJUqO6Vr/t8UktFB2fHnFJGqf8oJesU=
=0tP/
-----END PGP SIGNATURE-----

--------------enig5A2BA197531FD79294A9E56E--


From MAILER-DAEMON Fri Aug 20 16:12:20 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmXwq-0003n0-Gm
	for mharc-bug-diffutils@gnu.org; Fri, 20 Aug 2010 16:12:20 -0400
Received: from [140.186.70.92] (port=44784 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmXwo-0003mv-H4
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 16:12:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OmXwn-00033V-9X
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 16:12:18 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:49090)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OmXwm-00033B-US
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 16:12:17 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7KKCCGD009482; Fri, 20 Aug 2010 13:12:13 -0700 (PDT)
Message-ID: <4C6EE19C.2090105@cs.ucla.edu>
Date: Fri, 20 Aug 2010 22:12:12 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Eric Blake <eblake@redhat.com>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
References: <20100811123413.GC31821@paradies.suse.de>	<4C63318E.9080202@cs.ucla.edu>	<20100812083802.GA7805@paradies.suse.de>	<4C64539A.50403@cs.ucla.edu>	<20100816094608.GA25540@paradies.suse.de>	<20100818151409.GM25540@paradies.suse.de>	<4C6C6130.6020702@cs.ucla.edu>	<20100819095518.GA8758@paradies.suse.de>	<4C6D85BB.80105@cs.ucla.edu>	<20100820090005.GO8758@paradies.suse.de>
	<4C6E8565.4090408@redhat.com>
In-Reply-To: <4C6E8565.4090408@redhat.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Aug 2010 20:12:19 -0000

On 08/20/10 15:38, Eric Blake wrote:
> freopen(NULL,"wb",stdout) has implementation-defined effects

That's true for the C standard, but POSIX is reasonably specific
about the fact that changing a file's mode from "w" to "wb" is
not a change at all, and that no file descriptors need to be
opened, duped, or allocated in order to perform this non-change.
I still think SUSE is buggy, but I realize that diffutils needs
to (and has) worked around the bug.


From MAILER-DAEMON Fri Aug 20 16:17:36 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmY1w-0004zZ-Gq
	for mharc-bug-diffutils@gnu.org; Fri, 20 Aug 2010 16:17:36 -0400
Received: from [140.186.70.92] (port=60406 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmY1t-0004yC-QQ
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 16:17:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eblake@redhat.com>) id 1OmY1s-0003cT-LD
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 16:17:33 -0400
Received: from mx1.redhat.com ([209.132.183.28]:60787)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eblake@redhat.com>) id 1OmY1s-0003cL-Ca
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 16:17:32 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
	(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
	by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7KKHDEG015346
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Fri, 20 Aug 2010 16:17:13 -0400
Received: from [10.3.113.74] (ovpn-113-74.phx2.redhat.com [10.3.113.74])
	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id o7KKHCjh007649; Fri, 20 Aug 2010 16:17:13 -0400
Message-ID: <4C6EE28A.1080701@redhat.com>
Date: Fri, 20 Aug 2010 14:16:10 -0600
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
	rv:1.9.2.8) Gecko/20100805 Red Hat/3.1.2-2.el6 Mnenhy/0.8.3
	Thunderbird/3.1.2
MIME-Version: 1.0
To: Paul Eggert <eggert@CS.UCLA.EDU>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
References: <20100811123413.GC31821@paradies.suse.de>	<4C63318E.9080202@cs.ucla.edu>	<20100812083802.GA7805@paradies.suse.de>	<4C64539A.50403@cs.ucla.edu>	<20100816094608.GA25540@paradies.suse.de>	<20100818151409.GM25540@paradies.suse.de>	<4C6C6130.6020702@cs.ucla.edu>	<20100819095518.GA8758@paradies.suse.de>	<4C6D85BB.80105@cs.ucla.edu>	<20100820090005.GO8758@paradies.suse.de>
	<4C6E8565.4090408@redhat.com> <4C6EE19C.2090105@cs.ucla.edu>
In-Reply-To: <4C6EE19C.2090105@cs.ucla.edu>
X-Enigmail-Version: 1.1.2
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig94B0374F39C0E4A003D2E9BA"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Aug 2010 20:17:34 -0000

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig94B0374F39C0E4A003D2E9BA
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 08/20/2010 02:12 PM, Paul Eggert wrote:
> On 08/20/10 15:38, Eric Blake wrote:
>> freopen(NULL,"wb",stdout) has implementation-defined effects
>=20
> That's true for the C standard, but POSIX is reasonably specific
> about the fact that changing a file's mode from "w" to "wb" is
> not a change at all,

Maybe so, but POSIX is still quite clear that passing a NULL pointer
instead of a filename is implementation defined:
http://www.opengroup.org/onlinepubs/9699919799/functions/freopen.html

If filename is a null pointer, the freopen() function shall attempt to
change the mode of the stream to that specified by mode, as if the name
of the file currently associated with the stream had been used. In this
case, the file descriptor associated with the stream need not be closed
if the call to freopen() succeeds. It is implementation-defined which
changes of mode are permitted (if any), and under what circumstances.


> and that no file descriptors need to be
> opened, duped, or allocated in order to perform this non-change.

None need be opened, but likewise the implementation is not forbidden
from forbidding all mode changes in all cases, in which case the
implementation is free to document that passing a NULL first argument
will never succeed.

--=20
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


--------------enig94B0374F39C0E4A003D2E9BA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJMbuKKAAoJEKeha0olJ0NqILwH/Rfpqybecsf1i23gzjbkGREg
l+1pfEd2h7VaTmyyDOYMco5z1leqmxycA+lgs/gtuHtJ5x4aQpd9tuvaaWztfKxe
H7GKy4RwdfGmhiC+AEElb46Te9tB+tZtg3WkNE3VuYOnrvKJVXhc5Ex4ltTqS4wY
/GGO1IqLQbjfZfqKjb5hBqfxFYJz5ArzRmzSXzS7uFtWv5K6KN9KMIuQdkFKisCW
5qPjK4egaqzvoQVVmJu0TE4byUaydometonu2PBtNWJasP0eNQgP3TtPX/ktSAM5
083FRTpN/GB7+3NF/QenKbt7K003iXcPGkaBPEPJD8K2IINnew3tvbiB24m2b9c=
=1cqH
-----END PGP SIGNATURE-----

--------------enig94B0374F39C0E4A003D2E9BA--


From MAILER-DAEMON Fri Aug 20 18:24:18 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Oma0Y-0001qR-LK
	for mharc-bug-diffutils@gnu.org; Fri, 20 Aug 2010 18:24:18 -0400
Received: from [140.186.70.92] (port=34271 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oma0V-0001oN-Fo
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 18:24:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1Oma0S-0001Aq-8z
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 18:24:13 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:49787)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1Oma0R-00019N-Qy
	for bug-diffutils@gnu.org; Fri, 20 Aug 2010 18:24:12 -0400
Received: from [IPv6:::1] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7KMO3Cm010652; Fri, 20 Aug 2010 15:24:04 -0700 (PDT)
Message-ID: <4C6F0083.6090302@cs.ucla.edu>
Date: Sat, 21 Aug 2010 00:24:03 +0200
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Eric Blake <eblake@redhat.com>
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
References: <20100811123413.GC31821@paradies.suse.de>	<4C63318E.9080202@cs.ucla.edu>	<20100812083802.GA7805@paradies.suse.de>	<4C64539A.50403@cs.ucla.edu>	<20100816094608.GA25540@paradies.suse.de>	<20100818151409.GM25540@paradies.suse.de>	<4C6C6130.6020702@cs.ucla.edu>	<20100819095518.GA8758@paradies.suse.de>	<4C6D85BB.80105@cs.ucla.edu>	<20100820090005.GO8758@paradies.suse.de>
	<4C6E8565.4090408@redhat.com> <4C6EE19C.2090105@cs.ucla.edu>
	<4C6EE28A.1080701@redhat.com>
In-Reply-To: <4C6EE28A.1080701@redhat.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Aug 2010 22:24:17 -0000

On 08/20/10 22:16, Eric Blake wrote:
> It is implementation-defined which
> changes of mode are permitted (if any), and under what circumstances.

That quote is taken directly from the C standard.  The later part of the
POSIX freopen section defines constraints on POSIX implementations,
over and above the very loose requirements of the C standard itself.
It is the POSIX requirements that I was referring to.


From MAILER-DAEMON Mon Aug 23 05:42:41 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OnTY8-0004HZ-Qg
	for mharc-bug-diffutils@gnu.org; Mon, 23 Aug 2010 05:42:40 -0400
Received: from [140.186.70.92] (port=59197 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OnTY6-0004GJ-UM
	for bug-diffutils@gnu.org; Mon, 23 Aug 2010 05:42:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <pth@suse.de>) id 1OnTY5-0007aG-LW
	for bug-diffutils@gnu.org; Mon, 23 Aug 2010 05:42:38 -0400
Received: from cantor2.suse.de ([195.135.220.15]:60603 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <pth@suse.de>)
	id 1OnTY5-0007Zv-Gk
	for bug-diffutils@gnu.org; Mon, 23 Aug 2010 05:42:37 -0400
Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2])
	by mx2.suse.de (Postfix) with ESMTP id 9B9F78ADF6
	for <bug-diffutils@gnu.org>; Mon, 23 Aug 2010 11:42:34 +0200 (CEST)
Date: Mon, 23 Aug 2010 11:42:34 +0200
From: Philipp Thomas <pth@suse.de>
To: bug-diffutils@gnu.org
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Message-ID: <20100823094234.GQ8758@paradies.suse.de>
References: <20100812083802.GA7805@paradies.suse.de>
	<4C64539A.50403@cs.ucla.edu>
	<20100816094608.GA25540@paradies.suse.de>
	<20100818151409.GM25540@paradies.suse.de>
	<4C6C6130.6020702@cs.ucla.edu>
	<20100819095518.GA8758@paradies.suse.de>
	<4C6D85BB.80105@cs.ucla.edu>
	<20100820090005.GO8758@paradies.suse.de>
	<4C6E8565.4090408@redhat.com> <4C6EE19C.2090105@cs.ucla.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4C6EE19C.2090105@cs.ucla.edu>
X-Operating-System: openSUSE - Kernel Linux 2.6.34-14.6-default x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
	=?iso-8859-1?Q?F=3A_Markus_Rex=2C_HRB_16746_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.20 (2009-06-14)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Aug 2010 09:42:40 -0000

* Paul Eggert (eggert@CS.UCLA.EDU) [20100820 22:12]:

> I still think SUSE is buggy

SUSE isn't buggy, it may be that the version of glibc used is buggy. If so,
that would have to be reported to the glibc folks. If I hav e a bit spare
time I'll check the glibc sources.

Philipp


From MAILER-DAEMON Mon Aug 30 10:21:48 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Oq5F6-0008Ta-RU
	for mharc-bug-diffutils@gnu.org; Mon, 30 Aug 2010 10:21:48 -0400
Received: from [140.186.70.92] (port=45523 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OpxvE-0005NU-Lo
	for bug-diffutils@gnu.org; Mon, 30 Aug 2010 02:32:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <2134918@gmail.com>) id 1OpxvA-0005cZ-4B
	for bug-diffutils@gnu.org; Mon, 30 Aug 2010 02:32:48 -0400
Received: from mail-yx0-f169.google.com ([209.85.213.169]:60439)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <2134918@gmail.com>) id 1OpxvA-0005cU-0Y
	for bug-diffutils@gnu.org; Mon, 30 Aug 2010 02:32:44 -0400
Received: by yxk8 with SMTP id 8so587883yxk.0
	for <bug-diffutils@gnu.org>; Sun, 29 Aug 2010 23:32:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:received:date:message-id
	:subject:from:to:content-type;
	bh=mEIJzbdYthq1eY2LXiTxBRWkm2arB1v5fobZH5YJaqE=;
	b=e0/LlL3gXTLdd7jjfM/iUmhmJg9kVA/CdSZ/ja2U9aCyREF/ih992MXf9DFSKf+4i8
	KAok4o+HSGJI4+x1Gee2T+zMeemg6A+/rspkEU4wwO5ubdF8+V5hOhtnYQA5v+DLHp7b
	J4MoNnb1cpAEuDeqLrYO/czWvgwFWyr0XK6ds=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=RXpgoLRbiYb+wy+VfOJaARQUYPPD92JPek8DffKwllLKcdF3v/YRaFTxjqpPhkrnnc
	MwuBxnWDSgshhFn9IVLECU8cHJYLk4xLDkLV/Q5Nwhjs2xyUcoRBsmzptaopZ/PDOxPi
	BPRu+SDpZD8bfAicURhnJx9OxytI5CNxB0jM8=
MIME-Version: 1.0
Received: by 10.151.40.15 with SMTP id s15mr4793951ybj.382.1283149962885; Sun,
	29 Aug 2010 23:32:42 -0700 (PDT)
Received: by 10.231.17.8 with HTTP; Sun, 29 Aug 2010 23:32:42 -0700 (PDT)
Date: Mon, 30 Aug 2010 08:32:42 +0200
Message-ID: <AANLkTimfyCPhj9O5OQQQ9foDuhXjqvkErbQJGRk9yuSs@mail.gmail.com>
From: Piotr Stefaniak <2134918@gmail.com>
To: bug-diffutils@gnu.org
Content-Type: multipart/mixed; boundary=0015175114a8bb3bfd048f04a1ef
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Mailman-Approved-At: Mon, 30 Aug 2010 10:21:47 -0400
Subject: [bug-diffutils] New option for diff: ignore changes in ANSI C
	comments
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Aug 2010 06:32:53 -0000

--0015175114a8bb3bfd048f04a1ef
Content-Type: text/plain; charset=ISO-8859-1

I needed an option to ignore changes in comments, so I made a patch
and it seems to work. If it's ok, please apply it to the main source.
The patch was made against diff 3.0.9-53de.

Piotr Stefaniak

--0015175114a8bb3bfd048f04a1ef
Content-Type: text/x-patch; charset=US-ASCII; name="strip-ansic-comments.patch"
Content-Disposition: attachment; filename="strip-ansic-comments.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gdgxitvs0

ZGlmZiAtLWdpdCBhL3NyYy9kaWZmLmMgYi9zcmMvZGlmZi5jCmluZGV4IDgwN2QzOGYuLjM0MWY1
N2YgMTAwNjQ0Ci0tLSBhL3NyYy9kaWZmLmMKKysrIGIvc3JjL2RpZmYuYwpAQCAtMTI0LDYgKzEy
NCw3IEBAIGVudW0KICAgTk9STUFMX09QVElPTiwKICAgU0RJRkZfTUVSR0VfQVNTSVNUX09QVElP
TiwKICAgU1RSSVBfVFJBSUxJTkdfQ1JfT1BUSU9OLAorICBTVFJJUF9BTlNJQ19DT01NRU5UU19P
UFRJT04sCiAgIFNVUFBSRVNTX0JMQU5LX0VNUFRZX09QVElPTiwKICAgU1VQUFJFU1NfQ09NTU9O
X0xJTkVTX09QVElPTiwKICAgVEFCU0laRV9PUFRJT04sCkBAIC0yMDIsNiArMjAzLDcgQEAgc3Rh
dGljIHN0cnVjdCBvcHRpb24gY29uc3QgbG9uZ29wdHNbXSA9CiAgIHsic3BlZWQtbGFyZ2UtZmls
ZXMiLCAwLCAwLCAnSCd9LAogICB7InN0YXJ0aW5nLWZpbGUiLCAxLCAwLCAnUyd9LAogICB7InN0
cmlwLXRyYWlsaW5nLWNyIiwgMCwgMCwgU1RSSVBfVFJBSUxJTkdfQ1JfT1BUSU9OfSwKKyAgeyJz
dHJpcC1hbnNpYy1jb21tZW50cyIsIDAsIDAsIFNUUklQX0FOU0lDX0NPTU1FTlRTX09QVElPTn0s
CiAgIHsic3VwcHJlc3MtYmxhbmstZW1wdHkiLCAwLCAwLCBTVVBQUkVTU19CTEFOS19FTVBUWV9P
UFRJT059LAogICB7InN1cHByZXNzLWNvbW1vbi1saW5lcyIsIDAsIDAsIFNVUFBSRVNTX0NPTU1P
Tl9MSU5FU19PUFRJT059LAogICB7InRhYnNpemUiLCAxLCAwLCBUQUJTSVpFX09QVElPTn0sCkBA
IC01NzUsNiArNTc3LDEwIEBAIG1haW4gKGludCBhcmdjLCBjaGFyICoqYXJndikKIAkgIHN0cmlw
X3RyYWlsaW5nX2NyID0gdHJ1ZTsKIAkgIGJyZWFrOwogCisJY2FzZSBTVFJJUF9BTlNJQ19DT01N
RU5UU19PUFRJT046CisJICBzdHJpcF9hbnNpY19jb21tZW50cyA9IHRydWU7CisJICBicmVhazsK
KwogCWNhc2UgU1VQUFJFU1NfQkxBTktfRU1QVFlfT1BUSU9OOgogCSAgc3VwcHJlc3NfYmxhbmtf
ZW1wdHkgPSB0cnVlOwogCSAgYnJlYWs7CkBAIC04NTMsNiArODU5LDcgQEAgc3RhdGljIGNoYXIg
Y29uc3QgKiBjb25zdCBvcHRpb25faGVscF9tc2dpZFtdID0gewogICBOXygiLUIgIC0taWdub3Jl
LWJsYW5rLWxpbmVzICBJZ25vcmUgY2hhbmdlcyB3aG9zZSBsaW5lcyBhcmUgYWxsIGJsYW5rLiIp
LAogICBOXygiLUkgUkUgIC0taWdub3JlLW1hdGNoaW5nLWxpbmVzPVJFICBJZ25vcmUgY2hhbmdl
cyB3aG9zZSBsaW5lcyBhbGwgbWF0Y2ggUkUuIiksCiAgIE5fKCItLXN0cmlwLXRyYWlsaW5nLWNy
ICBTdHJpcCB0cmFpbGluZyBjYXJyaWFnZSByZXR1cm4gb24gaW5wdXQuIiksCisgIE5fKCItLXN0
cmlwLWFuc2ljLWNvbW1lbnRzICBTdHJpcCBBTlNJIEMgY29tbWVudHMgb24gaW5wdXQuIiksCiAj
aWYgT19CSU5BUlkKICAgTl8oIi0tYmluYXJ5ICBSZWFkIGFuZCB3cml0ZSBkYXRhIGluIGJpbmFy
eSBtb2RlLiIpLAogI2VuZGlmCmRpZmYgLS1naXQgYS9zcmMvZGlmZi5oIGIvc3JjL2RpZmYuaApp
bmRleCA5N2Y4ZDk2Li4wZTE3NjliIDEwMDY0NAotLS0gYS9zcmMvZGlmZi5oCisrKyBiL3NyYy9k
aWZmLmgKQEAgLTE1Niw2ICsxNTYsOSBAQCBYVEVSTiBib29sIHN1cHByZXNzX2JsYW5rX2VtcHR5
OwogLyogUmVtb3ZlIHRyYWlsaW5nIGNhcnJpYWdlIHJldHVybnMgZnJvbSBpbnB1dC4gICovCiBY
VEVSTiBib29sIHN0cmlwX3RyYWlsaW5nX2NyOwogCisvKiBSZW1vdmUgQU5TSSBDIGNvbW1lbnRz
IGZyb20gaW5wdXQuICAqLworWFRFUk4gYm9vbCBzdHJpcF9hbnNpY19jb21tZW50czsKKwogLyog
SW4gZGlyZWN0b3J5IGNvbXBhcmlzb24sIHNwZWNpZnkgZmlsZSB0byBzdGFydCB3aXRoICgtUyku
CiAgICBUaGlzIGlzIHVzZWQgZm9yIHJlc3VtaW5nIGFuIGFib3J0ZWQgY29tcGFyaXNvbi4KICAg
IEFsbCBmaWxlIG5hbWVzIGxlc3MgdGhhbiB0aGlzIG5hbWUgYXJlIGlnbm9yZWQuICAqLwpkaWZm
IC0tZ2l0IGEvc3JjL2RpZmYzLmMgYi9zcmMvZGlmZjMuYwppbmRleCAwZjExZmRjLi5hNDQ1ZGQ1
IDEwMDY0NAotLS0gYS9zcmMvZGlmZjMuYworKysgYi9zcmMvZGlmZjMuYwpAQCAtMTM5LDYgKzEz
OSw5IEBAIHN0YXRpYyBib29sIHRleHQ7CiAvKiBSZW1vdmUgdHJhaWxpbmcgY2FycmlhZ2UgcmV0
dXJucyBmcm9tIGlucHV0LiAgKi8KIHN0YXRpYyBib29sIHN0cmlwX3RyYWlsaW5nX2NyOwogCisv
KiBSZW1vdmUgQU5TSSBDIGNvbW1lbnRzIGZyb20gaW5wdXQuICAqLworc3RhdGljIGJvb2wgc3Ry
aXBfYW5zaWNfY29tbWVudHM7CisKIC8qIElmIG5vbnplcm8sIHdyaXRlIG91dCBhbiBlZCBzY3Jp
cHQgaW5zdGVhZCBvZiB0aGUgc3RhbmRhcmQgZGlmZjMgZm9ybWF0LiAgKi8KIHN0YXRpYyBib29s
IGVkc2NyaXB0OwogCmRpZmYgLS1naXQgYS9zcmMvaW8uYyBiL3NyYy9pby5jCmluZGV4IDAzMWJl
M2QuLjYzYmJiNjcgMTAwNjQ0Ci0tLSBhL3NyYy9pby5jCisrKyBiL3NyYy9pby5jCkBAIC01MjMs
NiArNTIzLDQ2IEBAIHByZXBhcmVfdGV4dCAoc3RydWN0IGZpbGVfZGF0YSAqY3VycmVudCkKICAg
LyogRG9uJ3QgdXNlIHVuaW5pdGlhbGl6ZWQgc3RvcmFnZSB3aGVuIHBsYW50aW5nIG9yIHVzaW5n
IHNlbnRpbmVscy4gICovCiAgIG1lbXNldCAocCArIGJ1ZmZlcmVkLCAwLCBzaXplb2YgKHdvcmQp
KTsKIAorICBpZiAoc3RyaXBfYW5zaWNfY29tbWVudHMgJiYgKGRzdCA9IG1lbWNociAocCwgJy8n
LCBidWZmZXJlZCkpKQorICAgIHsKKyAgICAgIGNoYXIgY29uc3QgKnNyYyA9IGRzdDsKKyAgICAg
IGNoYXIgY29uc3QgKnNyY2xpbSA9IHAgKyBidWZmZXJlZDsKKyAgICAgIGludCBpbiA9IDA7CisK
KyAgICAgIGRvCisJeworCSAgaWYgKCFpbikKKwkgICAgeworCSAgICAgIGlmICgqc3JjID09ICcv
JykKKwkJeworCQkgIGlmICgrK3NyYyA+PSBzcmNsaW0pCisJCSAgICB7CisJCSAgICAgICpkc3Qr
KyA9ICpzcmM7CisJCSAgICAgIGJyZWFrOworCQkgICAgfQorCisJCSAgaWYgKCpzcmMgPT0gJyon
KQorCQkgICAgeworCQkgICAgICBzcmMrKzsKKwkJICAgICAgaW4gPSAxOworCQkgICAgICBjb250
aW51ZTsKKwkJICAgIH0KKwkJICBlbHNlCisJCSAgICAqZHN0KysgPSAnLyc7CisJCX0KKwkgICAg
ICAqZHN0KysgPSAqc3JjKys7CisJICAgIH0KKwkgIGVsc2UgaWYgKCpzcmMrKyA9PSAnKicgJiYg
KnNyYyA9PSAnLycpCisJICAgIHsKKwkgICAgICBzcmMrKzsKKwkgICAgICBpbiA9IDA7CisJICAg
IH0KKwl9CisgICAgICB3aGlsZSAoc3JjIDwgc3JjbGltKTsKKworICAgICAgYnVmZmVyZWQgLT0g
c3JjIC0gZHN0OworICAgIH0KKwogICBpZiAoc3RyaXBfdHJhaWxpbmdfY3IgJiYgKGRzdCA9IG1l
bWNociAocCwgJ1xyJywgYnVmZmVyZWQpKSkKICAgICB7CiAgICAgICBjaGFyIGNvbnN0ICpzcmMg
PSBkc3Q7Cg==
--0015175114a8bb3bfd048f04a1ef--


From MAILER-DAEMON Mon Aug 30 15:44:34 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OqAHS-0007RV-T5
	for mharc-bug-diffutils@gnu.org; Mon, 30 Aug 2010 15:44:34 -0400
Received: from [140.186.70.92] (port=60555 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OqAH8-00073Y-RB
	for bug-diffutils@gnu.org; Mon, 30 Aug 2010 15:44:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OqADH-0006qB-O9
	for bug-diffutils@gnu.org; Mon, 30 Aug 2010 15:40:16 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:34011)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1OqADH-0006q4-FZ
	for bug-diffutils@gnu.org; Mon, 30 Aug 2010 15:40:15 -0400
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id
	o7UJeC7d006239; Mon, 30 Aug 2010 12:40:12 -0700 (PDT)
Message-ID: <4C7C091C.5050900@cs.ucla.edu>
Date: Mon, 30 Aug 2010 12:40:12 -0700
From: Paul Eggert <eggert@CS.UCLA.EDU>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
MIME-Version: 1.0
To: Piotr Stefaniak <2134918@gmail.com>
Subject: Re: [bug-diffutils] New option for diff: ignore changes in ANSI C
	comments
References: <AANLkTimfyCPhj9O5OQQQ9foDuhXjqvkErbQJGRk9yuSs@mail.gmail.com>
In-Reply-To: <AANLkTimfyCPhj9O5OQQQ9foDuhXjqvkErbQJGRk9yuSs@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
Cc: bug-diffutils@gnu.org
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-diffutils>
List-Post: <mailto:bug-diffutils@gnu.org>
List-Help: <mailto:bug-diffutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Aug 2010 19:44:33 -0000

On 08/29/10 23:32, Piotr Stefaniak wrote:
> I needed an option to ignore changes in comments, so I made a patch
> and it seems to work. If it's ok, please apply it to the main source.
> The patch was made against diff 3.0.9-53de.

I have my doubts about this one.  For one thing, it doesn't
parse ANSI C comments correctly, for example:

	/* This is a valid C comment.  What sort of $@!??/
	   idiot committee designed this syntax?  */

is a valid ANSI C comment.  More generally, some C compilers
ignore white space at ends of lines and others don't, and this
affects backslash-newline processing and therefore affects the
boundaries of comments.  My kneejerk reaction is that this is
a specialized swamp that diffutils should steer clear of.

It might be useful to have a more-general filtering option,
which allows users to specify arbitrary filters (as processes)
on the input files, before "diff" does its work.  Then, you could
write your own process to remove comments.


