From MAILER-DAEMON Fri Oct 01 11:10:14 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P1hFW-0007Xp-93
	for mharc-bug-diffutils@gnu.org; Fri, 01 Oct 2010 11:10:14 -0400
Received: from [140.186.70.92] (port=47945 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P1hFN-0006Xf-U0
	for bug-diffutils@gnu.org; Fri, 01 Oct 2010 11:10:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <khali@linux-fr.org>) id 1P1h1Z-0004WA-33
	for bug-diffutils@gnu.org; Fri, 01 Oct 2010 10:55:52 -0400
Received: from zone0.gcu-squad.org ([212.85.147.21]:13662
	helo=services.gcu-squad.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <khali@linux-fr.org>) id 1P1h1Y-0004SZ-Ux
	for bug-diffutils@gnu.org; Fri, 01 Oct 2010 10:55:49 -0400
Received: from jdelvare.pck.nerim.net ([62.212.121.182] helo=endymion.delvare)
	by services.gcu-squad.org (GCU Mailer Daemon) with esmtpsa id
	1P1h1L-0006JE-2h (TLSv1:AES128-SHA:128)
	(envelope-from <khali@linux-fr.org>)
	; Fri, 01 Oct 2010 16:55:35 +0200
Date: Fri, 1 Oct 2010 16:55:32 +0200
From: Jean Delvare <khali@linux-fr.org>
To: Paul Eggert <eggert@CS.UCLA.EDU>
Subject: Re: [bug-diffutils] [BUG] Incorrect diff output (diff -d is correct)
Message-ID: <20101001165532.716ffc41@endymion.delvare>
In-Reply-To: <4CA4C081.4010109@cs.ucla.edu>
References: <20100929184529.470cffd3@endymion.delvare>
	<4CA4C081.4010109@cs.ucla.edu>
X-Mailer: Claws Mail 3.7.5 (GTK+ 2.20.1; x86_64-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.0-3.9
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, 01 Oct 2010 15:10:12 -0000

Hi Paul,

Thanks for your fast answer.

On Thu, 30 Sep 2010 09:53:21 -0700, Paul Eggert wrote:
> On 09/29/10 09:45, Jean Delvare wrote:
> 
> > This confirms my impression that this is a real bug and not a
> > limitation of the diff'ing algorithm.
> 
> Thanks for the bug report.  It's definitely a bug, though I
> haven't had time to look at the details.  Is this something
> that you can fix?

Unlikely, sorry, given my tight schedule and my total lack of knowledge
of the GNU diff code, which I imagine can be quite complex.

>  (Hint: if in src/analyze.c you comment out
> the body of shift_boundaries, so that shift_boundaries turns
> into a no-op, then the bug goes away.)

This is very interesting, but maybe not completely correct. If I skip
the call to shift_boundaries(), the following two lines:

	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
		return -ENODEV;

are still removed and re-added later. The only differences are the
order in which the operations happen, and the fact that the removal and
addition don't sit next to each other in the output. So I wouldn't call
shift_boundaries() broken. Instead, my feeling is that, after
shift_boundaries's work, an extra cleanup step could be taken to
simplify the output.

This can only be considered a bug in shift_boundaries() if this
function is already supposed to perform that cleanup (which would make
some sense, as obviously such cleanups only need to be attempted at
the boundaries which were just touched.) I don't know if this is the
case.

Thanks,
-- 
Jean Delvare


From MAILER-DAEMON Sat Oct 02 08:32:02 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P21Fy-00015z-3D
	for mharc-bug-diffutils@gnu.org; Sat, 02 Oct 2010 08:32:02 -0400
Received: from [140.186.70.92] (port=51883 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P21Fv-00015u-Vt
	for bug-diffutils@gnu.org; Sat, 02 Oct 2010 08:32:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <duncan.moore@gmx.com>) id 1P21Fu-0004nG-Sm
	for bug-diffutils@gnu.org; Sat, 02 Oct 2010 08:32:00 -0400
Received: from mailout-eu.gmx.com ([213.165.64.42]:52863)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <duncan.moore@gmx.com>) id 1P21Fu-0004my-Ff
	for bug-diffutils@gnu.org; Sat, 02 Oct 2010 08:31:58 -0400
Received: (qmail invoked by alias); 02 Oct 2010 12:31:55 -0000
Received: from cpc6-cmbg14-0-0-cust455.5-4.cable.virginmedia.com (EHLO
	[86.14.237.200]) [86.14.237.200]
	by mail.gmx.com (mp-eu001) with SMTP; 02 Oct 2010 14:31:55 +0200
X-Authenticated: #54834317
X-Provags-ID: V01U2FsdGVkX18UADNXloMUxAn2FMCiHvj5uEcyCC+mjwbZ4ijiEi
	JcJnGuholAxYRD
Received: from 127.0.0.1 (AVG SMTP 9.0.856 [271.1.1/3171]);
	Sat, 02 Oct 2010 13:33:37 +0100
Message-ID: <4CA726A1.6030207@gmx.com>
Date: Sat, 02 Oct 2010 13:33:37 +0100
From: Duncan Moore <duncan.moore@gmx.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
	rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4
MIME-Version: 1.0
To: Andreas Schwab <schwab@linux-m68k.org>
References: <4C9F5F24.20506@gmx.com>
	<4C9FA7ED.7000107@cs.ucla.edu>	<4CA09D1E.5070301@gmx.com>
	<m2vd5koqol.fsf@whitebox.home>
In-Reply-To: <m2vd5koqol.fsf@whitebox.home>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
Cc: bug-diffutils@gnu.org
Subject: [bug-diffutils] Re: New diff options/features
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, 02 Oct 2010 12:32:01 -0000



On 02/10/2010 11:05, Andreas Schwab wrote:
> Duncan Moore<duncan.moore@gmx.com>  writes:
>
>> On 26/09/2010 21:07, Paul Eggert wrote:
>>> On 09/26/2010 07:56 AM, Duncan Moore wrote:
>>>> 2) --if-different
>>>>      File contents are assumed identical if the files have the same size
>>>> and timestamp.
>>> This makes sense, but the option name is poorly chosen.  How about
>>> --assume-same?
>> I was unhappy with the name too. I think --assume-same is better, but it
>> doesn't convey the fact that it is conditional (on the timestamp and size
>> being the same). But I'm happy to go with it, unless someone thinks of
>> something better.
> How about --compare-attributes=size,mtime?
>
>      --compare-attributes=ATTRS
>          Compare file attributes ATTRS and assume two files are identical
>          if those attributes match, disregarding the actual file contents.

The name --compare-attributes=... shows what the command is conditional 
on, but not the consequence - i.e. that the contents might not be 
compared. Something like --assume-contents-same-if-attributes-same=... 
would be fully specific, but is far too long. I think there's probably 
no short name that succinctly conveys all this.

Also, I think the name --compare-attributes=... may lead to confusion 
with the --compare=... option, 
http://www.mail-archive.com/bug-diffutils@gnu.org/msg00096.html, which 
I'm also working on. This option compares and reports other file 
properties that differ, in addition to, or instead of, file contents.

With regards to listing the file attributes to use with --assume-same, I 
wouldn't have thought that anything other than time and size would be 
too useful, which was why I've not used an attribute list. As Paul said, 
this could be changed in the future if it was felt necessary.

So at this stage I'm still inclined to go with --assume-same, with no 
attribute list.


From MAILER-DAEMON Sat Oct 02 17:42:08 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P29qK-0007Ac-R4
	for mharc-bug-diffutils@gnu.org; Sat, 02 Oct 2010 17:42:08 -0400
Received: from [140.186.70.92] (port=51279 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P1yyL-0002vk-8T
	for bug-diffutils@gnu.org; Sat, 02 Oct 2010 06:05:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1P1yyJ-0003Ao-GY
	for bug-diffutils@gnu.org; Sat, 02 Oct 2010 06:05:41 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:57219)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <whitebox@nefkom.net>) id 1P1yyJ-0003AF-BY
	for bug-diffutils@gnu.org; Sat, 02 Oct 2010 06:05:39 -0400
Received: from frontend1.mail.m-online.net (unknown [192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 505631C000F7;
	Sat,  2 Oct 2010 12:05:31 +0200 (CEST)
X-Auth-Info: gcBhcaOyMygBQECpNkQrVyes7eKgPF4Uar6gc/EEBOk=
Received: from whitebox.home (ppp-88-217-97-255.dynamic.mnet-online.de
	[88.217.97.255])
	by mail.mnet-online.de (Postfix) with ESMTPA id 8CCFC1C00100;
	Sat,  2 Oct 2010 12:05:31 +0200 (CEST)
Received: by whitebox.home (Postfix, from userid 501)
	id 025691E52EE; Sat,  2 Oct 2010 12:05:30 +0200 (CEST)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Duncan Moore <duncan.moore@gmx.com>
References: <4C9F5F24.20506@gmx.com> <4C9FA7ED.7000107@cs.ucla.edu>
	<4CA09D1E.5070301@gmx.com>
X-Yow: NANCY!!  Why is everything RED?!
Date: Sat, 02 Oct 2010 12:05:30 +0200
In-Reply-To: <4CA09D1E.5070301@gmx.com> (Duncan Moore's message of "Mon, 27
	Sep 2010 14:33:18 +0100")
Message-ID: <m2vd5koqol.fsf@whitebox.home>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older,
	4)
X-Mailman-Approved-At: Sat, 02 Oct 2010 17:42:08 -0400
Cc: bug-diffutils@gnu.org
Subject: [bug-diffutils] Re: New diff options/features
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, 02 Oct 2010 10:05:42 -0000

Duncan Moore <duncan.moore@gmx.com> writes:

> On 26/09/2010 21:07, Paul Eggert wrote:
>> On 09/26/2010 07:56 AM, Duncan Moore wrote:
>>> 2) --if-different
>>>     File contents are assumed identical if the files have the same size
>>> and timestamp.
>> This makes sense, but the option name is poorly chosen.  How about
>> --assume-same?
>
> I was unhappy with the name too. I think --assume-same is better, but it
> doesn't convey the fact that it is conditional (on the timestamp and size
> being the same). But I'm happy to go with it, unless someone thinks of
> something better.

How about --compare-attributes=size,mtime?

    --compare-attributes=ATTRS
        Compare file attributes ATTRS and assume two files are identical
        if those attributes match, disregarding the actual file contents.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


From MAILER-DAEMON Wed Oct 06 09:34:05 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P3U8D-0000jw-Hp
	for mharc-bug-diffutils@gnu.org; Wed, 06 Oct 2010 09:34:05 -0400
Received: from [140.186.70.92] (port=42055 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P3U8A-0000i5-Qw
	for bug-diffutils@gnu.org; Wed, 06 Oct 2010 09:34:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <agruen@suse.de>) id 1P3U89-00048i-KV
	for bug-diffutils@gnu.org; Wed, 06 Oct 2010 09:34:02 -0400
Received: from cantor2.suse.de ([195.135.220.15]:53690 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <agruen@suse.de>) id 1P3U89-00048J-FS
	for bug-diffutils@gnu.org; Wed, 06 Oct 2010 09:34:01 -0400
Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2])
	by mx2.suse.de (Postfix) with ESMTP id 98EE48765C;
	Wed,  6 Oct 2010 15:33:58 +0200 (CEST)
From: Andreas Gruenbacher <agruen@suse.de>
Organization: SUSE Labs
To: bug-diffutils@gnu.org
Subject: Re: [bug-diffutils] [BUG] Incorrect diff output (diff -d is correct)
Date: Wed, 6 Oct 2010 15:33:56 +0200
User-Agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; i686; ; )
References: <20100929184529.470cffd3@endymion.delvare>
	<4CA4C081.4010109@cs.ucla.edu>
	<20101001165532.716ffc41@endymion.delvare>
In-Reply-To: <20101001165532.716ffc41@endymion.delvare>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <201010061533.57185.agruen@suse.de>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
Cc: Jean Delvare <khali@linux-fr.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, 06 Oct 2010 13:34:04 -0000

On Friday 01 October 2010 16:55:32 Jean Delvare wrote:
> Instead, my feeling is that, after shift_boundaries's work, an extra cleanup
> step could be taken to simplify the output.

The reason for the suboptimal result here is that the diffing algorithm is 
giving up unless find_minimal is true (it hits last return statement in diag() 
in diffseq.h).  It whouldn't be hard to check for this particular pattern 
after shift_boundaries(), but that pattern can only occur if the algorithm has 
given up, and I don't think optimizing this case is worth the cost.

Andreas


From MAILER-DAEMON Wed Oct 06 17:35:56 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P3beV-0001kh-IU
	for mharc-bug-diffutils@gnu.org; Wed, 06 Oct 2010 17:35:55 -0400
Received: from [140.186.70.92] (port=33282 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P3ZTH-0001JM-AA
	for bug-diffutils@gnu.org; Wed, 06 Oct 2010 15:16:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <scottmc2@gmail.com>) id 1P3ZTG-0002Cx-0j
	for bug-diffutils@gnu.org; Wed, 06 Oct 2010 15:16:11 -0400
Received: from mail-gy0-f169.google.com ([209.85.160.169]:65013)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <scottmc2@gmail.com>) id 1P3ZTF-0002Cr-Rq
	for bug-diffutils@gnu.org; Wed, 06 Oct 2010 15:16:09 -0400
Received: by gyf3 with SMTP id 3so2879282gyf.0
	for <bug-diffutils@gnu.org>; Wed, 06 Oct 2010 12:16:09 -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=uQAr9fxBgecqrepTqa53EcOtfT0N7byOyRXysCqeeH8=;
	b=mN8Q97lwq9WCvDE2wCxPwKbKV6Art+qWGNDPu77cIpKO6IWI29s0hKWK4o1GypwM55
	ClctbfgK68bUhh0SVezFE5JTIvAA2k0S3Zx2fYd8pVrbA4F1xaV3RYg97i1FrAfd6bV9
	f2bZ3AwkfG6vgyxDaaqt8+TebKU/3CM4R3FtM=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=mruaDdzTtgFqoTQlJNd6/OMan9ZUqzdE9cXx5jhycrYM41EH9G44a/xsctZ4+9jhnL
	M/zj6T67wB8+JxI/UxO9+aWr1+oH2l2rqML8IrPkLvBq9kl79DJILgrVTaxwC80MKZjU
	vkZ3s+3eU+UkMzNWTra6+Bfi/3LCYmPGsDq1M=
MIME-Version: 1.0
Received: by 10.236.105.201 with SMTP id k49mr14131660yhg.74.1286392568469;
	Wed, 06 Oct 2010 12:16:08 -0700 (PDT)
Received: by 10.220.182.12 with HTTP; Wed, 6 Oct 2010 12:16:08 -0700 (PDT)
Date: Wed, 6 Oct 2010 19:16:08 +0000
Message-ID: <AANLkTi=Nnm9Hcu5+6Syy4JZrQ9GZ0p8K0Ao7heFsp_eo@mail.gmail.com>
From: scott mc <scottmc2@gmail.com>
To: bug-diffutils@gnu.org
Content-Type: text/plain; charset=ISO-8859-1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Mailman-Approved-At: Wed, 06 Oct 2010 17:35:53 -0400
Subject: [bug-diffutils] [diffutils-3.0] 9 of 78 tests failed on Haiku
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, 06 Oct 2010 19:16:12 -0000

Diffutils-3.0 builds ok on Haiku but the test suite did not.  I made
patches to three of the test files as shown here:

--------------------

diff -urN diffutils-3.0/gnulib-tests/test-dup2.c
diffutils-3.0-haiku/gnulib-tests/test-dup2.c
--- diffutils-3.0/gnulib-tests/test-dup2.c	2010-04-15 13:42:07.036700160 +0000
+++ diffutils-3.0-haiku/gnulib-tests/test-dup2.c	2010-10-06
11:17:38.000000000 +0000
@@ -176,6 +176,7 @@

   /* On systems that distinguish between text and binary mode, dup2
      reuses the mode of the source.  */
+#if O_BINARY
   setmode (fd, O_BINARY);
   ASSERT (is_mode (fd, O_BINARY));
   ASSERT (dup2 (fd, fd + 1) == fd + 1);
@@ -190,6 +191,6 @@
   ASSERT (close (fd + 1) == 0);
   ASSERT (close (fd) == 0);
   ASSERT (unlink (file) == 0);
-
+#endif
   return 0;
 }
diff -urN diffutils-3.0/gnulib-tests/test-fcntl.c
diffutils-3.0-haiku/gnulib-tests/test-fcntl.c
--- diffutils-3.0/gnulib-tests/test-fcntl.c	2010-04-15 13:42:08.027787264 +0000
+++ diffutils-3.0-haiku/gnulib-tests/test-fcntl.c	2010-10-06
11:21:54.000000000 +0000
@@ -298,6 +298,7 @@
   ASSERT (is_mode (fd + 2, O_BINARY));
   ASSERT (close (fd) == 0);

+#if O_TEXT
   setmode (fd + 2, O_TEXT);
   ASSERT (fcntl (fd + 2, F_DUPFD, fd + 1) == fd + 1);
   ASSERT (!is_open (fd));
@@ -318,7 +319,7 @@
   ASSERT (is_mode (fd, O_TEXT));
   ASSERT (is_mode (fd + 2, O_TEXT));
   ASSERT (close (fd + 2) == 0);
-
+#endif
   /* Test F_GETFD.  */
   errno = 0;
   ASSERT (fcntl (-1, F_GETFD) == -1);
diff -urN diffutils-3.0/gnulib-tests/test-signal.c
diffutils-3.0-haiku/gnulib-tests/test-signal.c
--- diffutils-3.0/gnulib-tests/test-signal.c	2010-04-15 13:42:09.030932992 +0000
+++ diffutils-3.0-haiku/gnulib-tests/test-signal.c	2010-10-06
11:28:31.000000000 +0000
@@ -58,7 +58,7 @@
 #ifdef SIGALRM
     case SIGALRM:
 #endif
-#ifdef SIGBUS
+#if defined SIGBUS && !defined(__HAIKU__)
     case SIGBUS:
 #endif
 #ifdef SIGCHLD


------------------------------------------

Haiku, like BeOS have O_BINARY and O_TEXT but they have no effect:
http://www.mail-archive.com/bug-gnulib@gnu.org/msg12137.html

Also on Haiku and BeOS SIGSEGV is the same as SIGBUS:
http://dev.haiku-os.org/browser/haiku/trunk/headers/posix/signal.h (line 132)

Here is the output of the test-suite with the above patch applied:

====================================================
   GNU diffutils 3.0: gnulib-tests/test-suite.log
====================================================

9 of 78 tests failed.  (11 tests were not run).

.. contents:: :depth: 2


FAIL: test-btowc1.sh (exit: 134)
================================

test-btowc.c:52: assertion failed
Abort
./test-btowc1.sh: line 15: 431880 Abort
LC_ALL=$LOCALE_FR ./test-btowc${EXEEXT} 1

SKIP: test-btowc2.sh (exit: 77)
===============================

Skipping test: no french Unicode locale is supported

FAIL: test-c-stack.sh (exit: 1)
===============================

./test-c-stack.sh: line 7: 431920 Segmentation violation
./test-c-stack${EXEEXT} 2> t-c-stack.tmp

FAIL: test-fcntl (exit: 134)
============================

test-fcntl.c:261: assertion failed
Abort

FAIL: test-mbrtowc1.sh (exit: 134)
==================================

test-mbrtowc.c:143: assertion failed
Abort
./test-mbrtowc1.sh: line 15: 432356 Abort
LC_ALL=$LOCALE_FR ./test-mbrtowc${EXEEXT} 1

SKIP: test-mbrtowc2.sh (exit: 77)
=================================

Skipping test: no french Unicode locale is supported

SKIP: test-mbrtowc3.sh (exit: 77)
=================================

Skipping test: no traditional japanese locale is supported

SKIP: test-mbrtowc4.sh (exit: 77)
=================================

Skipping test: no transitional chinese locale is supported

SKIP: test-mbscasecmp.sh (exit: 77)
===================================

Skipping test: no turkish Unicode locale is supported

SKIP: test-mbsinit.sh (exit: 77)
================================

Skipping test: no french Unicode locale is supported

FAIL: test-mbsrtowcs1.sh (exit: 134)
====================================

test-mbsrtowcs.c:111: assertion failed
Abort
./test-mbsrtowcs1.sh: line 15: 432436 Abort
LC_ALL=$LOCALE_FR ./test-mbsrtowcs${EXEEXT} 1

SKIP: test-mbsrtowcs2.sh (exit: 77)
===================================

Skipping test: no french Unicode locale is supported

SKIP: test-mbsrtowcs3.sh (exit: 77)
===================================

Skipping test: no traditional japanese locale is supported

SKIP: test-mbsrtowcs4.sh (exit: 77)
===================================

Skipping test: no transitional chinese locale is supported

SKIP: test-mbsstr2.sh (exit: 77)
================================

Skipping test: no french Unicode locale is supported

SKIP: test-mbsstr3.sh (exit: 77)
================================

Skipping test: no chinese GB18030 locale is supported

FAIL: test-sleep (exit: 134)
============================

test-sleep.c:55: assertion failed
Abort

FAIL: test-unsetenv (exit: 134)
===============================

test-unsetenv.c:44: assertion failed
Abort

FAIL: test-wcrtomb.sh (exit: 1)
===============================

test-wcrtomb.c:45: assertion failed
Abort
./test-wcrtomb.sh: line 9: 433242 Abort
LC_ALL=$LOCALE_FR ./test-wcrtomb${EXEEXT} 1

FAIL: test-wcwidth (exit: 134)
==============================

test-wcwidth.c:57: assertion failed
Abort



-------------------------------

-scottmc

Scott McCreary
HaikuPorts


From MAILER-DAEMON Thu Oct 07 02:12:34 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P3jiT-0001j5-Tt
	for mharc-bug-diffutils@gnu.org; Thu, 07 Oct 2010 02:12:33 -0400
Received: from [140.186.70.92] (port=35725 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P3jiR-0001iQ-28
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 02:12:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jim@meyering.net>) id 1P3jiM-0002ER-7c
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 02:12:30 -0400
Received: from mx.meyering.net ([82.230.74.64]:33858)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jim@meyering.net>) id 1P3jiL-0002EG-Rq
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 02:12:26 -0400
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id DC5B5E4D4; Thu,  7 Oct 2010 08:12:22 +0200 (CEST)
From: Jim Meyering <jim@meyering.net>
To: Kai YU <yukai@nlsde.buaa.edu.cn>
In-Reply-To: <AANLkTikUY-5Ov-eHdxh+doAfXTC0Q+hHJBJfvQkjo3Dx@mail.gmail.com>
	(Kai YU's message of "Thu, 7 Oct 2010 10:51:47 +0800")
References: <AANLkTikUY-5Ov-eHdxh+doAfXTC0Q+hHJBJfvQkjo3Dx@mail.gmail.com>
Date: Thu, 07 Oct 2010 08:12:22 +0200
Message-ID: <87zkuqila1.fsf@meyering.net>
Lines: 86
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: bug-diffutils@gnu.org
Subject: [bug-diffutils] Re: Bug#577832: diffutils: [REGRESSION] newline is
	added to a line that has no newline if the line is in context (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: Thu, 07 Oct 2010 06:12:32 -0000

S2FpIFlVIHdyb3RlOg0KPiBEZWFyIEppbToNCg0KVGhhbmsgeW91IGZvciB0YWtpbmcgdGhlIHRp
bWUgdG8gYW5hbHl6ZSBkaWZmdXRpbHMgYnVncy4NClBsZWFzZSBzZW5kIGFueSBzdWNoIG1haWwg
dG8gdGhlIGJ1Zy1yZXBvcnRpbmcgYWRkcmVzcw0KeW91IHNlZSBpbiBkaWZmIC0taGVscCBvdXRw
dXQ6IGJ1Zy1kaWZmdXRpbHNAZ251Lm9yZw0KDQo+IMKgwqDCoMKgwqDCoCBJIGFuZCBteSBjb2xs
ZWFndWUgWGlhbmd5dSBaaGFuZyBhbmQgSmluIENoZW4gcmVjZW50bHkgZXhhbWluZWQgQnVnIw0K
PiA1Nzc4MzIgaW4gb3VyIHN0dWR5LiBTaW5jZSB0aGlzIGJ1ZyBpcyBhIHJlZ3Jlc3Npb24gZnJv
bSBkaWZmdXRpbHMtMi44LjEsIHdlDQo+IGlzb2xhdGVkIHRoZSBmYWlsdXJlLWluZHVjaW5nIGNo
YW5nZSBhdXRvbWF0aWNhbGx5Og0KPg0KPiAgICAgZGlmZiAtdSAuL2RpZmZ1dGlscy0yLjguMS9z
cmMvaW8uYyAuL2RpZmZ1dGlscy0yLjkvc3JjL2lvLmMNCj4gICAgIC0tLSBkaWZmdXRpbHMtMi44
LjEvc3JjL2lvLmMNCj4gICAgICsrKyBkaWZmdXRpbHMtMi45L3NyYy9pby5jDQo+ICAgICBAQCAt
NjY0LDIgKzY1MCwyIEBADQo+ICAgICAtwqDCoMKgwqDCoCBmb3IgKDsgcDAgIT0gYmVnMDsgcDAt
LSwgcDEtLSkNCj4gICAgIC3CoMKgwqDCoMKgwqDCoCBpZiAoKnAwICE9ICpwMSkNCj4gICAgICvC
oMKgwqDCoCB3aGlsZSAocDAgIT0gYmVnMCkNCj4gICAgICvCoMKgwqDCoMKgwqAgaWYgKCotLXAw
ICE9ICotLXAxKQ0KPiAgICAgwqDCoMKgwqDCoMKgwqDCoMKgIHsNCj4gICAgIMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqAgLyogUG9pbnQgYXQgdGhlIGZpcnN0IGNoYXIgb2YgdGhlIG1hdGNoaW5nIHN1
ZmZpeC7CoCAqLw0KPiAgICAgK8KgwqDCoMKgwqDCoMKgwqDCoMKgICsrcDAsICsrcDE7DQo+ICAg
ICDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIGJlZzAgPSBwMDsNCj4gICAgIMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqAgYnJlYWs7DQo+ICAgICDCoMKgwqDCoMKgwqDCoMKgwqAgfQ0KPg0KPiDCoCDCoCDC
oCBUaGlzIGNoYW5nZSBjYXVzZXMgdGhlIHBvaW50ZXIgJ3AwJyB3cm9uZ2x5IHBvaW50cyB0byBz
b21ld2hlcmUgZGlmZmVyZW50DQo+IGFzIGl0IGRvZXMgaW4gMi44LmFmdGVyIHRoZSBsb29wLCBh
bmQgbGF0ZXIgZGVmaW5lcyB0aGUgdmFyaWFibGUgZmlsZXZlYw0KPiBbMF0uc3VmZml4X2JlZ2lu
LCB3aGljaCBsZWFkcyB0byBhIGZhaWx1cmUgaW4gMi45Lg0KPg0KPiAgICAgaW4gZGlmZnV0aWxz
LTIuOS9zcmMvaW8uYzoNCj4NCj4gICAgIHN0YXRpYyB2b2lkDQo+ICAgICBmaW5kX2lkZW50aWNh
bF9lbmRzIChzdHJ1Y3QgZmlsZV9kYXRhIGZpbGV2ZWNbXSkNCj4gICAgIHsNCj4gICAgIC4uLg0K
PiAgICAgwqAgaWYgKCEgUk9CVVNUX09VVFBVVF9TVFlMRSAob3V0cHV0X3N0eWxlKQ0KPiAgICAg
wqDCoMKgwqDCoCB8fCBmaWxldmVjWzBdLm1pc3NpbmdfbmV3bGluZSA9PSBmaWxldmVjWzFdLm1p
c3NpbmdfbmV3bGluZSkNCj4gICAgIMKgwqDCoCB7DQo+ICAgICDCoMKgwqDCoMKgIC4uLg0KPiAg
ICAgwqDCoMKgwqDCoCB3aGlsZSAocDAgIT0gYmVnMCkNCj4gICAgIMKgwqDCoMKgwqDCoCDCoMKg
wqDCoCBpZiAoKi0tcDAgIT0gKi0tcDEpDQo+ICAgICDCoMKgwqDCoMKgwqAgwqAgwqDCoMKgwqB7
DQo+ICAgICDCoCDCoCDCoCDCoCDCoCDCoMKgwqDCoCAuLi4NCj4gICAgIMKgwqDCoMKgwqDCoCDC
oCDCoMKgwqDCoH0NCj4gICAgIMKgwqDCoMKgwqAgLi4uDQo+ICAgICDCoMKgwqAgfQ0KPiAgICAg
wqAgLyogUmVjb3JkIHRoZSBzdWZmaXguwqAgKi8NCj4gICAgIMKgIGZpbGV2ZWNbMF0uc3VmZml4
X2JlZ2luID0gcDA7DQo+ICAgICDCoCBmaWxldmVjWzFdLnN1ZmZpeF9iZWdpbiA9IHAxOw0KPiAg
ICAgLi4uDQo+ICAgICB9DQo+DQo+IMKgIMKgIMKgwqAgV2UgYWxzbyBub3RpY2UgdGhhdCBpbiAz
LjAgdGhpcyBidWcgaGFzIGJlZW4gZml4ZWQgYnkgYWRkaW5nIHRoZQ0KPiBmb2xsb3dpbmcgY29k
ZToNCj4NCj4gICAgIGRpZmYgLXUgLi9kaWZmdXRpbHMtMi45L3NyYy9pby5jIC4vZGlmZnV0aWxz
LTMuMC9zcmMvaW8uYw0KPiAgICAgLS0tIGRpZmZ1dGlscy0yLjkvc3JjL2lvLmMNCj4gICAgICsr
KyBkaWZmdXRpbHMtMy4wL3NyYy9pby5jDQo+ICAgICBAQCAtNDcxLDcgKzQ3MCwxMyBAQA0KPg0K
PiAgICAgwqDCoMKgwqDCoMKgIGxpbmJ1ZltsaW5lXSA9IHA7DQo+DQo+ICAgICDCoMKgwqDCoMKg
wqAgaWYgKHAgPT0gYnVmZW5kKQ0KPiAgICAgLcKgwqDCoMKgwqDCoCBicmVhazsNCj4gICAgICvC
oMKgwqDCoMKgwqAgew0KPiAgICAgK8KgwqDCoMKgwqDCoMKgwqAgLyogSWYgdGhlIGxhc3QgbGlu
ZSBpcyBpbmNvbXBsZXRlIGFuZCB3ZSBkbyBub3Qgc2lsZW50bHkNCj4gICAgICvCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgIGNvbXBsZXRlIGxpbmVzLCBkb24ndCBjb3VudCBpdHMgYXBwZW5kZWQgbmV3
bGluZS7CoCAqLw0KPiAgICAgK8KgwqDCoMKgwqDCoMKgwqAgaWYgKGN1cnJlbnQtPm1pc3Npbmdf
bmV3bGluZSAmJiBST0JVU1RfT1VUUFVUX1NUWUxFDQo+ICAgICAob3V0cHV0X3N0eWxlKSkNCj4g
ICAgICvCoMKgwqDCoMKgwqDCoMKgwqDCoCBsaW5idWZbbGluZV0tLTsNCj4gICAgICvCoMKgwqDC
oMKgwqDCoMKgIGJyZWFrOw0KPiAgICAgK8KgwqDCoMKgwqDCoCB9DQo+DQo+ICAgICDCoMKgwqDC
oMKgwqAgaWYgKGNvbnRleHQgPD0gaSAmJiBub19kaWZmX21lYW5zX25vX291dHB1dCkNCj4gICAg
IMKgwqDCoMKgwqDCoMKgIGJyZWFrOw0KPg0KPiDCoMKgwqDCoMKgwqAgVGhpcyByZXBhaXIgZG9l
cyBmaXggdGhlIGJ1Zy4gSG93ZXZlcizCoCB0aGlzIGZpeCB0cmllcyB0byBhZGp1c3QgdGhlDQo+
IGZpbmFsIGxpbmJ1ZltsaW5lXSBzZXR0aW5nIHJhdGhlciB0aGFuIGNvcnJlY3RzIHRoZSBlcnJv
ciBjYXVzZS4NCj4gSW5zdGVhZCwgd2Ugc3VnZ2VzdCB3aXRoZHJhdyB0aGUgY2hhbmdlIGludHJv
ZHVjZWQgaW4gMi45IG1heSBiZSBhIGJldHRlcg0KPiBjaG9pY2UuIEJlc2lkZXMsIHRoZSB2YWx1
ZSBvZiBmaWxldmVjWzBdLnN1ZmZpeF9iZWdpbiBpbiAzLjAgaXMgbm90IGVxdWFsIHRvDQo+IHRo
YXQgaW4gMi44LjEsIHdoaWNoIG1heSBjYXVzZSBwb3RlbnRpYWwgYnVncyBpbiB0aGUgZnV0dXJl
Lg0KPg0KPiDCoMKgwqDCoMKgwqAgTG9va2luZyBmb3J3YXJkIHRvIHlvdXIgcmVwbHkuDQo+IC0t
LQ0KPiBLYWkgWVUNCg==


From MAILER-DAEMON Thu Oct 07 03:34:02 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P3kzI-0002Xt-Ok
	for mharc-bug-diffutils@gnu.org; Thu, 07 Oct 2010 03:34:00 -0400
Received: from [140.186.70.92] (port=33668 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P3kzC-0002M9-5e
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 03:33:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jim@meyering.net>) id 1P3kuP-0006vs-GB
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 03:28:58 -0400
Received: from mx.meyering.net ([82.230.74.64]:53628)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jim@meyering.net>)
	id 1P3kuP-0006vh-4z; Thu, 07 Oct 2010 03:28:57 -0400
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id 81A44DB82; Thu,  7 Oct 2010 09:28:56 +0200 (CEST)
From: Jim Meyering <jim@meyering.net>
To: scott mc <scottmc2@gmail.com>
In-Reply-To: <AANLkTi=Nnm9Hcu5+6Syy4JZrQ9GZ0p8K0Ao7heFsp_eo@mail.gmail.com>
	(scott mc's message of "Wed, 6 Oct 2010 19:16:08 +0000")
References: <AANLkTi=Nnm9Hcu5+6Syy4JZrQ9GZ0p8K0Ao7heFsp_eo@mail.gmail.com>
Date: Thu, 07 Oct 2010 09:28:56 +0200
Message-ID: <87d3rmihqf.fsf@meyering.net>
Lines: 212
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: bug-diffutils@gnu.org, Gnulib List <bug-gnulib@gnu.org>
Subject: [bug-diffutils] Re: [diffutils-3.0] 9 of 78 tests failed on Haiku
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, 07 Oct 2010 07:33:57 -0000

scott mc wrote:
> Diffutils-3.0 builds ok on Haiku but the test suite did not.  I made
> patches to three of the test files as shown here:

Thanks for the report and patches.
I'm redirecting this to bug-gnulib, since those tests
all come from that project, not diffutils directly.

> --------------------
> diff -urN diffutils-3.0/gnulib-tests/test-dup2.c
> diffutils-3.0-haiku/gnulib-tests/test-dup2.c
> --- diffutils-3.0/gnulib-tests/test-dup2.c	2010-04-15 13:42:07.036700160 +0000
> +++ diffutils-3.0-haiku/gnulib-tests/test-dup2.c	2010-10-06
> 11:17:38.000000000 +0000
> @@ -176,6 +176,7 @@
>
>    /* On systems that distinguish between text and binary mode, dup2
>       reuses the mode of the source.  */
> +#if O_BINARY
>    setmode (fd, O_BINARY);
>    ASSERT (is_mode (fd, O_BINARY));
>    ASSERT (dup2 (fd, fd + 1) == fd + 1);
> @@ -190,6 +191,6 @@
>    ASSERT (close (fd + 1) == 0);
>    ASSERT (close (fd) == 0);
>    ASSERT (unlink (file) == 0);
> -
> +#endif
>    return 0;
>  }
> diff -urN diffutils-3.0/gnulib-tests/test-fcntl.c
> diffutils-3.0-haiku/gnulib-tests/test-fcntl.c
> --- diffutils-3.0/gnulib-tests/test-fcntl.c	2010-04-15 13:42:08.027787264 +0000
> +++ diffutils-3.0-haiku/gnulib-tests/test-fcntl.c	2010-10-06
> 11:21:54.000000000 +0000
> @@ -298,6 +298,7 @@
>    ASSERT (is_mode (fd + 2, O_BINARY));
>    ASSERT (close (fd) == 0);
>
> +#if O_TEXT
>    setmode (fd + 2, O_TEXT);
>    ASSERT (fcntl (fd + 2, F_DUPFD, fd + 1) == fd + 1);
>    ASSERT (!is_open (fd));
> @@ -318,7 +319,7 @@
>    ASSERT (is_mode (fd, O_TEXT));
>    ASSERT (is_mode (fd + 2, O_TEXT));
>    ASSERT (close (fd + 2) == 0);
> -
> +#endif
>    /* Test F_GETFD.  */
>    errno = 0;
>    ASSERT (fcntl (-1, F_GETFD) == -1);
> diff -urN diffutils-3.0/gnulib-tests/test-signal.c
> diffutils-3.0-haiku/gnulib-tests/test-signal.c
> --- diffutils-3.0/gnulib-tests/test-signal.c	2010-04-15 13:42:09.030932992 +0000
> +++ diffutils-3.0-haiku/gnulib-tests/test-signal.c	2010-10-06
> 11:28:31.000000000 +0000
> @@ -58,7 +58,7 @@
>  #ifdef SIGALRM
>      case SIGALRM:
>  #endif
> -#ifdef SIGBUS
> +#if defined SIGBUS && !defined(__HAIKU__)
>      case SIGBUS:
>  #endif
>  #ifdef SIGCHLD
>
>
> ------------------------------------------
>
> Haiku, like BeOS have O_BINARY and O_TEXT but they have no effect:
> http://www.mail-archive.com/bug-gnulib@gnu.org/msg12137.html
>
> Also on Haiku and BeOS SIGSEGV is the same as SIGBUS:
> http://dev.haiku-os.org/browser/haiku/trunk/headers/posix/signal.h (line 132)
>
> Here is the output of the test-suite with the above patch applied:
>
> ====================================================
>    GNU diffutils 3.0: gnulib-tests/test-suite.log
> ====================================================
>
> 9 of 78 tests failed.  (11 tests were not run).
>
> .. contents:: :depth: 2
>
>
> FAIL: test-btowc1.sh (exit: 134)
> ================================
>
> test-btowc.c:52: assertion failed
> Abort
> ./test-btowc1.sh: line 15: 431880 Abort
> LC_ALL=$LOCALE_FR ./test-btowc${EXEEXT} 1
>
> SKIP: test-btowc2.sh (exit: 77)
> ===============================
>
> Skipping test: no french Unicode locale is supported
>
> FAIL: test-c-stack.sh (exit: 1)
> ===============================
>
> ./test-c-stack.sh: line 7: 431920 Segmentation violation
> ./test-c-stack${EXEEXT} 2> t-c-stack.tmp
>
> FAIL: test-fcntl (exit: 134)
> ============================
>
> test-fcntl.c:261: assertion failed
> Abort
>
> FAIL: test-mbrtowc1.sh (exit: 134)
> ==================================
>
> test-mbrtowc.c:143: assertion failed
> Abort
> ./test-mbrtowc1.sh: line 15: 432356 Abort
> LC_ALL=$LOCALE_FR ./test-mbrtowc${EXEEXT} 1
>
> SKIP: test-mbrtowc2.sh (exit: 77)
> =================================
>
> Skipping test: no french Unicode locale is supported
>
> SKIP: test-mbrtowc3.sh (exit: 77)
> =================================
>
> Skipping test: no traditional japanese locale is supported
>
> SKIP: test-mbrtowc4.sh (exit: 77)
> =================================
>
> Skipping test: no transitional chinese locale is supported
>
> SKIP: test-mbscasecmp.sh (exit: 77)
> ===================================
>
> Skipping test: no turkish Unicode locale is supported
>
> SKIP: test-mbsinit.sh (exit: 77)
> ================================
>
> Skipping test: no french Unicode locale is supported
>
> FAIL: test-mbsrtowcs1.sh (exit: 134)
> ====================================
>
> test-mbsrtowcs.c:111: assertion failed
> Abort
> ./test-mbsrtowcs1.sh: line 15: 432436 Abort
> LC_ALL=$LOCALE_FR ./test-mbsrtowcs${EXEEXT} 1
>
> SKIP: test-mbsrtowcs2.sh (exit: 77)
> ===================================
>
> Skipping test: no french Unicode locale is supported
>
> SKIP: test-mbsrtowcs3.sh (exit: 77)
> ===================================
>
> Skipping test: no traditional japanese locale is supported
>
> SKIP: test-mbsrtowcs4.sh (exit: 77)
> ===================================
>
> Skipping test: no transitional chinese locale is supported
>
> SKIP: test-mbsstr2.sh (exit: 77)
> ================================
>
> Skipping test: no french Unicode locale is supported
>
> SKIP: test-mbsstr3.sh (exit: 77)
> ================================
>
> Skipping test: no chinese GB18030 locale is supported
>
> FAIL: test-sleep (exit: 134)
> ============================
>
> test-sleep.c:55: assertion failed
> Abort
>
> FAIL: test-unsetenv (exit: 134)
> ===============================
>
> test-unsetenv.c:44: assertion failed
> Abort
>
> FAIL: test-wcrtomb.sh (exit: 1)
> ===============================
>
> test-wcrtomb.c:45: assertion failed
> Abort
> ./test-wcrtomb.sh: line 9: 433242 Abort
> LC_ALL=$LOCALE_FR ./test-wcrtomb${EXEEXT} 1
>
> FAIL: test-wcwidth (exit: 134)
> ==============================
>
> test-wcwidth.c:57: assertion failed
> Abort
>
>
>
> -------------------------------
>
> -scottmc
>
> Scott McCreary
> HaikuPorts


From MAILER-DAEMON Thu Oct 07 12:36:41 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P3tST-0001Zl-Nr
	for mharc-bug-diffutils@gnu.org; Thu, 07 Oct 2010 12:36:41 -0400
Received: from [140.186.70.92] (port=49260 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P3tSN-0001ZG-CX
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 12:36:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1P3tRu-00026h-RJ
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 12:36:35 -0400
Received: from kiwi.cs.ucla.edu ([131.179.128.19]:33775)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@CS.UCLA.EDU>) id 1P3tRu-00026G-Hx
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 12:36:06 -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
	o97Ga3QP011219; Thu, 7 Oct 2010 09:36:03 -0700 (PDT)
Message-ID: <4CADF6F3.4090805@cs.ucla.edu>
Date: Thu, 07 Oct 2010 09:36:03 -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.12) Gecko/20100915 Thunderbird/3.0.8
MIME-Version: 1.0
To: Kai YU <yukai@nlsde.buaa.edu.cn>
References: <AANLkTikUY-5Ov-eHdxh+doAfXTC0Q+hHJBJfvQkjo3Dx@mail.gmail.com>
	<87zkuqila1.fsf@meyering.net>
In-Reply-To: <87zkuqila1.fsf@meyering.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
Subject: [bug-diffutils] Re: Bug#577832: diffutils: [REGRESSION] newline
 is	added to a line
 that has no newline if the line is in context (fwd)
X-BeenThere: bug-diffutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: bug-diffutils@gnu.org
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, 07 Oct 2010 16:36:40 -0000

Kai YU wrote:
> This repair does fix the bug. However,  this fix tries to adjust the
> final linbuf[line] setting rather than corrects the error cause.

Hmm, sorry, what is the "error cause" here?

> Instead, we suggest withdraw the change introduced in 2.9 may be a better
> choice.

We can't simply do that, because the change introduced for 2.9 in 2006
<http://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=58d0483b621792959a485876aee05d799b6470de>
fixed a serious performance bug that was earlier introduced in 2001
<http://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=420373575c3761cc50e762084400056affb968a0>.
The 2006 change simply reverts that (clearly incorrect) part of the
2001 change.  Perhaps there's a better fix than the combination of
the 2006 and later changes, but simply going back to the 2001
version would cause such a performance hit that we can't really do that.

> Besides, the value of filevec[0].suffix_begin in 3.0 is not equal to
> that in 2.8.1, which may cause potential bugs in the future.

Could you please give more details about the potential bugs that you
think might happen?  Sorry, I don't see them.

filevec[0].suffix_begin is supposed to be a pointer to the first line
of text that is in the common suffix (not counting the first few
lines of the suffix, as specified by the complicated expression
involving HORIZON_LINES).  Does the current code not do this
correctly in some cases?  Can you supply an example test case?


From MAILER-DAEMON Thu Oct 07 17:45:28 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P3yHI-00008t-7h
	for mharc-bug-diffutils@gnu.org; Thu, 07 Oct 2010 17:45:28 -0400
Received: from [140.186.70.92] (port=46414 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P3oGe-0004zp-RD
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 07:04:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <sinofishbuaa@gmail.com>) id 1P3oGc-00044n-U5
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 07:04:08 -0400
Received: from mail-pz0-f41.google.com ([209.85.210.41]:52435)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sinofishbuaa@gmail.com>) id 1P3oGc-00043p-ED
	for bug-diffutils@gnu.org; Thu, 07 Oct 2010 07:04:06 -0400
Received: by pzk26 with SMTP id 26so294637pzk.0
	for <bug-diffutils@gnu.org>; Thu, 07 Oct 2010 04:04:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:mime-version:sender:received
	:in-reply-to:references:from:date:x-google-sender-auth:message-id
	:subject:to:cc:content-type;
	bh=LCC7gXNwYSMpwuor+2/QrzR5eECYKuNALEv9GDpcRuM=;
	b=aG2SHYTwgimR6vo5xfvpfsd5JMXYGuoMUY+lA3IdvSogzTKAwmmwx8ZzSpq8hvstRD
	szI0j+XHc/AjftAzHI0RUswcS2w7J3viRgdzJWGyJ6wFtCgbhGvJf0I+EZK0gIbSbVgK
	LBXrb/iQZ93Ff7xNnFi5byO8OcZSUktHAClPQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:cc:content-type;
	b=D0Eg2lAUD3sLd09j+KBTFO/nDg1zT/ZKjgYbFr6ACqvXOvwNXIh0fizvqnQYhC5a/Z
	muy+cs4bZiNTi4eBwBWZc4fpwUDji3EE9u2p0vU6LaYda8lEQ31b/3xu7UAXzXKRljfu
	Zq0xFxLnLTBW0VYVwtYEs4p9AF1qil2JktDug=
Received: by 10.142.84.12 with SMTP id h12mr435394wfb.258.1286449444614; Thu,
	07 Oct 2010 04:04:04 -0700 (PDT)
MIME-Version: 1.0
Sender: sinofishbuaa@gmail.com
Received: by 10.143.18.13 with HTTP; Thu, 7 Oct 2010 04:03:44 -0700 (PDT)
In-Reply-To: <87zkuqila1.fsf@meyering.net>
References: <AANLkTikUY-5Ov-eHdxh+doAfXTC0Q+hHJBJfvQkjo3Dx@mail.gmail.com>
	<87zkuqila1.fsf@meyering.net>
From: Kai YU <yukai@nlsde.buaa.edu.cn>
Date: Thu, 7 Oct 2010 19:03:44 +0800
X-Google-Sender-Auth: 2RyzcZyrNofSJnl2FuSuQTDzLnw
Message-ID: <AANLkTikwg=Fh1usDXK57f2cHkUhFM_M-74deV_ut+hme@mail.gmail.com>
To: bug-diffutils@gnu.org
Content-Type: multipart/alternative; boundary=001636e911c32af360049204da51
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Mailman-Approved-At: Thu, 07 Oct 2010 17:45:26 -0400
Cc: 
Subject: [bug-diffutils] Re: Bug#577832: diffutils: [REGRESSION] newline is
 added to a line that has no newline if the line is in context (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: Thu, 07 Oct 2010 11:04:10 -0000

--001636e911c32af360049204da51
Content-Type: text/plain; charset=ISO-8859-1

OK. Since I found the letter in bug-diffutils is kind of messy, I rephrase
our findings as below:

    We isolated the failure-inducing change introduced by diffutils-2.9:
diff -u ./diffutils-2.8.1/src/io.c ./diffutils-2.9/src/io.c
--- diffutils-2.8.1/src/io.c
+++ diffutils-2.9/src/io.c
@@ -664,2 +650,2 @@
-      for (; p0 != beg0; p0--, p1--)
-        if (*p0 != *p1)
+     while (p0 != beg0)
+       if (*--p0 != *--p1)
          {
            /* Point at the first char of the matching suffix.  */
+           ++p0, ++p1;
            beg0 = p0;
            break;
          }

    This change causes the pointer 'p0' wrongly points to somewhere
different as it does in 2.8.after the loop, and later defines the variable
filevec[0].suffix_begin, which leads to a failure in 2.9.

in diffutils-2.9/src/io.c:
static void
find_identical_ends (struct file_data filevec[])
{
...
  if (! ROBUST_OUTPUT_STYLE (output_style)
      || filevec[0].missing_newline == filevec[1].missing_newline)
    {
      ...
      while (p0 != beg0)
            if (*--p0 != *--p1)
             {
               ...
             }
      ...
    }
  /* Record the suffix.  */
  filevec[0].suffix_begin = p0;
  filevec[1].suffix_begin = p1;
...
}

We also notice that in 3.0 this bug has been fixed by adding the following
code:

diff -u ./diffutils-2.9/src/io.c ./diffutils-3.0/src/io.c
--- diffutils-2.9/src/io.c
+++ diffutils-3.0/src/io.c
@@ -471,7 +470,13 @@
       linbuf[line] = p;

        if (p == bufend)
 -       break;
 +       {
 +         /* If the last line is incomplete and we do not silently
 +            complete lines, don't count its appended newline.  */
 +         if (current->missing_newline && ROBUST_OUTPUT_STYLE
(output_style))
 +           linbuf[line]--;
 +         break;
 +       }

        if (context <= i && no_diff_means_no_output)
         break;

      This repair does fix the bug. However,  this fix tries to adjust the
final linbuf[line] setting rather than corrects the error cause. Instead, we
suggest withdraw the change introduced in 2.9 may be a better choice.
Besides, the value of filevec[0].suffix_begin in 3.0 is not equal to that in
2.8.1, which may cause potential bugs in the future.


2010/10/7 Jim Meyering <jim@meyering.net>

> Kai YU wrote:
> > Dear Jim:
>
> Thank you for taking the time to analyze diffutils bugs.
> Please send any such mail to the bug-reporting address
> you see in diff --help output: bug-diffutils@gnu.org
>
> >        I and my colleague Xiangyu Zhang and Jin Chen recently examined
> Bug#
> > 577832 in our study. Since this bug is a regression from diffutils-2.8.1,
> we
> > isolated the failure-inducing change automatically:
> >
> >     diff -u ./diffutils-2.8.1/src/io.c ./diffutils-2.9/src/io.c
> >     --- diffutils-2.8.1/src/io.c
> >     +++ diffutils-2.9/src/io.c
> >     @@ -664,2 +650,2 @@
> >     -      for (; p0 != beg0; p0--, p1--)
> >     -        if (*p0 != *p1)
> >     +     while (p0 != beg0)
> >     +       if (*--p0 != *--p1)
> >               {
> >                 /* Point at the first char of the matching suffix.  */
> >     +           ++p0, ++p1;
> >                 beg0 = p0;
> >                 break;
> >               }
> >
> >       This change causes the pointer 'p0' wrongly points to somewhere
> different
> > as it does in 2.8.after the loop, and later defines the variable filevec
> > [0].suffix_begin, which leads to a failure in 2.9.
> >
> >     in diffutils-2.9/src/io.c:
> >
> >     static void
> >     find_identical_ends (struct file_data filevec[])
> >     {
> >     ...
> >       if (! ROBUST_OUTPUT_STYLE (output_style)
> >           || filevec[0].missing_newline == filevec[1].missing_newline)
> >         {
> >           ...
> >           while (p0 != beg0)
> >                 if (*--p0 != *--p1)
> >                  {
> >                    ...
> >                  }
> >           ...
> >         }
> >       /* Record the suffix.  */
> >       filevec[0].suffix_begin = p0;
> >       filevec[1].suffix_begin = p1;
> >     ...
> >     }
> >
> >        We also notice that in 3.0 this bug has been fixed by adding the
> > following code:
> >
> >     diff -u ./diffutils-2.9/src/io.c ./diffutils-3.0/src/io.c
> >     --- diffutils-2.9/src/io.c
> >     +++ diffutils-3.0/src/io.c
> >     @@ -471,7 +470,13 @@
> >
> >            linbuf[line] = p;
> >
> >            if (p == bufend)
> >     -       break;
> >     +       {
> >     +         /* If the last line is incomplete and we do not silently
> >     +            complete lines, don't count its appended newline.  */
> >     +         if (current->missing_newline && ROBUST_OUTPUT_STYLE
> >     (output_style))
> >     +           linbuf[line]--;
> >     +         break;
> >     +       }
> >
> >            if (context <= i && no_diff_means_no_output)
> >             break;
> >
> >        This repair does fix the bug. However,  this fix tries to adjust
> the
> > final linbuf[line] setting rather than corrects the error cause.
> > Instead, we suggest withdraw the change introduced in 2.9 may be a better
> > choice. Besides, the value of filevec[0].suffix_begin in 3.0 is not equal
> to
> > that in 2.8.1, which may cause potential bugs in the future.
> >
> >        Looking forward to your reply.
> > ---
> > Kai YU
>

--001636e911c32af360049204da51
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

OK. Since I found the letter in bug-diffutils is kind of messy, I rephrase =
our findings as below:<br><br>=A0=A0=A0 We isolated the failure-inducing ch=
ange introduced by diffutils-2.9:<br>diff -u ./diffutils-2.8.1/src/io.c ./d=
iffutils-2.9/src/io.c<br>

--- diffutils-2.8.1/src/io.c<br>+++ diffutils-2.9/src/io.c<br>@@ -664,2 +65=
0,2 @@<br>-=A0=A0=A0=A0=A0 for (; p0 !=3D beg0; p0--, p1--)<br>-=A0=A0=A0=
=A0=A0=A0=A0 if (*p0 !=3D *p1)<br>+=A0=A0=A0=A0 while (p0 !=3D beg0)<br>+=
=A0=A0=A0=A0=A0=A0 if (*--p0 !=3D *--p1)<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0 {<b=
r>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* Point at the first char of the matchin=
g suffix.=A0 */<br>+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ++p0, ++p1;<br>=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 beg0 =3D p0;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =
break;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0 }<br><br>=A0=A0=A0 This change causes=
 the pointer &#39;p0&#39; wrongly points to somewhere different as it does =
in 2.8.after the loop, and later defines the variable filevec[0].suffix_beg=
in, which leads to a failure in 2.9.<br>

<br>in diffutils-2.9/src/io.c:<br>static void<br>find_identical_ends (struc=
t file_data filevec[])<br>{<br>...<br>=A0 if (! ROBUST_OUTPUT_STYLE (output=
_style)<br>=A0=A0=A0=A0=A0 || filevec[0].missing_newline =3D=3D filevec[1].=
missing_newline)<br>

=A0=A0=A0 {<br>=A0=A0=A0=A0=A0 ...<br>=A0=A0=A0=A0=A0 while (p0 !=3D beg0)<=
br>=A0=A0=A0=A0=A0=A0 =A0=A0=A0=A0 if (*--p0 !=3D *--p1)<br>=A0=A0=A0=A0=A0=
=A0 =A0 =A0=A0=A0=A0{<br>=A0 =A0 =A0 =A0 =A0 =A0=A0=A0=A0 ...<br>=A0=A0=A0=
=A0=A0=A0 =A0 =A0=A0=A0=A0}<br>=A0=A0=A0=A0=A0 ...<br>=A0=A0=A0 }<br>=A0 /*=
 Record the suffix.=A0 */<br>=A0 filevec[0].suffix_begin =3D p0;<br>

=A0 filevec[1].suffix_begin =3D p1;<br>...<br>}<br><br>We also notice that =
in 3.0 this bug has been fixed by adding the following code:<br><br>diff -u=
 ./diffutils-2.9/src/io.c ./diffutils-3.0/src/io.c<br>--- diffutils-2.9/src=
/io.c<br>

+++ diffutils-3.0/src/io.c<br>@@ -471,7 +470,13 @@<br>=A0=A0=A0=A0=A0=A0 li=
nbuf[line] =3D p;<br><br>=A0=A0=A0=A0=A0=A0=A0 if (p =3D=3D bufend)<br>=A0-=
=A0=A0=A0=A0=A0=A0 break;<br>=A0+=A0=A0=A0=A0=A0=A0 {<br>=A0+=A0=A0=A0=A0=
=A0=A0=A0=A0 /* If the last line is incomplete and we do not silently<br>=
=A0+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 complete lines, don&#39;t count its a=
ppended newline.=A0 */<br>

=A0+=A0=A0=A0=A0=A0=A0=A0=A0 if (current-&gt;missing_newline &amp;&amp; ROB=
UST_OUTPUT_STYLE (output_style))<br>=A0+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 linb=
uf[line]--;<br>=A0+=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0+=A0=A0=A0=A0=A0=
=A0 }<br><br>=A0=A0=A0=A0=A0=A0=A0 if (context &lt;=3D i &amp;&amp; no_diff=
_means_no_output)<br>

=A0=A0=A0=A0=A0=A0=A0=A0 break;<br><br>=A0=A0=A0=A0=A0 This repair does fix=
 the bug. However,=A0 this fix tries to adjust the final linbuf[line] setti=
ng rather than corrects the error cause. Instead, we suggest withdraw the c=
hange introduced in 2.9 may be a better choice. Besides, the value of filev=
ec[0].suffix_begin in 3.0 is not equal to that in 2.8.1, which may cause po=
tential bugs in the future.<br>

<br><br><div class=3D"gmail_quote">2010/10/7 Jim Meyering <span dir=3D"ltr"=
>&lt;<a href=3D"mailto:jim@meyering.net">jim@meyering.net</a>&gt;</span><br=
><blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; bord=
er-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Kai YU wrote:<br>
&gt; Dear Jim:<br>
<br>
Thank you for taking the time to analyze diffutils bugs.<br>
Please send any such mail to the bug-reporting address<br>
you see in diff --help output: <a href=3D"mailto:bug-diffutils@gnu.org">bug=
-diffutils@gnu.org</a><br>
<div><div></div><div class=3D"h5"><br>
&gt; =A0=A0=A0=A0=A0=A0 I and my colleague Xiangyu Zhang and Jin Chen recen=
tly examined Bug#<br>
&gt; 577832 in our study. Since this bug is a regression from diffutils-2.8=
.1, we<br>
&gt; isolated the failure-inducing change automatically:<br>
&gt;<br>
&gt; =A0 =A0 diff -u ./diffutils-2.8.1/src/io.c ./diffutils-2.9/src/io.c<br=
>
&gt; =A0 =A0 --- diffutils-2.8.1/src/io.c<br>
&gt; =A0 =A0 +++ diffutils-2.9/src/io.c<br>
&gt; =A0 =A0 @@ -664,2 +650,2 @@<br>
&gt; =A0 =A0 -=A0=A0=A0=A0=A0 for (; p0 !=3D beg0; p0--, p1--)<br>
&gt; =A0 =A0 -=A0=A0=A0=A0=A0=A0=A0 if (*p0 !=3D *p1)<br>
&gt; =A0 =A0 +=A0=A0=A0=A0 while (p0 !=3D beg0)<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0 if (*--p0 !=3D *--p1)<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0 {<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* Point at the first char o=
f the matching suffix.=A0 */<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ++p0, ++p1;<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 beg0 =3D p0;<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0 }<br>
&gt;<br>
&gt; =A0 =A0 =A0 This change causes the pointer &#39;p0&#39; wrongly points=
 to somewhere different<br>
&gt; as it does in 2.8.after the loop, and later defines the variable filev=
ec<br>
&gt; [0].suffix_begin, which leads to a failure in 2.9.<br>
&gt;<br>
&gt; =A0 =A0 in diffutils-2.9/src/io.c:<br>
&gt;<br>
&gt; =A0 =A0 static void<br>
&gt; =A0 =A0 find_identical_ends (struct file_data filevec[])<br>
&gt; =A0 =A0 {<br>
&gt; =A0 =A0 ...<br>
&gt; =A0 =A0 =A0 if (! ROBUST_OUTPUT_STYLE (output_style)<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0 || filevec[0].missing_newline =3D=3D filevec[1=
].missing_newline)<br>
&gt; =A0 =A0 =A0=A0=A0 {<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0 ...<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0 while (p0 !=3D beg0)<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0 =A0=A0=A0=A0 if (*--p0 !=3D *--p1)<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0 =A0 =A0=A0=A0=A0{<br>
&gt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0=A0=A0 ...<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0 =A0 =A0=A0=A0=A0}<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0 ...<br>
&gt; =A0 =A0 =A0=A0=A0 }<br>
&gt; =A0 =A0 =A0 /* Record the suffix.=A0 */<br>
&gt; =A0 =A0 =A0 filevec[0].suffix_begin =3D p0;<br>
&gt; =A0 =A0 =A0 filevec[1].suffix_begin =3D p1;<br>
&gt; =A0 =A0 ...<br>
&gt; =A0 =A0 }<br>
&gt;<br>
&gt; =A0 =A0 =A0=A0 We also notice that in 3.0 this bug has been fixed by a=
dding the<br>
&gt; following code:<br>
&gt;<br>
&gt; =A0 =A0 diff -u ./diffutils-2.9/src/io.c ./diffutils-3.0/src/io.c<br>
&gt; =A0 =A0 --- diffutils-2.9/src/io.c<br>
&gt; =A0 =A0 +++ diffutils-3.0/src/io.c<br>
&gt; =A0 =A0 @@ -471,7 +470,13 @@<br>
&gt;<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0 linbuf[line] =3D p;<br>
&gt;<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0 if (p =3D=3D bufend)<br>
&gt; =A0 =A0 -=A0=A0=A0=A0=A0=A0 break;<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0 {<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0=A0=A0 /* If the last line is incomplete an=
d we do not silently<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 complete lines, don&#39;t c=
ount its appended newline.=A0 */<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0=A0=A0 if (current-&gt;missing_newline &amp=
;&amp; ROBUST_OUTPUT_STYLE<br>
&gt; =A0 =A0 (output_style))<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 linbuf[line]--;<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>
&gt; =A0 =A0 +=A0=A0=A0=A0=A0=A0 }<br>
&gt;<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0 if (context &lt;=3D i &amp;&amp; no_diff_me=
ans_no_output)<br>
&gt; =A0 =A0 =A0=A0=A0=A0=A0=A0=A0 break;<br>
&gt;<br>
&gt; =A0=A0=A0=A0=A0=A0 This repair does fix the bug. However,=A0 this fix =
tries to adjust the<br>
&gt; final linbuf[line] setting rather than corrects the error cause.<br>
&gt; Instead, we suggest withdraw the change introduced in 2.9 may be a bet=
ter<br>
&gt; choice. Besides, the value of filevec[0].suffix_begin in 3.0 is not eq=
ual to<br>
&gt; that in 2.8.1, which may cause potential bugs in the future.<br>
&gt;<br>
&gt; =A0=A0=A0=A0=A0=A0 Looking forward to your reply.<br>
&gt; ---<br>
&gt; Kai YU<br>
</div></div></blockquote></div><br>

--001636e911c32af360049204da51--


From MAILER-DAEMON Fri Oct 08 00:25:31 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P44WR-0006wm-QU
	for mharc-bug-diffutils@gnu.org; Fri, 08 Oct 2010 00:25:31 -0400
Received: from [140.186.70.92] (port=60038 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P44WO-0006wS-5j
	for bug-diffutils@gnu.org; Fri, 08 Oct 2010 00:25:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1P44WM-000630-UT
	for bug-diffutils@gnu.org; Fri, 08 Oct 2010 00:25:28 -0400
Received: from vms173017pub.verizon.net ([206.46.173.17]:51844)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1P44WM-00062f-OZ
	for bug-diffutils@gnu.org; Fri, 08 Oct 2010 00:25:26 -0400
Received: from [192.168.1.10] ([unknown] [71.189.109.235])
	by vms173017.mailsrvcs.net
	(Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16
	2009)) with ESMTPA id <0L9Y000KUEY2XUB0@vms173017.mailsrvcs.net> for
	bug-diffutils@gnu.org; Thu, 07 Oct 2010 23:25:14 -0500 (CDT)
Message-id: <4CAE9D2A.7080906@cs.ucla.edu>
Date: Thu, 07 Oct 2010 21:25:14 -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.12) Gecko/20100915
	Thunderbird/3.0.8
MIME-version: 1.0
To: Kai YU <yukai@nlsde.buaa.edu.cn>
References: <AANLkTikUY-5Ov-eHdxh+doAfXTC0Q+hHJBJfvQkjo3Dx@mail.gmail.com>
	<87zkuqila1.fsf@meyering.net>
	<AANLkTikwg=Fh1usDXK57f2cHkUhFM_M-74deV_ut+hme@mail.gmail.com>
In-reply-to: <AANLkTikwg=Fh1usDXK57f2cHkUhFM_M-74deV_ut+hme@mail.gmail.com>
Content-type: text/plain; charset=UTF-8
Content-transfer-encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (1203?)
Cc: bug-diffutils@gnu.org
Subject: [bug-diffutils] Re: Bug#577832: diffutils: [REGRESSION] newline is
 added to a line that has no newline if the line is in context (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: Fri, 08 Oct 2010 04:25:29 -0000

On 10/07/2010 04:03 AM, Kai YU wrote:
> OK. Since I found the letter in bug-diffutils is kind of messy, I
> rephrase our findings as below:

Yes, something bad happened to your email before it
got published in <http://lists.gnu.org/archive/html/bug-diffutils/2010-10/msg00005.html>.  However, I think I understood it despite the encoding problems, and you can read my reply at <http://lists.gnu.org/archive/html/bug-diffutils/2010-10/msg00007.html>.


From MAILER-DAEMON Fri Oct 08 02:29:54 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P46So-0007D0-5d
	for mharc-bug-diffutils@gnu.org; Fri, 08 Oct 2010 02:29:54 -0400
Received: from [140.186.70.92] (port=37613 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P46Sl-0007Cl-2Y
	for bug-diffutils@gnu.org; Fri, 08 Oct 2010 02:29:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <sinofishbuaa@gmail.com>) id 1P46Sk-0000CK-2d
	for bug-diffutils@gnu.org; Fri, 08 Oct 2010 02:29:51 -0400
Received: from mail-pw0-f41.google.com ([209.85.160.41]:48386)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <sinofishbuaa@gmail.com>) id 1P46Sj-0000CF-S4
	for bug-diffutils@gnu.org; Fri, 08 Oct 2010 02:29:50 -0400
Received: by pwj6 with SMTP id 6so357248pwj.0
	for <bug-diffutils@gnu.org>; Thu, 07 Oct 2010 23:29:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:mime-version:sender:received
	:in-reply-to:references:from:date:x-google-sender-auth:message-id
	:subject:to:cc:content-type;
	bh=F5YRczfsn9hbO43yG+HpGkGEFbR/6KWGeTuDcJyuxfs=;
	b=tTFOe1rS8LtqR7KeIUVlMXzbi4+BjI8JEOujWaVibva0hqtQoqmnOEBnuNogq7YzZj
	f1Dnq2SP40XIOP18Sf3WSPq+Z/9KznkfyVMlCdH/DIFuW49xVMEQD0ip0s2fqUtsmzds
	AHJJ52607qmFPLJD59rTcUMEPh7w3fZtBbewg=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:cc:content-type;
	b=veOHJLd0aiO0JJnpUFJWLqjvPryxStYl50y+BAOfpHfBnZ9bOPGCrkLWpVlMXRence
	3hoCAzbyPpWn+YMDhBZHpf32jk02N/khenrK3ng48zQBbcS7dnagIdA4Wnf/rwdnOl30
	MfKKD0171PVxKAIdUna7LMcC/ChRogfdMC9Rc=
Received: by 10.142.140.7 with SMTP id n7mr1604225wfd.164.1286519387222; Thu,
	07 Oct 2010 23:29:47 -0700 (PDT)
MIME-Version: 1.0
Sender: sinofishbuaa@gmail.com
Received: by 10.143.18.13 with HTTP; Thu, 7 Oct 2010 23:29:27 -0700 (PDT)
In-Reply-To: <4CAE9D2A.7080906@cs.ucla.edu>
References: <AANLkTikUY-5Ov-eHdxh+doAfXTC0Q+hHJBJfvQkjo3Dx@mail.gmail.com>
	<87zkuqila1.fsf@meyering.net>
	<AANLkTikwg=Fh1usDXK57f2cHkUhFM_M-74deV_ut+hme@mail.gmail.com>
	<4CAE9D2A.7080906@cs.ucla.edu>
From: Kai YU <yukai@nlsde.buaa.edu.cn>
Date: Fri, 8 Oct 2010 14:29:27 +0800
X-Google-Sender-Auth: YS-xB89KywyfKgSTThHXalc-K2Y
Message-ID: <AANLkTi=-K10hvKSXqmXBs-0h_KRm=7q7Nop1iy=QEY3o@mail.gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Content-Type: multipart/alternative; boundary=000e0cd2dc461273fe0492152330
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Cc: bug-diffutils@gnu.org
Subject: [bug-diffutils] Re: Bug#577832: diffutils: [REGRESSION] newline is
 added to a line that has no newline if the line is in context (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: Fri, 08 Oct 2010 06:29:52 -0000

--000e0cd2dc461273fe0492152330
Content-Type: text/plain; charset=ISO-8859-1

This change was isolated automatically. Since none of we are familiar with
the source code of diffutils, we debuged diffutils-2.8.1, diffutils-2.9, and
diffutils-3.0 in a single step mode and compared related variables. We found
that the the value of filevec[0].suffix_begin in 3.0 is not equal to that in
2.8.1.  Owing to we do not know the specific meaning of
filevec[0].suffix_begin, we suppose the value of it is right in 2.8.1.

Now we read your reply carefully, and think the value of
filevec[0].suffix_begin is right in both 2.9 and 3.0, but wrong in 2.8.1.
Moreover, the fix is right. Sorry for disturbing and thank you for your
reply.

2010/10/8 Paul Eggert <eggert@cs.ucla.edu>

> On 10/07/2010 04:03 AM, Kai YU wrote:
> > OK. Since I found the letter in bug-diffutils is kind of messy, I
> > rephrase our findings as below:
>
> Yes, something bad happened to your email before it
> got published in <
> http://lists.gnu.org/archive/html/bug-diffutils/2010-10/msg00005.html>.
>  However, I think I understood it despite the encoding problems, and you can
> read my reply at <
> http://lists.gnu.org/archive/html/bug-diffutils/2010-10/msg00007.html>.
>

--000e0cd2dc461273fe0492152330
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

This change was isolated automatically. Since none of we are familiar=20
with the source code of diffutils, we debuged diffutils-2.8.1,=20
diffutils-2.9, and diffutils-3.0  in a single step mode and compared=20
related variables. We found that the the value of=20
filevec[0].suffix_begin in 3.0 is not equal to that in 2.8.1.=A0 Owing to=
=20
we do not know the specific meaning of filevec[0].suffix_begin, we=20
suppose the value of it is right in 2.8.1. <br>
<br>
Now we read your reply carefully, and think the value of =20
filevec[0].suffix_begin is right in both 2.9 and 3.0, but wrong in=20
2.8.1. Moreover, the fix is right. Sorry for disturbing and thank you=20
for your reply.<br><br><div class=3D"gmail_quote">2010/10/8 Paul Eggert <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:eggert@cs.ucla.edu">eggert@cs.ucla.edu=
</a>&gt;</span><br><blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0=
pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;=
">

<div class=3D"im">On 10/07/2010 04:03 AM, Kai YU wrote:<br>
&gt; OK. Since I found the letter in bug-diffutils is kind of messy, I<br>
&gt; rephrase our findings as below:<br>
<br>
</div>Yes, something bad happened to your email before it<br>
got published in &lt;<a href=3D"http://lists.gnu.org/archive/html/bug-diffu=
tils/2010-10/msg00005.html" target=3D"_blank">http://lists.gnu.org/archive/=
html/bug-diffutils/2010-10/msg00005.html</a>&gt;. =A0However, I think I und=
erstood it despite the encoding problems, and you can read my reply at &lt;=
<a href=3D"http://lists.gnu.org/archive/html/bug-diffutils/2010-10/msg00007=
.html" target=3D"_blank">http://lists.gnu.org/archive/html/bug-diffutils/20=
10-10/msg00007.html</a>&gt;.<br>


</blockquote></div><br>

--000e0cd2dc461273fe0492152330--


From MAILER-DAEMON Sun Oct 10 11:30:05 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P4xqf-0003Db-DV
	for mharc-bug-diffutils@gnu.org; Sun, 10 Oct 2010 11:30:05 -0400
Received: from [140.186.70.92] (port=35998 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P4xqW-00036N-0z
	for bug-diffutils@gnu.org; Sun, 10 Oct 2010 11:30:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jim@meyering.net>) id 1P4xkn-0003d2-Dk
	for bug-diffutils@gnu.org; Sun, 10 Oct 2010 11:24:02 -0400
Received: from mx.meyering.net ([82.230.74.64]:51437)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jim@meyering.net>) id 1P4xkn-0003cQ-7o
	for bug-diffutils@gnu.org; Sun, 10 Oct 2010 11:24:01 -0400
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id 2C1A1F60; Sun, 10 Oct 2010 17:23:59 +0200 (CEST)
From: Jim Meyering <jim@meyering.net>
To: bug-diffutils@gnu.org
Date: Sun, 10 Oct 2010 17:23:59 +0200
Message-ID: <87zkumf4vk.fsf@meyering.net>
Lines: 52
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [bug-diffutils] copyright year range policy
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, 10 Oct 2010 15:30:03 -0000

Since I've used copyright year ranges in this project, I've
just pushed this to make it clear that no information has been lost:

>From 9026760882adce9e2a000cb9f64d3b2a2de410cc Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 9 Oct 2010 15:24:05 +0200
Subject: [PATCH] maint: describe policy on copyright year number ranges

* README: Mention coreutils' long-standing policy on use of M-N
ranges in copyright year lists.  Requested by Richard Stallman.
---
 README |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/README b/README
index 061ec8a..56b52b3 100644
--- a/README
+++ b/README
@@ -44,6 +44,9 @@ this distribution:
 * help2man 1.33   <ftp://ftp.gnu.org/gnu/help2man/help2man-1.33.1.tar.gz>
 * Texinfo 4.7     <ftp://ftp.gnu.org/gnu/texinfo/texinfo-4.7.tar.gz>

+For any copyright year range specified as YYYY-ZZZZ in this package
+note that the range specifies every single year in that closed interval.
+
 Please report bugs to <bug-gnu-utils@gnu.org>.

 -----
@@ -53,15 +56,9 @@ Inc.

 This file is part of GNU Diffutils.

-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+Texts.  A copy of the license is included in the ``GNU Free
+Documentation License'' file as part of this distribution.
--
1.7.3.1.104.gc752e


From MAILER-DAEMON Mon Oct 11 13:12:12 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P5Lv1-0007AP-BW
	for mharc-bug-diffutils@gnu.org; Mon, 11 Oct 2010 13:12:11 -0400
Received: from [140.186.70.92] (port=55747 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P5Lux-00077F-TQ
	for bug-diffutils@gnu.org; Mon, 11 Oct 2010 13:12:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <agruen@suse.de>) id 1P5Luv-0005eP-VL
	for bug-diffutils@gnu.org; Mon, 11 Oct 2010 13:12:07 -0400
Received: from cantor2.suse.de ([195.135.220.15]:54154 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <agruen@suse.de>) id 1P5Luv-0005cg-MU
	for bug-diffutils@gnu.org; Mon, 11 Oct 2010 13:12:05 -0400
Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2])
	by mx2.suse.de (Postfix) with ESMTP id ADDCC89471;
	Mon, 11 Oct 2010 19:12:00 +0200 (CEST)
From: Andreas Gruenbacher <agruen@suse.de>
Organization: SUSE Labs
To: Duncan Moore <duncan.moore@gmx.com>
Subject: Re: [bug-diffutils] New diff option to compare file/directory
	properties
Date: Mon, 11 Oct 2010 19:11:58 +0200
User-Agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; i686; ; )
References: <4CA0801E.5040703@gmx.com>
In-Reply-To: <4CA0801E.5040703@gmx.com>
MIME-Version: 1.0
X-Length: 11011
X-UID: 670
Content-Type: Text/Plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Message-Id: <201010111911.58351.agruen@suse.de>
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: Mon, 11 Oct 2010 17:12:09 -0000

Hello Duncan,

On Monday 27 September 2010 13:29:34 Duncan Moore wrote:
>   Here's a description and source of a new diff option to compare file 
> and directory properties.
> I'd welcome any comments on the input and output formats, terminology, 
> any other suggestions etc.

I think we should extend the diff file format so that additional information 
can be included.  Patches should still remain backwards compatible as much as 
possible, though.

Filename quoting is one case where we won't be able to remain fully 
compatible: traditional patch will interpret quoted filenames wrong, so we 
probably should only quote when absolutely necessary.

We also need to define what diff files are supposed to be used for: for 
example, they currently contain file modification times.  Those timestamps are 
usually ignored when applying a diff (or left out in the first place).  It is 
not entirely clear which additional information to include by default (on the 
diff side), and which information to ignore by default (on the patch side).  I 
don't think file ownership should normally be stored in diff files, for 
example.

Probably the most widely used extended diff format today is that of git.  The 
"git diff" format always starts with a line of the form:

	"diff --git old_name new_name"

Additional information is stored below this line and above the actual diff in 
"extended headers", one item per line.  The actual diff is always in unified 
format.  The sources of the official documentation can be found here:

http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/diff-generate-
patch.txt

The features that the "git diff" format adds include:

 * Filename quoting using C string literals for filenames which require
   quoting.

 * Distinguishes between empty files and non-existing files.

 * Support for symlinks.

 * Support for file modes.  (The diff format includes the full file mode
   including the file type and file permission bits, but git itself only
   preserves the owner execute bit of regular files.)

 * Support for renames and copies without ending up with patches that add and
   remove the entire file.

 * Support for binary files and binary deltas is included.  (The "payload" is
   base85 encoded in this case.)

 * The SHA-1 hash of the file before and after a change is included.

The git people got many things right in this format. Unfortunately, there are 
a few peculiarities which make it difficult to use this as the "standard" 
extended diff format for diff/patch:

 * The filenames in the "diff --git" header line are of the form "a/file1" and
   "b/file2", with configurable "a/" and "b/" prefixes.  When a diff is a
   rename or copy, "copy from" and "copy to" or "rename from" and "rename to"
   extended headers are included with the old and new filename --- but those
   filenames are of the form "file1" and "file2" and *do not* include
   prefixes.  This breaks the pathname stripping logic (patch's -p option).

 * When a patch modifies the same file more than once, the behavior
   standardized in POSIX is to accumulate all changes in the result.  In the
   "git diff" format, the behavior is different: all the "file1" files refer
   to the state before applying the entire patch, and all the "file2" files
   refer to the state after applying the patch.  This is useful for patches
   which swap two files, for example, but the default GNU patch behavior still
   cannot be changed to match this.

 * The filenames in the "diff --git" line are sometimes significant.  Space
   characters in filenames are not quoted and so this line sometimes cannot
   be parsed correctly.  GNU diff could quote spaces in this case without
   compatibility problems with git, though.  (I have not managed to convince
   the git maintainers to repair this relatively minor deficiency in git.)

The "git diff" format is a good starting point nevertheless, and we should 
take a really close look.

> --compare=[content,time,mode,size,owner,group,all,objects]
> This option provides a number of file properties to compare, for normal 
> and both context output styles. Keyword 'content' means the file 
> contents, [...]

I don't understand.  There are two things to distinguish here: what diff looks 
at in order to decide if a file is considered "identical", and what 
information diff includes in its output.  Which refers to which?

Character and block special files don't make sense for me to include in a 
diff: they are not portable by design, and make little to no sense to apply in 
a different context (on a different machine or even after a driver load or 
removal on the same machine).

Directories are traditionally created and removed as needed by GNU patch.  I'm 
not sure if it makes sense to include them in diffs at all, but if we want to 
include them, doing so in a backwards compatible way (so that current 
implementations of patch will ignore directories) will not be easy.

Also, as mentioned above, I don't think that file ownership should be included 
in a diff.

> Any difference in content or file properties causes the specified 
> property information to be written to a modified context style header. 
> Note that the keyword 'time' is not written - this saves space, and is 
> more compatible with the existing context header line format.
> 
>    % diff -u --compare=all aaa bbb
>    --- aaa 2010-09-23 20:51:06.984375000 +0100 mode=-rw-r--r-- size=4 
> owner=Duncan group=None
>    +++ bbb 2010-09-23 20:51:03.015625000 +0100 mode=-rwxr--r-- size=4 
> owner=Duncan group=None
>    @@ -1 +1 @@
>    -111
>    +222

Sorry, but stuffing all this information in the "---" and "+++" header lines 
is just horrible.

Including information which did not actually change also doesn't make sense to 
me.

Thanks,
Andreas


From MAILER-DAEMON Thu Oct 14 11:46:11 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P6Q0R-0002Mx-HL
	for mharc-bug-diffutils@gnu.org; Thu, 14 Oct 2010 11:46:11 -0400
Received: from [140.186.70.92] (port=37205 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P6Q0J-0002KM-HZ
	for bug-diffutils@gnu.org; Thu, 14 Oct 2010 11:46:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <duncan.moore@gmx.com>) id 1P6Q0A-0000I5-Du
	for bug-diffutils@gnu.org; Thu, 14 Oct 2010 11:46:03 -0400
Received: from mailout-eu.gmx.com ([213.165.64.42]:55110)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <duncan.moore@gmx.com>) id 1P6Q09-0000Hd-Kz
	for bug-diffutils@gnu.org; Thu, 14 Oct 2010 11:45:54 -0400
Received: (qmail invoked by alias); 14 Oct 2010 15:45:50 -0000
Received: from cpc6-cmbg14-0-0-cust455.5-4.cable.virginmedia.com (EHLO
	[86.14.237.200]) [86.14.237.200]
	by mail.gmx.com (mp-eu002) with SMTP; 14 Oct 2010 17:45:50 +0200
X-Authenticated: #54834317
X-Provags-ID: V01U2FsdGVkX18jBq8g5ZMjynqQ8l7X7fKxTA6lYohnfITi9j72me
	ub8qcU5kyAHtWt
Received: from 127.0.0.1 (AVG SMTP 9.0.862 [271.1.1/3195]);
	Thu, 14 Oct 2010 16:47:39 +0100
Message-ID: <4CB7261A.3000506@gmx.com>
Date: Thu, 14 Oct 2010 16:47:38 +0100
From: Duncan Moore <duncan.moore@gmx.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
	rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4
MIME-Version: 1.0
To: Andreas Gruenbacher <agruen@suse.de>
Subject: Re: [bug-diffutils] New diff option to compare file/directory
	properties
References: <4CA0801E.5040703@gmx.com> <201010111911.58351.agruen@suse.de>
In-Reply-To: <201010111911.58351.agruen@suse.de>
Content-Type: multipart/alternative;
	boundary="------------000505040509030500050102"
X-Y-GMX-Trusted: 0
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
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, 14 Oct 2010 15:46:10 -0000

This is a multi-part message in MIME format.
--------------000505040509030500050102
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

  Hello Andreas

Thanks for the feedback.

On 11/10/2010 18:11, Andreas Gruenbacher wrote:
> I think we should extend the diff file format so that additional 
> information
> can be included.  Patches should still remain backwards compatible as much as
> possible, though.

I'm not sure we can have existing implementations of 'patch' working 
with the new 'diff --compare=...' output format, unless we have all the 
differing properties on a single line, so I think it may be best to 
forget about backwards compatibility in this sense. Of course, if the 
--compare=... option isn't used, then there is no change to the 'diff' 
output, and no backwards compatibility issues.

Firstly, I'll just state some of the points that the updates were 
intended to address, taken from the 'diff' info manual:

Section 18.1 - One should be able to use gnu 'diff' to generate a patch 
from any pair of directory trees, and given the patch and a copy of one 
such tree, use patch to generate a faithful copy of the other.

Section 18.1.2 Handling Changes to the Directory Structure.
'diff' and 'patch' do not handle some changes to directory structure. 
For example, suppose one directory tree contains a directory named 'D' 
with some subsidiary files, and another contains a file with the same 
name 'D'. 'diff -r' does not output enough information for 'patch' to 
transform the directory subtree into the file.
There should be a way to tell 'patch' that a file's time stamp has 
changed, even if its contents have not changed.
These problems can be fixed by extending the 'diff' output format to 
represent changes in directory structure, and extending 'patch' to 
understand these extensions.

Section 18.1.3 Files that are Neither Directories Nor Regular Files
Some files are neither directories nor regular files: they are unusual 
files like symbolic links, device special files, named pipes, and 
sockets. Currently, 'diff' treats symbolic links like regular files; it 
treats other special files like regular files if they are specified at 
the top level, but simply reports their presence when comparing 
directories. This means that 'patch' cannot represent changes to such 
files. For example, if you change which file a symbolic link points to, 
'diff' outputs the difference between the two files, instead of the 
change to the symbolic link.
'diff' should optionally report changes to special files specially, and 
'patch' should be extended to understand these extensions.

Additionally, 'diff' is not a tool for just creating input for 'patch', 
it's also for allowing the user to easily see what's different in file 
contents. The aim was to carry this principal over for other file 
properties, so that the user can selectively compare any file 
properties, either with or without the traditional file contents 
difference. This would be separate from it's use in creating patch 
files, although the output format would be the same.

> We also need to define what diff files are supposed to be used for: for
> example, they currently contain file modification times.  Those timestamps are
> usually ignored when applying a diff (or left out in the first place).  It is
> not entirely clear which additional information to include by default (on the
> diff side), and which information to ignore by default (on the patch side).  I
> don't think file ownership should normally be stored in diff files, for
> example.

My thinking was that their is no 'default' set of extra properties that 
'diff' outputs - the user has to specify them with keywords. With a 
traditional patch file from 'diff' (i.e. --compare has not been used), 
'patch' would operate exactly as it does now. If --compare=all has been 
used to supply extra information, then 'patch' would default to using 
some subset (possibly null) of the available property information - 
that's open to discussion, and more of a 'patch' matter than a 'diff' 
one. And a 'patch' option like --use=time,mode etc could be used to 
explicitly specify some subset of available properties to use.
I have used the keyword 'all', to select all available properties. Maybe 
we need to supplement this with another keyword, say 'basic', that only 
selects basic properties likely to be of use in a patch file - e.g. 
'basic' would not include ownership. And 'patch' would default to using 
the same 'basic' subset.

> Probably the most widely used extended diff format today is that of git.  The
> "git diff" format always starts with a line of the form:
>
> 	"diff --git old_name new_name"

I'm not familiar with the git 'diff' format, but I've had a look at the 
link you've given. I'm not sure how desirable it is to be compatible 
with this format. Only the mode information seems to be of  direct 
relevance to 'diff'. Some of the changes are to do with files that have 
been renamed or copied. This is information that 'diff' couldn't be 
expected to generate, although maybe the 'diff' output format should be 
able to accommodate this information even though it couldn't generate it 
itself. Also, git diff uses 'old' and 'new' in the output, which are 
concepts that are not /directly/ relevant to 'diff' itself.

> The features that the "git diff" format adds include:
>
>   * Filename quoting using C string literals for filenames which require
>     quoting.

Filename quoting is something I'm intending to include in 'diff' 
separately. Currently I'm using shell quoting style, so only filenames 
with unusual characters get quoted. It would be easy to change this to 
some other style already in gnulib, but I'll leave it to others to 
decide what the best style should be.

>   * Distinguishes between empty files and non-existing files.

I'm not sure what format git diff uses. In my updates, -N --compare=all 
would do it. One file gets marked as "non-existent" (see example at 
end), and there would be no contents difference output (so it's implicit 
rather than explicit).

>   * Support for symlinks.

Again, I'm not sure how git diff does this. See the example at the end 
for one way we could incorporate it with --compare=...

>   * Support for binary files and binary deltas is included.  (The "payload" is
>     base85 encoded in this case.)

I wasn't intending to incorporate this, and am not sure if 'diff' 
should. If it was incorporated in the future I think a separate option, 
--binary-content say, might be preferable to adding it to the 
--compare=... keyword list.

>   * The SHA-1 hash of the file before and after a change is included.

Again, I wasn't intending to incorporate this, and am not sure if 'diff' 
should. A keyword 'hash' could be added to the --compare=.. list. It 
would lead to some 'quirks' though e.g., diff -b reporting identical 
contents, but the hashes being different.

>> --compare=[content,time,mode,size,owner,group,all,objects]
>> This option provides a number of file properties to compare, for normal
>> and both context output styles. Keyword 'content' means the file
>> contents, [...]
> I don't understand.  There are two things to distinguish here: what diff looks
> at in order to decide if a file is considered "identical", and what
> information diff includes in its output.  Which refers to which?

For most of the examples I gave, if any of the specified file properties 
differ, then the whole set of specified file properties are printed for 
that file object (all on one line). I then gave an alternative output 
format, where only the selected properties that differ are printed (on 
separate lines). I now think that we should be going with the second 
format, or something like it.

> Character and block special files don't make sense for me to include in a
> diff: they are not portable by design, and make little to no sense to apply in
> a different context (on a different machine or even after a driver load or
> removal on the same machine).

Some special files may not be useful for 'patch', but 'diff' is not a 
tool for just supplying input for 'patch'. As a tool for saying what's 
different between files, I think 'diff' should be reporting it if these 
types of files are present. 'patch' would be free to ignore any 
information that is deemed not relevant for it.

> Directories are traditionally created and removed as needed by GNU patch.  I'm
> not sure if it makes sense to include them in diffs at all, but if we want to
> include them, doing so in a backwards compatible way (so that current
> implementations of patch will ignore directories) will not be easy.

Additional information for directories (and special files for that 
matter), is only output if the 'objects' keyword is used (e.g. 
--compare=all,objects). If 'objects' is used then, yes, existing 
implementations of 'patch' wouldn't cope with it, but they probably 
wouldn't cope with extra property information for regular files, unless 
it's all on one line. Also, if a file has been changed to a directory 
then it would be necessary for 'patch' to have directory information.

>> Any difference in content or file properties causes the specified
>> property information to be written to a modified context style header.
>> Note that the keyword 'time' is not written - this saves space, and is
>> more compatible with the existing context header line format.
>>
>>     % diff -u --compare=all aaa bbb
>>     --- aaa 2010-09-23 20:51:06.984375000 +0100 mode=-rw-r--r-- size=4
>> owner=Duncan group=None
>>     +++ bbb 2010-09-23 20:51:03.015625000 +0100 mode=-rwxr--r-- size=4
>> owner=Duncan group=None
>>     @@ -1 +1 @@
>>     -111
>>     +222
> Sorry, but stuffing all this information in the "---" and "+++" header lines
> is just horrible.

The idea behind this was to make the new output (more likely to be) 
compatible with existing implementations of 'patch'. However, I agree 
that this is not the best way to display the differences, and one line 
per property is better. This means giving up on having current 
implementations of 'patch' being able to process the new output format.

> Including information which did not actually change also doesn't make sense to
> me.

I agree with this too. This means that the example above would become:

   % diff -u --compare=all aaa bbb
   --- aaa
   +++ bbb
   --- time: 2010-09-23 20:51:06.984375000 +0100
   +++ time: 2010-09-23 20:51:03.015625000 +0100
   --- mode: rw-r--r--
   +++ mode: rwxr--r--
   @@ -1 +1 @@
   -111
   +222

Non-existent files would give this sort of output:

   diff -u -r -N '--compare=all,objects' 5aDN/file1 5bDN/file1
   --- 5aDN/file1 non-existent
   +++ 5bDN/file1
   +++ time: 2000-01-01 00:00:01.000000000 +0000
   +++ mode: -rw-r--r--
   +++ size: 2
   +++ owner: Duncan
   +++ group: None
   +++ object: regular file
   @@ -0,0 +1 @@
   +a

Symbolic links are normally dereferenced and treated like regular files, 
but a --no-dereference option could be used to treat symbolic links like 
the other special files:

   % diff -u --no-dereference 12u 12v
   File 12u/z is a regular file while file 12v/z is a symbolic link

   % diff -u --no-dereference '--compare=all,objects' 12u 12v
   diff -u --no-dereference '--compare=all,objects' 12u/z 12v/z
   --- 12u/z
   +++ 12v/z
   --- time: 1999-12-31 23:59:59.000000000 +0000
   +++ time: 2000-01-01 00:00:01.000000000 +0000
   --- mode: -rw-r--r--
   +++ mode: lrwxrwxrwx
   --- size: 3
   +++ size: 5
   --- object: regular file
   +++ object: symbolic link ->  ../12
   @@ -1 +0,0 @@
   -aa

In this last example, the symbolic link is treated as empty (like other 
special files) for the purposes of the contents differences.

Regards
Duncan


--------------000505040509030500050102
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-15"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hello Andreas
    <br>
    <br>
    Thanks for the feedback.
    <br>
    <br>
    On 11/10/2010 18:11, Andreas Gruenbacher wrote:
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">I
      think we should extend the diff file format so that additional
      information <br>
      <pre wrap="">can be included.  Patches should still remain backwards compatible as much as 
possible, though.
</pre>
    </blockquote>
    <br>
    I'm not sure we can have existing implementations of 'patch' working
    with the new 'diff --compare=...' output format, unless we have all
    the differing properties on a single line, so I think it may be best
    to forget about backwards compatibility in this sense. Of course, if
    the --compare=... option isn't used, then there is no change to the
    'diff' output, and no backwards compatibility issues.
    <br>
    <br>
    Firstly, I'll just state some of the points that the updates were
    intended to address, taken from the 'diff' info manual:
    <br>
    <br>
    Section 18.1 - One should be able to use gnu 'diff' to generate a
    patch from any pair of directory trees, and given the patch and a
    copy of one such tree, use patch to generate a faithful copy of the
    other.
    <br>
    <br>
    Section 18.1.2 Handling Changes to the Directory Structure.
    <br>
    'diff' and 'patch' do not handle some changes to directory
    structure. For example, suppose one directory tree contains a
    directory named &#8216;D&#8217; with some subsidiary files, and another contains
    a file with the same name &#8216;D&#8217;. &#8216;diff -r&#8217; does not output enough
    information for 'patch' to transform the directory subtree into the
    file.
    <br>
    There should be a way to tell 'patch' that a file&#8217;s time stamp has
    changed, even if its contents have not changed.
    <br>
    These problems can be fixed by extending the 'diff' output format to
    represent changes in directory structure, and extending 'patch' to
    understand these extensions.
    <br>
    <br>
    Section 18.1.3 Files that are Neither Directories Nor Regular Files
    <br>
    Some files are neither directories nor regular files: they are
    unusual files like symbolic links, device special files, named
    pipes, and sockets. Currently, 'diff' treats symbolic links like
    regular files; it treats other special files like regular files if
    they are specified at the top level, but simply reports their
    presence when comparing directories. This means that 'patch' cannot
    represent changes to such files. For example, if you change which
    file a symbolic link points to, 'diff' outputs the difference
    between the two files, instead of the change to the symbolic link.
    <br>
    'diff' should optionally report changes to special files specially,
    and 'patch' should be extended to understand these extensions.
    <br>
    <br>
    Additionally, 'diff' is not a tool for just creating input for
    'patch', it's also for allowing the user to easily see what's
    different in file contents. The aim was to carry this principal over
    for other file properties, so that the user can selectively compare
    any file properties, either with or without the traditional file
    contents difference. This would be separate from it's use in
    creating patch files, although the output format would be the same.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap="">We also need to define what diff files are supposed to be used for: for 
example, they currently contain file modification times.  Those timestamps are 
usually ignored when applying a diff (or left out in the first place).  It is 
not entirely clear which additional information to include by default (on the 
diff side), and which information to ignore by default (on the patch side).  I 
don't think file ownership should normally be stored in diff files, for 
example.
</pre>
    </blockquote>
    <br>
    My thinking was that their is no 'default' set of extra properties
    that 'diff' outputs - the user has to specify them with keywords.
    With a traditional patch file from 'diff' (i.e. --compare has not
    been used), 'patch' would operate exactly as it does now. If
    --compare=all has been used to supply extra information, then
    'patch' would default to using some subset (possibly null) of the
    available property information - that's open to discussion, and more
    of a 'patch' matter than a 'diff' one. And a 'patch' option like
    --use=time,mode etc could be used to explicitly specify some subset
    of available properties to use.
    <br>
    I have used the keyword 'all', to select all available properties.
    Maybe we need to supplement this with another keyword, say 'basic',
    that only selects basic properties likely to be of use in a patch
    file - e.g. 'basic' would not include ownership. And 'patch' would
    default to using the same 'basic' subset.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap="">Probably the most widely used extended diff format today is that of git.  The 
"git diff" format always starts with a line of the form:

	"diff --git old_name new_name"
</pre>
    </blockquote>
    <br>
    I'm not familiar with the git 'diff' format, but I've had a look at
    the link you've given. I'm not sure how desirable it is to be
    compatible with this format. Only the mode information seems to be
    of  direct relevance to 'diff'. Some of the changes are to do with
    files that have been renamed or copied. This is information that
    'diff' couldn't be expected to generate, although maybe the 'diff'
    output format should be able to accommodate this information even
    though it couldn't generate it itself. Also, git diff uses 'old' and
    'new' in the output, which are concepts that are not <i
      class="moz-txt-slash"><span class="moz-txt-tag">/</span>directly<span
        class="moz-txt-tag">/</span></i> relevant to 'diff' itself.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap="">The features that the "git diff" format adds include:

 * Filename quoting using C string literals for filenames which require
   quoting.
</pre>
    </blockquote>
    <br>
    Filename quoting is something I'm intending to include in 'diff'
    separately. Currently I'm using shell quoting style, so only
    filenames with unusual characters get quoted. It would be easy to
    change this to some other style already in gnulib, but I'll leave it
    to others to decide what the best style should be.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap=""> * Distinguishes between empty files and non-existing files.
</pre>
    </blockquote>
    <br>
    I'm not sure what format git diff uses. In my updates, -N
    --compare=all would do it. One file gets marked as "non-existent"
    (see example at end), and there would be no contents difference
    output (so it's implicit rather than explicit).
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap=""> * Support for symlinks.
</pre>
    </blockquote>
    <br>
    Again, I'm not sure how git diff does this. See the example at the
    end for one way we could incorporate it with --compare=...
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap=""> * Support for binary files and binary deltas is included.  (The "payload" is
   base85 encoded in this case.)
</pre>
    </blockquote>
    <br>
    I wasn't intending to incorporate this, and am not sure if 'diff'
    should. If it was incorporated in the future I think a separate
    option, --binary-content say, might be preferable to adding it to
    the --compare=... keyword list.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap=""> * The SHA-1 hash of the file before and after a change is included.
</pre>
    </blockquote>
    <br>
    Again, I wasn't intending to incorporate this, and am not sure if
    'diff' should. A keyword 'hash' could be added to the --compare=..
    list. It would lead to some 'quirks' though e.g., diff -b reporting
    identical contents, but the hashes being different.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <blockquote type="cite">
        <pre wrap="">--compare=[content,time,mode,size,owner,group,all,objects]
This option provides a number of file properties to compare, for normal 
and both context output styles. Keyword 'content' means the file 
contents, [...]
</pre>
      </blockquote>
      <pre wrap="">
I don't understand.  There are two things to distinguish here: what diff looks 
at in order to decide if a file is considered "identical", and what 
information diff includes in its output.  Which refers to which?
</pre>
    </blockquote>
    <br>
    For most of the examples I gave, if any of the specified file
    properties differ, then the whole set of specified file properties
    are printed for that file object (all on one line). I then gave an
    alternative output format, where only the selected properties that
    differ are printed (on separate lines). I now think that we should
    be going with the second format, or something like it.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap="">Character and block special files don't make sense for me to include in a 
diff: they are not portable by design, and make little to no sense to apply in 
a different context (on a different machine or even after a driver load or 
removal on the same machine).
</pre>
    </blockquote>
    <br>
    Some special files may not be useful for 'patch', but 'diff' is not
    a tool for just supplying input for 'patch'. As a tool for saying
    what's different between files, I think 'diff' should be reporting
    it if these types of files are present. 'patch' would be free to
    ignore any information that is deemed not relevant for it.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap="">Directories are traditionally created and removed as needed by GNU patch.  I'm 
not sure if it makes sense to include them in diffs at all, but if we want to 
include them, doing so in a backwards compatible way (so that current 
implementations of patch will ignore directories) will not be easy.
</pre>
    </blockquote>
    <br>
    Additional information for directories (and special files for that
    matter), is only output if the 'objects' keyword is used (e.g.
    --compare=all,objects). If 'objects' is used then, yes, existing
    implementations of 'patch' wouldn't cope with it, but they probably
    wouldn't cope with extra property information for regular files,
    unless it's all on one line. Also, if a file has been changed to a
    directory then it would be necessary for 'patch' to have directory
    information.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <blockquote type="cite">
        <pre wrap="">Any difference in content or file properties causes the specified 
property information to be written to a modified context style header. 
Note that the keyword 'time' is not written - this saves space, and is 
more compatible with the existing context header line format.

   % diff -u --compare=all aaa bbb
   --- aaa 2010-09-23 20:51:06.984375000 +0100 mode=-rw-r--r-- size=4 
owner=Duncan group=None
   +++ bbb 2010-09-23 20:51:03.015625000 +0100 mode=-rwxr--r-- size=4 
owner=Duncan group=None
   @@ -1 +1 @@
   -111
   +222
</pre>
      </blockquote>
      <pre wrap="">
Sorry, but stuffing all this information in the "---" and "+++" header lines 
is just horrible.
</pre>
    </blockquote>
    <br>
    The idea behind this was to make the new output (more likely to be)
    compatible with existing implementations of 'patch'. However, I
    agree that this is not the best way to display the differences, and
    one line per property is better. This means giving up on having
    current implementations of 'patch' being able to process the new
    output format.
    <br>
    <br>
    <blockquote cite="mid:201010111911.58351.agruen@suse.de" type="cite">
      <pre wrap="">Including information which did not actually change also doesn't make sense to 
me.
</pre>
    </blockquote>
    <br>
    I agree with this too. This means that the example above would
    become:
    <br>
    <br>
      % diff -u --compare=all aaa bbb
    <br>
      --- aaa
    <br>
      +++ bbb
    <br>
      --- time: 2010-09-23 20:51:06.984375000 +0100
    <br>
      +++ time: 2010-09-23 20:51:03.015625000 +0100
    <br>
      --- mode: rw-r--r--
    <br>
      +++ mode: rwxr--r--
    <br>
      @@ -1 +1 @@
    <br>
      -111
    <br>
      +222
    <br>
    <br>
    Non-existent files would give this sort of output:
    <br>
    <br>
      diff -u -r -N '--compare=all,objects' 5aDN/file1 5bDN/file1
    <br>
      --- 5aDN/file1 non-existent
    <br>
      +++ 5bDN/file1
    <br>
      +++ time: 2000-01-01 00:00:01.000000000 +0000
    <br>
      +++ mode: -rw-r--r--
    <br>
      +++ size: 2
    <br>
      +++ owner: Duncan
    <br>
      +++ group: None
    <br>
      +++ object: regular file
    <br>
      @@ -0,0 +1 @@
    <br>
      +a
    <br>
    <br>
    Symbolic links are normally dereferenced and treated like regular
    files, but a --no-dereference option could be used to treat symbolic
    links like the other special files:
    <br>
    <br>
      % diff -u --no-dereference 12u 12v
    <br>
      File 12u/z is a regular file while file 12v/z is a symbolic link
    <br>
    <br>
      % diff -u --no-dereference '--compare=all,objects' 12u 12v
    <br>
      diff -u --no-dereference '--compare=all,objects' 12u/z 12v/z
    <br>
      --- 12u/z
    <br>
      +++ 12v/z
    <br>
      --- time: 1999-12-31 23:59:59.000000000 +0000
    <br>
      +++ time: 2000-01-01 00:00:01.000000000 +0000
    <br>
      --- mode: -rw-r--r--
    <br>
      +++ mode: lrwxrwxrwx
    <br>
      --- size: 3
    <br>
      +++ size: 5
    <br>
      --- object: regular file
    <br>
      +++ object: symbolic link -&gt;  ../12
    <br>
      @@ -1 +0,0 @@
    <br>
      -aa
    <br>
    <br>
    In this last example, the symbolic link is treated as empty (like
    other special files) for the purposes of the contents differences.
    <br>
    <br>
    Regards<br>
    Duncan<br>
    <br>
  </body>
</html>

--------------000505040509030500050102--


From MAILER-DAEMON Fri Oct 15 09:38:57 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P6kUr-0006I0-Kw
	for mharc-bug-diffutils@gnu.org; Fri, 15 Oct 2010 09:38:57 -0400
Received: from [140.186.70.92] (port=59691 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P6kUn-0006E5-Na
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 09:38:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <agruen@suse.de>) id 1P6kUl-0001We-Gs
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 09:38:53 -0400
Received: from cantor2.suse.de ([195.135.220.15]:48868 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <agruen@suse.de>) id 1P6kUl-0001Vb-0O
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 09:38:51 -0400
Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2])
	by mx2.suse.de (Postfix) with ESMTP id E02D3890B6;
	Fri, 15 Oct 2010 15:38:48 +0200 (CEST)
From: Andreas Gruenbacher <agruen@suse.de>
Organization: SUSE Labs
To: Duncan Moore <duncan.moore@gmx.com>,
	Paul Eggert <eggert@cs.ucla.edu>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [bug-diffutils] New diff option to compare file/directory
	properties
Date: Fri, 15 Oct 2010 15:38:47 +0200
User-Agent: KMail/1.12.4 (Linux/2.6.36-rc7+; KDE/4.3.5; i686; ; )
References: <4CA0801E.5040703@gmx.com> <201010111911.58351.agruen@suse.de>
	<4CB7261A.3000506@gmx.com>
In-Reply-To: <4CB7261A.3000506@gmx.com>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Message-Id: <201010151538.47467.agruen@suse.de>
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: Fri, 15 Oct 2010 13:38:56 -0000

On Thursday 14 October 2010 17:47:38 Duncan Moore wrote:
>   Hello Andreas
> 
> Thanks for the feedback.
> 
> On 11/10/2010 18:11, Andreas Gruenbacher wrote:
> > I think we should extend the diff file format so that additional 
> > information can be included.  Patches should still remain backwards
> > compatible as much as possible, though.
> 
> I'm not sure we can have existing implementations of 'patch' working 
> with the new 'diff --compare=...' output format, unless we have all the 
> differing properties on a single line,

We can relatively easily put additional information before the actual diff, 
like git does.  Existing patch implementations like GNU patch which ignore 
leading information which they don't understand will continue to apply diffs 
to regular files just fine.

> so I think it may be best to forget about backwards compatibility in this
> sense.

I strongly disagree.  People will continue to use existing implementations of 
patch, and it is important to ensure that those implementations will behave 
"reasonably" with extended patches.

> Of course, if the --compare=... option isn't used, then there is no
> change to the 'diff' output, and no backwards compatibility issues.

I think that some information like file permissions and symlinks should be 
included in patches by default.

> Firstly, I'll just state some of the points that the updates were 
> intended to address, taken from the 'diff' info manual:
> 
> Section 18.1

It is important to note that section 18.1 is about "some ideas for improving 
GNU diff and patch".  I agree with many of those ideas, but this section 
probably shouldn't be treated as if it was set in stone.



> - One should be able to use gnu 'diff' to generate a patch 
> from any pair of directory trees, and given the patch and a copy of one 
> such tree, use patch to generate a faithful copy of the other.
> 
> Section 18.1.2 Handling Changes to the Directory Structure.
> 'diff' and 'patch' do not handle some changes to directory structure. 
> For example, suppose one directory tree contains a directory named 'D' 
> with some subsidiary files, and another contains a file with the same 
> name 'D'. 'diff -r' does not output enough information for 'patch' to 
> transform the directory subtree into the file.
> There should be a way to tell 'patch' that a file's time stamp has 
> changed, even if its contents have not changed.
> These problems can be fixed by extending the 'diff' output format to 
> represent changes in directory structure, and extending 'patch' to 
> understand these extensions.
> 
> Section 18.1.3 Files that are Neither Directories Nor Regular Files
> Some files are neither directories nor regular files: they are unusual 
> files like symbolic links, device special files, named pipes, and 
> sockets. Currently, 'diff' treats symbolic links like regular files; it 
> treats other special files like regular files if they are specified at 
> the top level, but simply reports their presence when comparing 
> directories. This means that 'patch' cannot represent changes to such 
> files. For example, if you change which file a symbolic link points to, 
> 'diff' outputs the difference between the two files, instead of the 
> change to the symbolic link.
> 'diff' should optionally report changes to special files specially, and 
> 'patch' should be extended to understand these extensions.
> 


> Additionally, 'diff' is not a tool for just creating input for 'patch', 
> it's also for allowing the user to easily see what's different in file 
> contents.

Fair enough.  

> The aim was to carry this principal over for other file 
> properties, so that the user can selectively compare any file 
> properties, either with or without the traditional file contents 
> difference. This would be separate from it's use in creating patch 
> files, although the output format would be the same.

I don't see the point in excluding file content differences.  What would be a 
reasonably general use case for this?

> > We also need to define what diff files are supposed to be used for: for
> > example, they currently contain file modification times.  Those timestamps
> > are usually ignored when applying a diff (or left out in the first place).
> > It is not entirely clear which additional information to include by
> > default (on the diff side), and which information to ignore by default (on
> > the patch side).  I don't think file ownership should normally be stored
> > in diff files, for example.
> 
> My thinking was that their is no 'default' set of extra properties that 
> 'diff' outputs - the user has to specify them with keywords. With a 
> traditional patch file from 'diff' (i.e. --compare has not been used), 
> 'patch' would operate exactly as it does now. If --compare=all has been 
> used to supply extra information, then 'patch' would default to using 
> some subset (possibly null) of the available property information - 
> that's open to discussion, and more of a 'patch' matter than a 'diff' 
> one. And a 'patch' option like --use=time,mode etc could be used to 
> explicitly specify some subset of available properties to use.
> I have used the keyword 'all', to select all available properties. Maybe 
> we need to supplement this with another keyword, say 'basic', that only 
> selects basic properties likely to be of use in a patch file - e.g. 
> 'basic' would not include ownership. And 'patch' would default to using 
> the same 'basic' subset.

I don't think introducing all those funny keywords is the right way to go.  
Most people will not use any of them, and GNU diff should probably still 
include most or all additional information available as long as it doesn't 
cause backwards compatibility problems.

> > Probably the most widely used extended diff format today is that of git.  
The
> > "git diff" format always starts with a line of the form:
> >
> > 	"diff --git old_name new_name"
> 
> I'm not familiar with the git 'diff' format, but I've had a look at the 
> link you've given. I'm not sure how desirable it is to be compatible 
> with this format. Only the mode information seems to be of  direct 
> relevance to 'diff'.

As is distinguishing between empty and non-existent files, filename quoting, 
symlink support.  Please have a closer look at how this format works to avoid 
re-inventing the wheel.  You can find some examples and "git diff" format 
parsing code in the GNU patch repository.

> Some of the changes are to do with files that have been renamed or copied.
> This is information that 'diff' couldn't be expected to generate,

Not trivially, but version control systems have shown that it is possible: 
some track renames and copies; others use heuristics to recognize similar 
files.

> although maybe the 'diff' output format should be able to accommodate this
> information even though it couldn't generate it itself.

Yes, the format should definitely be powerful enough to express copies and 
renames.

> Also, git diff uses 'old' and 'new' in the output, which are concepts that
> are not /directly/ relevant to 'diff' itself.

How are they not directly relevant?  Diff also basically compares two files; 
feel free to call them 'file1' and 'file2' or 'left' and 'right' or whatever 
instead of 'old' and 'new'.

> > The features that the "git diff" format adds include:
> >
> >   * Filename quoting using C string literals for filenames which require
> >     quoting.
> 
> Filename quoting is something I'm intending to include in 'diff' 
> separately. Currently I'm using shell quoting style, so only filenames 
> with unusual characters get quoted.

Only quoting unusual characters is a good idea because it means that the 
format will remain compatible with old versions of patch when "normal" 
filenames are used.

Also see here:

	http://marc.info/?l=git&m=112927316408690&w=2

> It would be easy to change this to some other style already in gnulib, but
> I'll leave it to others to decide what the best style should be.

One of the key differences between quoting in gnulib and in git is that gnulib 
treats filenames as sequences of characters which may be multi-byte, while git 
treats them as sequences of bytes.

I'm not sure about the reasoning behind ignoring multi-byte characters; maybe 
Paul or Junio can enlighten us.

> >   * Distinguishes between empty files and non-existing files.
> 
> I'm not sure what format git diff uses. In my updates, -N --compare=all 
> would do it. One file gets marked as "non-existent" (see example at 
> end), and there would be no contents difference output (so it's implicit 
> rather than explicit).

Please have a look at how this format works then.  There is some more 
information in this thread on the git mailing list:

	http://www.spinics.net/lists/git/msg142547.html

> >   * Support for symlinks.
> 
> Again, I'm not sure how git diff does this. See the example at the end 
> for one way we could incorporate it with --compare=...
>
> >   * Support for binary files and binary deltas is included.  (The
> >   "payload" is base85 encoded in this case.)
> 
> I wasn't intending to incorporate this, and am not sure if 'diff' 
> should. If it was incorporated in the future I think a separate option, 
> --binary-content say, might be preferable to adding it to the 
> --compare=... keyword list.

Fair enough for now.

> >   * The SHA-1 hash of the file before and after a change is included.
> 
> Again, I wasn't intending to incorporate this, and am not sure if 'diff' 
> should. A keyword 'hash' could be added to the --compare=.. list. It 
> would lead to some 'quirks' though e.g., diff -b reporting identical 
> contents, but the hashes being different.

Fine.

> >> --compare=[content,time,mode,size,owner,group,all,objects]
> >> This option provides a number of file properties to compare, for normal
> >> and both context output styles. Keyword 'content' means the file
> >> contents, [...]
> > I don't understand.  There are two things to distinguish here: what diff
> > looks at in order to decide if a file is considered "identical", and what
> > information diff includes in its output.  Which refers to which?
> 
> For most of the examples I gave, if any of the specified file properties 
> differ, then the whole set of specified file properties are printed for 
> that file object (all on one line). I then gave an alternative output 
> format, where only the selected properties that differ are printed (on 
> separate lines). I now think that we should be going with the second 
> format, or something like it.

I agree that one item per line is preferable.

> > Character and block special files don't make sense for me to include in a
> > diff: they are not portable by design, and make little to no sense to
> > apply in a different context (on a different machine or even after a
> > driver load or removal on the same machine).
> 
> Some special files may not be useful for 'patch', but 'diff' is not a 
> tool for just supplying input for 'patch'. As a tool for saying what's 
> different between files, I think 'diff' should be reporting it if these 
> types of files are present.

It does now already.  IMO it would be sufficient for GNU diff to report the 
file type and name either when a file is found only in one tree or when a file 
exists in both trees but refers to different file types or devices.  Device 
numbers should probably not end up in patches; this is not an archive format.

> [...]
> This means that the example above would become:
> 
>    % diff -u --compare=all aaa bbb
>    --- aaa
>    +++ bbb
>    --- time: 2010-09-23 20:51:06.984375000 +0100
>    +++ time: 2010-09-23 20:51:03.015625000 +0100
>    --- mode: rw-r--r--
>    +++ mode: rwxr--r--
>    @@ -1 +1 @@
>    -111
>    +222

No way: overloading the meaning of the "---" and "+++" headers would 
completely break every existing implementation of patch.

> Non-existent files would give this sort of output:
> [...]

Please have a look how GNU diff uses Epoch timestamps and how cvs / svn / git 
use /dev/null for creates and deletes.

> Symbolic links are normally dereferenced and treated like regular files,
> but a --no-dereference option could be used to treat symbolic links like 
> the other special files:

I believe this is a mistake; the way how GNU diff currently treats symlinks 
(as regular files) is likely to lead to undesired results.  At the very least, 
GNU diff should print a warning.

Symlinks never have any "file content" so the file the symlink points to could 
be treated as the "file content".

Thanks,
Andreas


From MAILER-DAEMON Fri Oct 15 14:25:16 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P6oxv-0001fh-VY
	for mharc-bug-diffutils@gnu.org; Fri, 15 Oct 2010 14:25:16 -0400
Received: from [140.186.70.92] (port=60843 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P6lR8-0001wk-TD
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 10:39:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <me@thomaskeller.biz>) id 1P6lR7-0000ZJ-LR
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 10:39:10 -0400
Received: from static.161.201.40.188.clients.your-server.de
	([188.40.201.161]:36980 helo=familiekeller.org)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <me@thomaskeller.biz>) id 1P6lR7-0000Z9-Ga
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 10:39:09 -0400
Received: from [85.232.10.50] (port=44210 helo=[10.16.24.55])
	by familiekeller.org with esmtpsa 
	(Cipher TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69 #1)
	id 1P6lR5-0005bC-Ki by authid <me@thomaskeller.biz> with dovecot_plain
	for <bug-diffutils@gnu.org>; Fri, 15 Oct 2010 16:39:07 +0200
Message-ID: <4CB8678B.5080003@thomaskeller.biz>
Date: Fri, 15 Oct 2010 16:39:07 +0200
From: Thomas Keller <me@thomaskeller.biz>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; de;
	rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Lightning/1.0b2pre
	Thunderbird/3.0.6
MIME-Version: 1.0
To: bug-diffutils@gnu.org
X-Enigmail-Version: 1.0.1
OpenPGP: id=160D1092;
	url=http://thomaskeller.biz/pgp/thomas-keller.pkr
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enig1A1361BA5A03F360963C2319"
X-Broken-Reverse-DNS: no host name for IP address 85.232.10.50
X-SA-Exim-Connect-IP: 85.232.10.50
X-SA-Exim-Mail-From: me@thomaskeller.biz
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Mailman-Approved-At: Fri, 15 Oct 2010 14:25:14 -0400
Subject: [bug-diffutils] Does patch ignore Linux ACLs?
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, 15 Oct 2010 14:39:11 -0000

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


Hi!

I stumbled upon this several times, but last time I was bitten a bit
hard. My umask on some server creates no world-readable files, but this
should actually not be a problem when ACLs are in place which inherit
permissions from default rules for certain users and groups, right?

I was quite astouned that patch(1) however ignored these default ACLs
when it created new files form a patch it received from STDIN. Is this
expected behaviour or considered a bug?

Thanks in advance for enlightening answers,
Thomas.

--=20
GPG-Key 0x160D1092 | tommyd3mdi@jabber.ccc.de | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=3Den=




--------------enig1A1361BA5A03F360963C2319
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.15 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAky4Z4sACgkQaf7NlBYNEJLKgACg8pJzfC7ITVv0cGZfT9lS0TO6
d5YAoIiky8xNkBl171C6Uu6mhosq3rh1
=gR13
-----END PGP SIGNATURE-----

--------------enig1A1361BA5A03F360963C2319--


From MAILER-DAEMON Fri Oct 15 18:55:24 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P6tBM-00008d-4v
	for mharc-bug-diffutils@gnu.org; Fri, 15 Oct 2010 18:55:24 -0400
Received: from [140.186.70.92] (port=48362 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P6tBK-00008K-55
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 18:55:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1P6tBJ-0002JK-1v
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 18:55:21 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:56459)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1P6tBI-0002JC-ST
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 18:55:21 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 8B75539E8100;
	Fri, 15 Oct 2010 15:55:18 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
	by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id nR+DVZ-ZwV9f; Fri, 15 Oct 2010 15:55:18 -0700 (PDT)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2CB4439E80F0;
	Fri, 15 Oct 2010 15:55:18 -0700 (PDT)
Message-ID: <4CB8DBD5.3030202@cs.ucla.edu>
Date: Fri, 15 Oct 2010 15:55:17 -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.12) Gecko/20100915 Thunderbird/3.0.8
MIME-Version: 1.0
To: Thomas Keller <me@thomaskeller.biz>
Subject: Re: [bug-diffutils] Does patch ignore Linux ACLs?
References: <4CB8678B.5080003@thomaskeller.biz>
In-Reply-To: <4CB8678B.5080003@thomaskeller.biz>
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
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, 15 Oct 2010 22:55:23 -0000

On 10/15/10 07:39, Thomas Keller wrote:
> My umask on some server creates no world-readable files, but this
> should actually not be a problem when ACLs are in place which inherit
> permissions from default rules for certain users and groups, right?
> 
> I was quite astouned that patch(1) however ignored these default ACLs
> when it created new files form a patch it received from STDIN. Is this
> expected behaviour or considered a bug?

Sorry, I'm lost, and I expect almost any other reader of your email
would be lost too, as there's not enough context.  Can you please
tell us a specific way to reproduce the bug?


From MAILER-DAEMON Fri Oct 15 19:00:08 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P6tFw-0000aI-EH
	for mharc-bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:00:08 -0400
Received: from [140.186.70.92] (port=54797 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P6tFt-0000aB-DK
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:00:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1P6tFs-0002qK-9N
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:00:05 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:58683)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1P6tFs-0002qD-2x
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:00:04 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 7D6B239E80F0;
	Fri, 15 Oct 2010 16:00:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
	by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id dJ0xjSl3vYIk; Fri, 15 Oct 2010 16:00:03 -0700 (PDT)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 19A4639E80DC;
	Fri, 15 Oct 2010 16:00:03 -0700 (PDT)
Message-ID: <4CB8DCF2.1010908@cs.ucla.edu>
Date: Fri, 15 Oct 2010 16:00:02 -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.12) Gecko/20100915 Thunderbird/3.0.8
MIME-Version: 1.0
To: Andreas Gruenbacher <agruen@suse.de>
Subject: Re: [bug-diffutils] New diff option to compare file/directory
	properties
References: <4CA0801E.5040703@gmx.com> <201010111911.58351.agruen@suse.de>
	<4CB7261A.3000506@gmx.com> <201010151538.47467.agruen@suse.de>
In-Reply-To: <201010151538.47467.agruen@suse.de>
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: bug-diffutils@gnu.org, Junio C Hamano <gitster@pobox.com>
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, 15 Oct 2010 23:00:06 -0000

On 10/15/10 06:38, Andreas Gruenbacher wrote:
> One of the key differences between quoting in gnulib and in git is that gnulib 
> treats filenames as sequences of characters which may be multi-byte, while git 
> treats them as sequences of bytes.
> 
> I'm not sure about the reasoning behind ignoring multi-byte characters; maybe 
> Paul or Junio can enlighten us.

I can't speak for Jun, but I expect the answer is, "Don't worry
about stupid encodings".  If you use a reasonable encoding like UTF-8,
git's quoting method works just like gnulib's does.  I don't think diffutils
(or git) needs to worry about what happens to users who insist on using
those awful legacy encodings.


From MAILER-DAEMON Fri Oct 15 19:12:00 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P6tRQ-0005XH-Dg
	for mharc-bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:12:00 -0400
Received: from [140.186.70.92] (port=34757 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P6tRN-0005Va-Q0
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:11:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <me@thomaskeller.biz>) id 1P6tRM-0004fO-BH
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:11:57 -0400
Received: from static.161.201.40.188.clients.your-server.de
	([188.40.201.161]:54869 helo=familiekeller.org)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <me@thomaskeller.biz>) id 1P6tRM-0004fH-1x
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:11:56 -0400
Received: from f053098036.adsl.alicedsl.de ([78.53.98.36]:61108
	helo=[192.168.4.100]) by familiekeller.org with esmtpsa 
	(Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69 #1)
	id 1P6tRK-0005NY-00 by authid <me@thomaskeller.biz> with dovecot_plain;
	Sat, 16 Oct 2010 01:11:54 +0200
Message-ID: <4CB8DFB2.4010205@thomaskeller.biz>
Date: Sat, 16 Oct 2010 01:11:46 +0200
From: Thomas Keller <me@thomaskeller.biz>
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de;
	rv:1.9.2.11) Gecko/20101004 Lightning/1.0b3pre Thunderbird/3.1.5
MIME-Version: 1.0
To: Paul Eggert <eggert@cs.ucla.edu>
References: <4CB8678B.5080003@thomaskeller.biz> <4CB8DBD5.3030202@cs.ucla.edu>
In-Reply-To: <4CB8DBD5.3030202@cs.ucla.edu>
X-Enigmail-Version: 1.1.1
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enig574AA3440D3C36D9914A84D8"
X-SA-Exim-Connect-IP: 78.53.98.36
X-SA-Exim-Mail-From: me@thomaskeller.biz
Subject: Re: [bug-diffutils] Does patch ignore Linux ACLs?
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
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, 15 Oct 2010 23:11:59 -0000

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

Am 16.10.10 00:55, schrieb Paul Eggert:
> On 10/15/10 07:39, Thomas Keller wrote:
>> My umask on some server creates no world-readable files, but this
>> should actually not be a problem when ACLs are in place which inherit
>> permissions from default rules for certain users and groups, right?
>>
>> I was quite astouned that patch(1) however ignored these default ACLs
>> when it created new files form a patch it received from STDIN. Is this=

>> expected behaviour or considered a bug?
>=20
> Sorry, I'm lost, and I expect almost any other reader of your email
> would be lost too, as there's not enough context.  Can you please
> tell us a specific way to reproduce the bug?

Oh, sorry, of course. Here we go:

1) Create a test directory and place a default ACL on it for some other
user ("apache" in this example):

$ mkdir test
$ setfacl -m d:u:apache:rwx test
$ getfacl test
# file: test
# owner: me
# group: me
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:apache:rwx
default:group::r-x
default:mask::rwx
default:other::r-x

2) Create a file in test/ with some editor and save some content in it:

~/test $ ls -la
total 12K
drwxr-xr-x+ 2 me me 4.0K 2010-10-16 00:58 ./
drwxr-xr-x  6 me me 4.0K 2010-10-16 00:57 ../
-rw-rw-r--+ 1 me me   16 2010-10-16 00:58 test
~/test $ getfacl test
# file: test
# owner: me
# group: me
user::rw-
user:apache:rwx			#effective:rw-
group::r-x			#effective:r--
mask::rw-
other::r--

The created test file gets automatically the expected rights from the
default rule.

3) Now copy test to test2, edit some contents and create a patch:

~/test $ cp test test2
~/test $ nano test2
~/test $ diff -u test test2 > patch
~/test $ cat patch
--- test	2010-10-16 00:58:11.620542512 +0200
+++ test2	2010-10-16 00:58:51.480539647 +0200
@@ -1,2 +1,3 @@
 This is a test
+This is a new line

Everything still looks ok here:

~/test $ ll
total 20K
drwxr-xr-x+ 2 me me 4.0K 2010-10-16 00:59 ./
drwxr-xr-x  6 me me 4.0K 2010-10-16 00:57 ../
-rw-rw-r--+ 1 me me  145 2010-10-16 00:59 patch
-rw-rw-r--+ 1 me me   16 2010-10-16 00:58 test
-rw-rw-r--+ 1 me me   35 2010-10-16 00:58 test2

4) Finally apply this patch:

~/test $ patch -p0 < patch
patching file test
~/test $ ll
total 20K
drwxr-xr-x+ 2 me me 4.0K 2010-10-16 00:59 ./
drwxr-xr-x  6 me me 4.0K 2010-10-16 00:57 ../
-rw-rw-r--+ 1 me me  145 2010-10-16 00:59 patch
-rw-rw-r--  1 me me   35 2010-10-16 00:59 test
-rw-rw-r--+ 1 me me   35 2010-10-16 00:58 test2
~/test $ getfacl test
# file: test
# owner: me
# group: me
user::rw-
group::rw-
other::r--

And suddenly the test file lost its ACL - do'h!

This is patch 2.5.9, btw.

Thomas.

--=20
GPG-Key 0x160D1092 | tommyd3mdi@jabber.ccc.de | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=3Den=



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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAky437kACgkQaf7NlBYNEJKgMACgxVRWyEV7xqBRPGQtG5NAZbHH
GW0An34sWABbqBBk14QibkAZdO1yNxSh
=rJFJ
-----END PGP SIGNATURE-----

--------------enig574AA3440D3C36D9914A84D8--


From MAILER-DAEMON Fri Oct 15 19:27:57 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P6tgr-00018I-MM
	for mharc-bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:27:57 -0400
Received: from [140.186.70.92] (port=54512 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P6tgo-00017x-N0
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:27:55 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1P6tgn-00074X-P6
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:27:54 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:53295)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>)
	id 1P6tgn-00074T-JI; Fri, 15 Oct 2010 19:27:53 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id A442239E80F0;
	Fri, 15 Oct 2010 16:27:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
	by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id cBiyp3pFMYSA; Fri, 15 Oct 2010 16:27:51 -0700 (PDT)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id B039939E80DC;
	Fri, 15 Oct 2010 16:27:51 -0700 (PDT)
Message-ID: <4CB8E377.8090309@cs.ucla.edu>
Date: Fri, 15 Oct 2010 16:27:51 -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.12) Gecko/20100915 Thunderbird/3.0.8
MIME-Version: 1.0
To: Thomas Keller <me@thomaskeller.biz>
Subject: Re: [bug-diffutils] Does patch ignore Linux ACLs?
References: <4CB8678B.5080003@thomaskeller.biz> <4CB8DBD5.3030202@cs.ucla.edu>
	<4CB8DFB2.4010205@thomaskeller.biz>
In-Reply-To: <4CB8DFB2.4010205@thomaskeller.biz>
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: bug-diffutils@gnu.org, bug-patch@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, 15 Oct 2010 23:27:56 -0000

On 10/15/10 16:11, Thomas Keller wrote:
> And suddenly the test file lost its ACL - do'h!

The file didn't lose its ACL.  What happens is that
a copy was created, and then renamed over the original.
At one point chmod is applied to the copy, so that it
has the right permissions.  That's what removes the
default ACL.

This does appear to be a bug.  One possible fix
would be for 'patch' to not do the chmod unless it really
needs to, which typically it doesn't.

This bug report really belongs in bug-patch, by the way,
so I'll CC: this followup here.  The original thread is at
<http://lists.gnu.org/archive/html/bug-diffutils/2010-10/msg00015.html>.


From MAILER-DAEMON Fri Oct 15 19:36:43 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P6tpL-0004sv-1q
	for mharc-bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:36:43 -0400
Received: from [140.186.70.92] (port=50990 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P6tpI-0004sA-6v
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:36:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <me@thomaskeller.biz>) id 1P6tpG-0001JM-Q7
	for bug-diffutils@gnu.org; Fri, 15 Oct 2010 19:36:40 -0400
Received: from static.161.201.40.188.clients.your-server.de
	([188.40.201.161]:40635 helo=familiekeller.org)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <me@thomaskeller.biz>)
	id 1P6tpG-0001J9-L9; Fri, 15 Oct 2010 19:36:38 -0400
Received: from f053098036.adsl.alicedsl.de ([78.53.98.36]:61148
	helo=[192.168.4.100]) by familiekeller.org with esmtpsa 
	(Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69 #1)
	id 1P6tpE-0006pE-Bw by authid <me@thomaskeller.biz> with dovecot_plain;
	Sat, 16 Oct 2010 01:36:36 +0200
Message-ID: <4CB8E57E.6070109@thomaskeller.biz>
Date: Sat, 16 Oct 2010 01:36:30 +0200
From: Thomas Keller <me@thomaskeller.biz>
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de;
	rv:1.9.2.11) Gecko/20101004 Lightning/1.0b3pre Thunderbird/3.1.5
MIME-Version: 1.0
To: Paul Eggert <eggert@cs.ucla.edu>
References: <4CB8678B.5080003@thomaskeller.biz> <4CB8DBD5.3030202@cs.ucla.edu>
	<4CB8DFB2.4010205@thomaskeller.biz> <4CB8E377.8090309@cs.ucla.edu>
In-Reply-To: <4CB8E377.8090309@cs.ucla.edu>
X-Enigmail-Version: 1.1.1
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enig4022F6E2AFD7167BFBA69E6E"
X-SA-Exim-Connect-IP: 78.53.98.36
X-SA-Exim-Mail-From: me@thomaskeller.biz
Subject: Re: [bug-diffutils] Does patch ignore Linux ACLs?
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: bug-diffutils@gnu.org, bug-patch@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, 15 Oct 2010 23:36:41 -0000

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

Am 16.10.10 01:27, schrieb Paul Eggert:
> On 10/15/10 16:11, Thomas Keller wrote:
>> And suddenly the test file lost its ACL - do'h!
>=20
> The file didn't lose its ACL.  What happens is that a copy was
> created, and then renamed over the original. At one point chmod is
> applied to the copy, so that it has the right permissions.  That's
> what removes the default ACL.

Actually chmod(1) should not remove the ACL (and not even the default
ACL, because this only exists on the directory), but maybe the problem
is that the default directory ACL is not (automatically) applied to the
newly created copy?

See, I thought something like this and it made me look at how ACLs are
actually implemented in Linux. It seems as if each application has to
take care of ACLs with special syscalls itself and that it this is not
automatically handled by the underlying file system, which is kind of a
pity, because I guess many, many applications beside the core tools like
cp and friends will probably ignore them by default.

> This does appear to be a bug.  One possible fix would be for 'patch'
> to not do the chmod unless it really needs to, which typically it
> doesn't.

Or if a copy is created, simply copying over the ACLs of the old file to
the new file before it is renamed. At least there is an option to do
that in setfacl(1), this might be UI sugar, though.

> This bug report really belongs in bug-patch, by the way, so I'll CC:
> this followup here.  The original thread is at=20
> <http://lists.gnu.org/archive/html/bug-diffutils/2010-10/msg00015.html>=
=2E

Ok, many thanks for the forward!

Thomas.

--
GPG-Key 0x160D1092 | tommyd3mdi@jabber.ccc.de | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=3Den=



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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAky45YMACgkQaf7NlBYNEJJjQQCfTMWvlQQvAb3YMdNiaXIeko3B
sUsAoO/J070N2OAecCy2aTbyhbQPsqYC
=iq0N
-----END PGP SIGNATURE-----

--------------enig4022F6E2AFD7167BFBA69E6E--


From MAILER-DAEMON Sun Oct 17 08:09:14 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P7S37-0004PI-Vu
	for mharc-bug-diffutils@gnu.org; Sun, 17 Oct 2010 08:09:14 -0400
Received: from [140.186.70.92] (port=40715 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P7LFW-0000pV-6d
	for bug-diffutils@gnu.org; Sun, 17 Oct 2010 00:53:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gitster@pobox.com>) id 1P7L6Y-0004vD-I2
	for bug-diffutils@gnu.org; Sun, 17 Oct 2010 00:44:19 -0400
Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:64235
	helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gitster@pobox.com>) id 1P7L6Y-0004v9-Fb
	for bug-diffutils@gnu.org; Sun, 17 Oct 2010 00:44:18 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
	by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id CBC40DFC2C;
	Sun, 17 Oct 2010 00:44:16 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=to:cc:subject
	:references:from:date:message-id:mime-version:content-type; s=
	sasl; bh=L3040Fyi/D5PkP80VKsT/EALXK8=; b=QMtg7Pu9YJWc93/abdLqOYd
	EBRv0X+zfTdaSCvhouJRSysimqJ2Oz58k7lilENxmgr97RpbuvXCHqDsWdowbaDk
	PkEPF3UFj3Gd9ZEnhmH0jaWQs5sNtQUVV+ERWBCXz01wsevh/uU9mITCH8blPeBb
	vCLKwiYOIUA0txp5aa58=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=to:cc:subject
	:references:from:date:message-id:mime-version:content-type; q=
	dns; s=sasl; b=l5jRrmLY2v9hog39NUnVrCKlSTedLvS+yiCM134bN3+hJYTJU
	HDx6hjoVctq4b9w4IyM2jTVf0SeA2gkaheGORb5dUsZjL+m8adEAO5VOi0jnRPzp
	JCM6WWesHHbqJStMYG4Y2il1iaZ6TImzhYyFCK9f++8OAStPqOzfnHx42I=
Received: from a-pb-sasl-quonix. (unknown [127.0.0.1])
	by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 86FA2DFC2A;
	Sun, 17 Oct 2010 00:44:12 -0400 (EDT)
Received: from pobox.com (unknown [76.102.252.155]) (using TLSv1 with cipher
	DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by
	a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 90964DFC28;
	Sun, 17 Oct 2010 00:44:06 -0400 (EDT)
To: Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: [bug-diffutils] New diff option to compare file/directory
	properties
References: <4CA0801E.5040703@gmx.com> <201010111911.58351.agruen@suse.de>
	<4CB7261A.3000506@gmx.com> <201010151538.47467.agruen@suse.de>
	<4CB8DCF2.1010908@cs.ucla.edu>
From: Junio C Hamano <gitster@pobox.com>
Date: Sat, 16 Oct 2010 21:44:05 -0700
Message-ID: <7v39s55syy.fsf@alter.siamese.dyndns.org>
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Pobox-Relay-ID: 302B432A-D9A9-11DF-8FDF-030CEE7EF46B-77302942!a-pb-sasl-quonix.pobox.com
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
X-Mailman-Approved-At: Sun, 17 Oct 2010 08:09:13 -0400
Cc: bug-diffutils@gnu.org, Junio C Hamano <gitster@pobox.com>,
	Andreas Gruenbacher <agruen@suse.de>
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, 17 Oct 2010 04:53:35 -0000

Paul Eggert <eggert@cs.ucla.edu> writes:

> On 10/15/10 06:38, Andreas Gruenbacher wrote:
>> One of the key differences between quoting in gnulib and in git is that gnulib 
>> treats filenames as sequences of characters which may be multi-byte, while git 
>> treats them as sequences of bytes.
>> 
>> I'm not sure about the reasoning behind ignoring multi-byte characters; maybe 
>> Paul or Junio can enlighten us.
>
> I can't speak for Jun, but I expect the answer is, "Don't worry
> about stupid encodings".  If you use a reasonable encoding like UTF-8,
> git's quoting method works just like gnulib's does.  I don't think diffutils
> (or git) needs to worry about what happens to users who insist on using
> those awful legacy encodings.

Thanks, well and enough said ;-)


From MAILER-DAEMON Tue Oct 19 07:57:34 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P8Aow-0003w0-3s
	for mharc-bug-diffutils@gnu.org; Tue, 19 Oct 2010 07:57:34 -0400
Received: from [140.186.70.92] (port=39339 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P8Aop-0003vs-O4
	for bug-diffutils@gnu.org; Tue, 19 Oct 2010 07:57:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <duncan.moore@gmx.com>) id 1P8Aok-0003JG-GE
	for bug-diffutils@gnu.org; Tue, 19 Oct 2010 07:57:27 -0400
Received: from mailout-eu.gmx.com ([213.165.64.42]:60762)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <duncan.moore@gmx.com>) id 1P8Aoj-0003It-VC
	for bug-diffutils@gnu.org; Tue, 19 Oct 2010 07:57:22 -0400
Received: (qmail invoked by alias); 19 Oct 2010 11:57:19 -0000
Received: from cpc6-cmbg14-0-0-cust455.5-4.cable.virginmedia.com (EHLO
	[86.14.237.200]) [86.14.237.200]
	by mail.gmx.com (mp-eu003) with SMTP; 19 Oct 2010 13:57:19 +0200
X-Authenticated: #54834317
X-Provags-ID: V01U2FsdGVkX19AMfd/Ss9A0WbDxr2PFqCmbhDOKwuoFVtdoLTkKS
	wAFP0UgaCHZSJ+
Received: from 127.0.0.1 (AVG SMTP 9.0.862 [271.1.1/3205]);
	Tue, 19 Oct 2010 12:59:08 +0100
Message-ID: <4CBD880C.7070001@gmx.com>
Date: Tue, 19 Oct 2010 12:59:08 +0100
From: Duncan Moore <duncan.moore@gmx.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
	rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4
MIME-Version: 1.0
To: Andreas Gruenbacher <agruen@suse.de>
Subject: Re: [bug-diffutils] New diff option to compare file/directory
	properties
References: <4CA0801E.5040703@gmx.com> <201010111911.58351.agruen@suse.de>
	<4CB7261A.3000506@gmx.com> <201010151538.47467.agruen@suse.de>
In-Reply-To: <201010151538.47467.agruen@suse.de>
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
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: Tue, 19 Oct 2010 11:57:33 -0000


On 15/10/2010 14:38, Andreas Gruenbacher wrote:
> On Thursday 14 October 2010 17:47:38 Duncan Moore wrote:
>> On 11/10/2010 18:11, Andreas Gruenbacher wrote:
>>> I think we should extend the diff file format so that additional
>>> information can be included.  Patches should still remain backwards
>>> compatible as much as possible, though.
>> I'm not sure we can have existing implementations of 'patch' working
>> with the new 'diff --compare=...' output format, unless we have all the
>> differing properties on a single line,
> We can relatively easily put additional information before the actual diff,
> like git does.  Existing patch implementations like GNU patch which ignore
> leading information which they don't understand will continue to apply diffs
> to regular files just fine.

OK. If GNU 'patch' ignores leading information it doesn't understand, 
this makes it very much easier to attain backwards compatibility with it.

>> Of course, if the --compare=... option isn't used, then there is no
>> change to the 'diff' output, and no backwards compatibility issues.
> I think that some information like file permissions and symlinks should be
> included in patches by default.

For information like file permissions, having this by default would 
produce a lot of information that won't be of much use to most users of 
'diff'.

>> Firstly, I'll just state some of the points that the updates were
>> intended to address, taken from the 'diff' info manual:
>>
>> Section 18.1
> It is important to note that section 18.1 is about "some ideas for improving
> GNU diff and patch".  I agree with many of those ideas, but this section
> probably shouldn't be treated as if it was set in stone.

Of course not, but in this instance they seem pretty reasonable. Also, I 
wanted to make it clear what I'm trying to achieve, because I think 
you're approaching it from a different angle.

>> The aim was to carry this principal over for other file
>> properties, so that the user can selectively compare any file
>> properties, either with or without the traditional file contents
>> difference. This would be separate from it's use in creating patch
>> files, although the output format would be the same.
> I don't see the point in excluding file content differences.  What would be a
> reasonably general use case for this?

Say you've been changing file permissions in a directory and want to 
check that you've done it properly. Excluding file content differences 
from a 'diff' will show more clearly what permissions you've changed. It 
will also be quicker.

> I don't think introducing all those funny keywords is the right way to go.
> Most people will not use any of them, and GNU diff should probably still
> include most or all additional information available as long as it doesn't
> cause backwards compatibility problems.

It's sounding like you might want 'diff' to generate any property 
information that will be of use to 'patch' by default (i.e without 
introducing a new option). That will generate a lot of information that 
most of the time will be of no use to users of 'diff'. I don't think 
that's a good idea. Or do you mean just having a --compare option with 
no keywords? I had envisaged that it would usually be used like 
--compare=all or --compare=basic to select predefined sets of 
properties, with the finer tuning of properties available when it's 
required.

>> Also, git diff uses 'old' and 'new' in the output, which are concepts that
>> are not /directly/ relevant to 'diff' itself.
> How are they not directly relevant?

Because 'diff' doesn't know anything about the history of the files. For 
example, the files could be given in the order 'new' 'old'. Or the files 
may share a common ancestor, so there is no 'old' and 'new'.

>    Diff also basically compares two files;
> feel free to call them 'file1' and 'file2' or 'left' and 'right' or whatever
> instead of 'old' and 'new'.

OK, I incorrectly assumed you were after compatibility with the git diff 
format. These are better than 'old' and 'new', but 'diff' already 
identifies the files with '-' '+' in unified context style, '*' '-' in 
context style and '<' '>' in normal style, so it seems reasonable to use 
the same characters in some way to identify the new property information.

>>> Character and block special files don't make sense for me to include in a
>>> diff: they are not portable by design, and make little to no sense to
>>> apply in a different context (on a different machine or even after a
>>> driver load or removal on the same machine).
>> Some special files may not be useful for 'patch', but 'diff' is not a
>> tool for just supplying input for 'patch'. As a tool for saying what's
>> different between files, I think 'diff' should be reporting it if these
>> types of files are present.
> It does now already.

I meant that 'diff' should report their differing properties (if it's 
been asked to), not just report that the special files exist.

>    IMO it would be sufficient for GNU diff to report the
> file type and name either when a file is found only in one tree or when a file
> exists in both trees but refers to different file types or devices.  Device
> numbers should probably not end up in patches; this is not an archive format.

For default 'diff' behaviour I think that that would be reasonable, but 
not if 'diff' has been specifically asked to show property information 
for file objects.

>> [...]
>> This means that the example above would become:
>>
>>     % diff -u --compare=all aaa bbb
>>     --- aaa
>>     +++ bbb
>>     --- time: 2010-09-23 20:51:06.984375000 +0100
>>     +++ time: 2010-09-23 20:51:03.015625000 +0100
>>     --- mode: rw-r--r--
>>     +++ mode: rwxr--r--
>>     @@ -1 +1 @@
>>     -111
>>     +222
> No way: overloading the meaning of the "---" and "+++" headers would
> completely break every existing implementation of patch.

How about:

    % diff -u --compare=all aaa bbb
    --- aaa
    +++ bbb
    -- time: 2010-09-23 20:51:06.984375000 +0100
    ++ time: 2010-09-23 20:51:03.015625000 +0100
    -- mode: -rw-r--r--
    ++ mode: -rwxr--r--
    @@ -1 +1 @@
    -111
    +222


>> Non-existent files would give this sort of output:
>> [...]
> Please have a look how GNU diff uses Epoch timestamps and how cvs / svn / git
> use /dev/null for creates and deletes.

Using an epoch timestamp to mark a non-existent file is something I 
wanted to avoid. Giving a dummy timestamp to a these files would be 
inconsistent with other file properties which wouldn't be given dummy 
values; and what happens if timestamp isn't one of the properties output?
Using "+++ /dev/null" to identify non-existent files is better than 
using timestamps. I think "+++ <filename> non-existent", is more 
explicit, but if dev/null has traditionally been used in 'patch', then 
this may be preferable.

>> Symbolic links are normally dereferenced and treated like regular files,
>> but a --no-dereference option could be used to treat symbolic links like
>> the other special files:
> I believe this is a mistake;

Can you clarify what you believe the mistake is - the way GNU diff 
treats symbolic links, the proposed --no-dereference option, or both?

>   the way how GNU diff currently treats symlinks
> (as regular files) is likely to lead to undesired results.  At the very least,
> GNU diff should print a warning.
>
> Symlinks never have any "file content" so the file the symlink points to could
> be treated as the "file content".

I'm not quite clear what you're suggesting here for the --compare=... 
option. When used with a --no-dereference option, that it should use the 
contents of the file pointed to? That seems to be mixing dereferenced 
and non-dereferenced information to me. I think that the symlink should 
either be dereferenced or not, and any file properties used 
consistently. If the user is only concerned with the symlink itself and 
selects --no-dereference in 'diff', then the contents of the file 
pointed to are of no relevance to 'patch'.

Thanks


From MAILER-DAEMON Wed Oct 20 16:41:58 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1P8fTy-0008WA-5b
	for mharc-bug-diffutils@gnu.org; Wed, 20 Oct 2010 16:41:58 -0400
Received: from [140.186.70.92] (port=48595 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1P8fTv-0008Vx-V7
	for bug-diffutils@gnu.org; Wed, 20 Oct 2010 16:41:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <agruen@suse.de>) id 1P8fTu-0003NG-Rk
	for bug-diffutils@gnu.org; Wed, 20 Oct 2010 16:41:55 -0400
Received: from cantor2.suse.de ([195.135.220.15]:57248 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <agruen@suse.de>)
	id 1P8fTu-0003M3-Mi; Wed, 20 Oct 2010 16:41:54 -0400
Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2])
	by mx2.suse.de (Postfix) with ESMTP id F14EB8765C;
	Wed, 20 Oct 2010 22:41:49 +0200 (CEST)
From: Andreas Gruenbacher <agruen@suse.de>
Organization: SUSE Labs, Novell Inc.
To: bug-patch@gnu.org
Subject: Re: [bug-diffutils] Does patch ignore Linux ACLs?
Date: Wed, 20 Oct 2010 22:41:20 +0200
User-Agent: KMail/1.13.5 (Linux/2.6.34.7-0.3-desktop; KDE/4.4.4; x86_64; ; )
References: <4CB8678B.5080003@thomaskeller.biz> <4CB8E377.8090309@cs.ucla.edu>
	<4CB8E57E.6070109@thomaskeller.biz>
In-Reply-To: <4CB8E57E.6070109@thomaskeller.biz>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Message-Id: <201010202241.20636.agruen@suse.de>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
Cc: bug-diffutils@gnu.org, Thomas Keller <me@thomaskeller.biz>
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, 20 Oct 2010 20:41:57 -0000

On Saturday 16 October 2010 01:36:30 Thomas Keller wrote:
> Am 16.10.10 01:27, schrieb Paul Eggert:
> > On 10/15/10 16:11, Thomas Keller wrote:
> >> And suddenly the test file lost its ACL - do'h!

It is easy to see what happens and why the default ACL is "lost" with strace: 
patch creates a temporary file /tmp/poXXXXXX with the new file contents and 
renames it over the original file.

The latest alpha snapshot at ftp://alpha.gnu.org/gnu/patch/ includes some 
temporary file handling changes/fixes.  Temporary output files are now created 
in the final directory of the file, and so default ACLs will not "disappear" 
anymore.

This behavior is still wrong when patch modifies an existing file though: ACLs 
and other extended attributes of the original file should be preserved.  There 
is a FIXME comment in src/util.c:set_file_attributes() about this, but I 
didn't get to it, yet.

> > The file didn't lose its ACL.  What happens is that a copy was
> > created, and then renamed over the original. At one point chmod is
> > applied to the copy, so that it has the right permissions.  That's
> > what removes the default ACL.
> 
> Actually chmod(1) should not remove the ACL (and not even the default
> ACL, because this only exists on the directory), but maybe the problem
> is that the default directory ACL is not (automatically) applied to the
> newly created copy?

Chmod never removes POSIX ACLs (but it may mask some of the permissions 
granted by the ACL).

Files always inherit the default ACL of the directory they are in if the 
directory has one.

Thanks,
Andreas


From MAILER-DAEMON Tue Oct 26 04:45:51 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PAfAE-0002IN-R7
	for mharc-bug-diffutils@gnu.org; Tue, 26 Oct 2010 04:45:50 -0400
Received: from [140.186.70.92] (port=37614 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PAfA9-0002DL-V6
	for bug-diffutils@gnu.org; Tue, 26 Oct 2010 04:45:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <khali@linux-fr.org>) id 1PAfA0-000625-Kr
	for bug-diffutils@gnu.org; Tue, 26 Oct 2010 04:45:37 -0400
Received: from zone0.gcu-squad.org ([212.85.147.21]:5674
	helo=services.gcu-squad.org) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <khali@linux-fr.org>) id 1PAfA0-000605-Gj
	for bug-diffutils@gnu.org; Tue, 26 Oct 2010 04:45:36 -0400
Received: from jdelvare.pck.nerim.net ([62.212.121.182] helo=endymion.delvare)
	by services.gcu-squad.org (GCU Mailer Daemon) with esmtpsa id
	1PAfFl-000421-Cy (TLSv1:AES128-SHA:128)
	(envelope-from <khali@linux-fr.org>)
	; Tue, 26 Oct 2010 10:51:33 +0200
Date: Tue, 26 Oct 2010 10:45:21 +0200
From: Jean Delvare <khali@linux-fr.org>
To: Andreas Gruenbacher <agruen@suse.de>
Subject: Re: [bug-diffutils] [BUG] Incorrect diff output (diff -d is correct)
Message-ID: <20101026104521.4dec2a82@endymion.delvare>
In-Reply-To: <201010061533.57185.agruen@suse.de>
References: <20100929184529.470cffd3@endymion.delvare>
	<4CA4C081.4010109@cs.ucla.edu>
	<20101001165532.716ffc41@endymion.delvare>
	<201010061533.57185.agruen@suse.de>
X-Mailer: Claws Mail 3.7.5 (GTK+ 2.20.1; x86_64-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.0-3.9
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: Tue, 26 Oct 2010 08:45:49 -0000

On Wed, 6 Oct 2010 15:33:56 +0200, Andreas Gruenbacher wrote:
> On Friday 01 October 2010 16:55:32 Jean Delvare wrote:
> > Instead, my feeling is that, after shift_boundaries's work, an extra cleanup
> > step could be taken to simplify the output.
> 
> The reason for the suboptimal result here is that the diffing algorithm is 
> giving up unless find_minimal is true (it hits last return statement in diag() 
> in diffseq.h).  It whouldn't be hard to check for this particular pattern 
> after shift_boundaries(), but that pattern can only occur if the algorithm has 
> given up, and I don't think optimizing this case is worth the cost.

Oh well. You know the code better than I do, and I do not have more
time to spend on this. If it is accepted that diff may produce such a
bad-looking output by default, I'll make sure to always use option -d
from now on.

-- 
Jean Delvare


From MAILER-DAEMON Tue Oct 26 21:04:54 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1PAuRi-0001sx-AP
	for mharc-bug-diffutils@gnu.org; Tue, 26 Oct 2010 21:04:54 -0400
Received: from [140.186.70.92] (port=38795 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PAuRf-0001rt-TS
	for bug-diffutils@gnu.org; Tue, 26 Oct 2010 21:04:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <agruen@suse.de>) id 1PAuRe-00059F-QX
	for bug-diffutils@gnu.org; Tue, 26 Oct 2010 21:04:51 -0400
Received: from cantor2.suse.de ([195.135.220.15]:59762 helo=mx2.suse.de)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <agruen@suse.de>)
	id 1PAuRe-000591-LO; Tue, 26 Oct 2010 21:04:50 -0400
Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2])
	by mx2.suse.de (Postfix) with ESMTP id DE4AE8730A;
	Wed, 27 Oct 2010 03:04:45 +0200 (CEST)
From: Andreas Gruenbacher <agruen@suse.de>
Organization: SUSE Labs, Novell Inc.
To: bug-patch@gnu.org
Subject: Re: [bug-patch] Re: [bug-diffutils] Does patch ignore Linux ACLs?
Date: Wed, 27 Oct 2010 03:04:12 +0200
User-Agent: KMail/1.13.5 (Linux/2.6.34.7-0.3-desktop; KDE/4.4.4; x86_64; ; )
References: <4CB8678B.5080003@thomaskeller.biz>
	<4CB8E57E.6070109@thomaskeller.biz>
	<201010202241.20636.agruen@suse.de>
In-Reply-To: <201010202241.20636.agruen@suse.de>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Message-Id: <201010270304.12749.agruen@suse.de>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
Cc: bug-diffutils@gnu.org, Thomas Keller <me@thomaskeller.biz>
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, 27 Oct 2010 01:04:52 -0000

On Wednesday 20 October 2010 22:41:20 Andreas Gruenbacher wrote:
> ACLs and other extended attributes of the original file should be preserved.
> There is a FIXME comment in src/util.c:set_file_attributes() about this, but
> I didn't get to it, yet.

This should now also work at least on Linux; see the the latest alpha version
(patch-2.6.1.106-76d0.tar.gz).  Right now, patch will fail if it can't
preserve all extended attributes; I'm not sure if this is the expected
behavior in all cases.

User / distro feedback would be very welcome!

Thanks,
Andreas


