From MAILER-DAEMON Fri Feb 06 17:52:41 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YJrlR-0004Zj-7Z
	for mharc-bug-diffutils@gnu.org; Fri, 06 Feb 2015 17:52:41 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54880)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YJmSn-0001nG-AU
	for bug-diffutils@gnu.org; Fri, 06 Feb 2015 12:13:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YJmSk-0005RY-CH
	for bug-diffutils@gnu.org; Fri, 06 Feb 2015 12:13:05 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:44588)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YJmSk-0005RU-AD
	for bug-diffutils@gnu.org; Fri, 06 Feb 2015 12:13:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YJmSk-0004kz-1M
	for bug-diffutils@gnu.org; Fri, 06 Feb 2015 12:13:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady <P@draigBrady.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Fri, 06 Feb 2015 17:13:01 +0000
Resent-Message-ID: <handler.19794.B.142324275318242@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: report 19794
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: Eric Blake <eblake@redhat.com>, Tyler Beaver <tyler9725@gmail.com>
X-Debbugs-Original-Cc: bug-diffutils@gnu.org, coreutils@gnu.org
Received: via spool by submit@debbugs.gnu.org id=B.142324275318242
	(code B ref -1); Fri, 06 Feb 2015 17:13:01 +0000
Received: (at submit) by debbugs.gnu.org; 6 Feb 2015 17:12:33 +0000
Received: from localhost ([127.0.0.1]:35828 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YJmSH-0004k8-4u
	for submit@debbugs.gnu.org; Fri, 06 Feb 2015 12:12:33 -0500
Received: from eggs.gnu.org ([208.118.235.92]:52936)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <P@draigbrady.com>) id 1YJmSF-0004jt-0G
	for submit@debbugs.gnu.org; Fri, 06 Feb 2015 12:12:31 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigbrady.com>) id 1YJmS2-0005Ea-Ei
	for submit@debbugs.gnu.org; Fri, 06 Feb 2015 12:12:25 -0500
Received: from lists.gnu.org ([2001:4830:134:3::11]:34922)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigbrady.com>) id 1YJmS2-0005EU-CW
	for submit@debbugs.gnu.org; Fri, 06 Feb 2015 12:12:18 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54584)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigbrady.com>) id 1YJmS1-0000IJ-EW
	for bug-diffutils@gnu.org; Fri, 06 Feb 2015 12:12:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigbrady.com>) id 1YJmRx-0005Bw-BA
	for bug-diffutils@gnu.org; Fri, 06 Feb 2015 12:12:16 -0500
Received: from mail5.vodafone.ie ([213.233.128.176]:53236)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigbrady.com>)
	id 1YJmRw-00055M-W1; Fri, 06 Feb 2015 12:12:13 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AkkFAHX11FRtTrRZ/2dsb2JhbABagwWELcMDgk8CgRlDAQEBAQF9hA0BBSMPAUYQCw0BCgICBRYLAgIJAwIBAgFFBgEMAQcBAYgtAb9ihWmQLAEBAQcBAQEBAR2BIY5XB4JogUEBBJ8bg3GIJiKBfwMcgVA+gnMBAQE
Received: from unknown (HELO localhost.localdomain) ([109.78.180.89])
	by mail3.vodafone.ie with ESMTP; 06 Feb 2015 17:12:10 +0000
Message-ID: <54D4F5E9.3040909@draigBrady.com>
Date: Fri, 06 Feb 2015 17:12:09 +0000
From: =?UTF-8?Q?P=C3=A1draig?= Brady <P@draigBrady.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
References: <CA+Xn=xoTTJ6bX+RTJfc9dLW1CZ2=sHreDwKZmXxOaT2e3viQKA@mail.gmail.com>
	<54D4EA6C.40204@draigBrady.com> <54D4EF96.2010703@redhat.com>
	<54D4F4D5.5020004@redhat.com>
In-Reply-To: <54D4F4D5.5020004@redhat.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
X-Mailman-Approved-At: Fri, 06 Feb 2015 17:52:39 -0500
Cc: 19794@debbugs.gnu.org, coreutils@gnu.org
Subject: [bug-diffutils] bug#19794: Feature Request - CMP
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2015 17:13:09 -0000

On 06/02/15 17:07, Eric Blake wrote:
> On 02/06/2015 09:45 AM, Eric Blake wrote:
>> On 02/06/2015 09:23 AM, Pádraig Brady wrote:
>>> On 06/02/15 15:57, Tyler Beaver wrote:
>>>> I know this tool is probably note used as much anymore, but perhaps it would be worth adding a flag for overriding the verbose output number system for the values, or at any rate specifying that this output is in octal, and not decimal or hexadecimal.
>>>
>>> Currently: offsets are decimal, differing bytes are octal:
>>>
>>>   $ cmp -l <(echo 12345678abc) <(echo 12345678bbb)
>>>                     9 141 142
>>>                    11 143 142
> 
> Another observation: Note that when mixed with --ignore-initial, we
> behave as if offsets start from the point where we skipped to, rather
> than the beginning of the file.  Since -i is not required by POSIX, does
> this always make the most sense?
> 
> $ cmp -l     <(printf bbc) <(printf abd)
>                   1 142 141
>                   3 143 144
> $ cmp -l -i1 <(printf bbc) <(printf abd)
>                   2 143 144
> 
> and what happens when we use the two-offset form?
> 
> $ cmp -l -i2:1 <(printf abcd) <(printf bce)
>                   2 144 145
> $ cmp -l -i1:2 <(printf bce) <(printf abcd)
>                   2 145 144
> 
> 
>> That said, it might be worth patching 'cmp --help' to make it obvious
>> that differing bytes are in octal values.
> 
> That is, instead of
> 
>   -l, --verbose              output byte numbers and differing byte values
> 
> maybe we could use:
> 
>   -l, --verbose              for each difference, output the decimal
>                              offset and the differing octal values
> 
> Expanding that to two lines can be offset by compressing elsewhere:
> 
>   -i, --ignore-initial=SKIP         skip first SKIP bytes of both inputs
>   -i, --ignore-initial=SKIP1:SKIP2  skip first SKIP1 bytes of FILE1 and
>                                       first SKIP2 bytes of FILE2
> 
> feels long; how about:
> 
>   -i, --ignore-initial=SKIP[:SKIP2]  bypass SKIP bytes of FILE1, and
>                                      SKIP2 (default SKIP) bytes of FILE2

Good suggestions,
which I've CC'd the the appropriate list ;)

cheers,
Pádraig.




From MAILER-DAEMON Mon Feb 09 21:25:10 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YL0Vi-0005PA-6c
	for mharc-bug-diffutils@gnu.org; Mon, 09 Feb 2015 21:25:10 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50582)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YL0Vf-0005KB-4D
	for bug-diffutils@gnu.org; Mon, 09 Feb 2015 21:25:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YL0Va-0005Sz-PQ
	for bug-diffutils@gnu.org; Mon, 09 Feb 2015 21:25:07 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:47484)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YL0Va-0005Su-Eh
	for bug-diffutils@gnu.org; Mon, 09 Feb 2015 21:25:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YL0Va-0007NK-1v
	for bug-diffutils@gnu.org; Mon, 09 Feb 2015 21:25:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Vincent Lefevre <vincent@vinc17.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Tue, 10 Feb 2015 02:25:01 +0000
Resent-Message-ID: <handler.19825.B.142353505028259@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: report 19825
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: 19825@debbugs.gnu.org
X-Debbugs-Original-To: bug-diffutils@gnu.org
Received: via spool by submit@debbugs.gnu.org id=B.142353505028259
	(code B ref -1); Tue, 10 Feb 2015 02:25:01 +0000
Received: (at submit) by debbugs.gnu.org; 10 Feb 2015 02:24:10 +0000
Received: from localhost ([127.0.0.1]:38722 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YL0Uj-0007Lh-Qe
	for submit@debbugs.gnu.org; Mon, 09 Feb 2015 21:24:10 -0500
Received: from eggs.gnu.org ([208.118.235.92]:48706)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <vincent@vinc17.net>) id 1YL0Ui-0007LS-Ch
	for submit@debbugs.gnu.org; Mon, 09 Feb 2015 21:24:09 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vincent@vinc17.net>) id 1YL0Uc-0005Bz-6Z
	for submit@debbugs.gnu.org; Mon, 09 Feb 2015 21:24:03 -0500
Received: from lists.gnu.org ([2001:4830:134:3::11]:42421)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vincent@vinc17.net>) id 1YL0Uc-0005Bv-4c
	for submit@debbugs.gnu.org; Mon, 09 Feb 2015 21:24:02 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50423)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vincent@vinc17.net>) id 1YL0Ub-00056l-84
	for bug-diffutils@gnu.org; Mon, 09 Feb 2015 21:24:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vincent@vinc17.net>) id 1YL0UX-0005BY-8X
	for bug-diffutils@gnu.org; Mon, 09 Feb 2015 21:24:01 -0500
Received: from ioooi.vinc17.net ([92.243.22.117]:53301)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vincent@vinc17.net>) id 1YL0UX-0005Ag-2M
	for bug-diffutils@gnu.org; Mon, 09 Feb 2015 21:23:57 -0500
Received: from smtp-xvii.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128])
	by ioooi.vinc17.net (Postfix) with ESMTPSA id BC16E32A;
	Tue, 10 Feb 2015 03:23:48 +0100 (CET)
Received: by xvii.vinc17.org (Postfix, from userid 1000)
	id 7C92921A079; Tue, 10 Feb 2015 03:23:48 +0100 (CET)
Date: Tue, 10 Feb 2015 03:23:48 +0100
From: Vincent Lefevre <vincent@vinc17.net>
Message-ID: <20150210022348.GA19044@xvii.vinc17.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
X-Mailer-Info: http://www.vinc17.net/mutt/
User-Agent: Mutt/1.5.23-6416-vl-r76280 (2015-02-04)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#19825: unified output format,
	number of consecutive unaffected lines, and POSIX
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Feb 2015 02:25:08 -0000

Concerning the unified output format, POSIX says in

  http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html

  "If -U n is specified, the output shall contain no more than
  n consecutive unaffected lines; and if the output contains an
  affected line and this line is adjacent to up to n consecutive
  unaffected lines in the corresponding file, the output shall
  contain these unaffected lines. -u shall act like -U3."

but with GNU diff and n =3D 3, one can get up to 6 consecutive
unaffected lines:

@@ -1,14 +1,14 @@
 1
 2
 3
-4
+4b
 5
 6
 7
 8
 9
 10
-11
+11b
 12
 13
 14

I actually think that the GNU diff behavior is better than POSIX.
And it is quite strange that POSIX specifies something different
because this format comes from GNU diff!

I think that the GNU diff manual should say something about this
difference. Or could this be regarded as a defect in POSIX?

Note: I noticed this after seeing that Subversion's internal diff
behaves again differently, with a behavior between GNU diff and
POSIX: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D777479#17

--=20
Vincent Lef=E8vre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




From MAILER-DAEMON Tue Feb 10 01:50:18 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YL4eI-0004s7-9S
	for mharc-bug-diffutils@gnu.org; Tue, 10 Feb 2015 01:50:18 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53613)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YL4eF-0004kp-SG
	for bug-diffutils@gnu.org; Tue, 10 Feb 2015 01:50:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YL4e3-0007Gk-Fc
	for bug-diffutils@gnu.org; Tue, 10 Feb 2015 01:50:11 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:47564)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YL4e3-0007GQ-Cx
	for bug-diffutils@gnu.org; Tue, 10 Feb 2015 01:50:03 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YL4e2-0006oU-KO
	for bug-diffutils@gnu.org; Tue, 10 Feb 2015 01:50:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Paul Eggert <eggert@cs.ucla.edu>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Tue, 10 Feb 2015 06:50:02 +0000
Resent-Message-ID: <handler.19825.B19825.142355098426161@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 19825
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: Vincent Lefevre <vincent@vinc17.net>, 19825@debbugs.gnu.org
Received: via spool by 19825-submit@debbugs.gnu.org id=B19825.142355098426161
	(code B ref 19825); Tue, 10 Feb 2015 06:50:02 +0000
Received: (at 19825) by debbugs.gnu.org; 10 Feb 2015 06:49:44 +0000
Received: from localhost ([127.0.0.1]:38804 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YL4dk-0006nt-FB
	for submit@debbugs.gnu.org; Tue, 10 Feb 2015 01:49:44 -0500
Received: from smtp.cs.ucla.edu ([131.179.128.62]:39482)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <eggert@cs.ucla.edu>) id 1YL4di-0006nZ-Hg
	for 19825@debbugs.gnu.org; Tue, 10 Feb 2015 01:49:43 -0500
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 858D6A6005E;
	Mon,  9 Feb 2015 22:49:36 -0800 (PST)
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 77AAL9yegxpM; Mon,  9 Feb 2015 22:49:36 -0800 (PST)
Received: from [192.168.1.9] (pool-173-55-11-52.lsanca.fios.verizon.net
	[173.55.11.52])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2D453A6005C;
	Mon,  9 Feb 2015 22:49:36 -0800 (PST)
Message-ID: <54D9A9FF.7030202@cs.ucla.edu>
Date: Mon, 09 Feb 2015 22:49:35 -0800
From: Paul Eggert <eggert@cs.ucla.edu>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
References: <20150210022348.GA19044@xvii.vinc17.org>
In-Reply-To: <20150210022348.GA19044@xvii.vinc17.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#19825:  bug#19825: unified output format,
	number of consecutive unaffected lines, and POSIX
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Feb 2015 06:50:17 -0000

Vincent Lefevre wrote:
> Or could this be regarded as a defect in POSIX?

That's what I'd say, yes.  POSIX was intended to codify GNU diff's behavior 
here, and it seems to have missed the corner case you describe.




From MAILER-DAEMON Wed Feb 11 13:05:18 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YLbf4-00062v-JA
	for mharc-bug-diffutils@gnu.org; Wed, 11 Feb 2015 13:05:18 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37592)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLaVF-0003Mz-Rx
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 11:51:12 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLaVC-0003wE-JE
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 11:51:05 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:49058)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLaVC-0003vv-G1
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 11:51:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLaVB-00025y-Sv
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 11:51:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Dave Gordon <david.s.gordon@intel.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Wed, 11 Feb 2015 16:51:01 +0000
Resent-Message-ID: <handler.19835.B.14236734087968@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: report 19835
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: 
To: 19835@debbugs.gnu.org
X-Debbugs-Original-To: bug-diffutils@gnu.org
Received: via spool by submit@debbugs.gnu.org id=B.14236734087968
	(code B ref -1); Wed, 11 Feb 2015 16:51:01 +0000
Received: (at submit) by debbugs.gnu.org; 11 Feb 2015 16:50:08 +0000
Received: from localhost ([127.0.0.1]:40294 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YLaUI-00024P-Je
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 11:50:08 -0500
Received: from eggs.gnu.org ([208.118.235.92]:57927)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <david.s.gordon@intel.com>) id 1YLYME-00075g-9r
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 09:33:40 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <david.s.gordon@intel.com>) id 1YLYM7-0002YZ-Jx
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 09:33:33 -0500
Received: from lists.gnu.org ([2001:4830:134:3::11]:36182)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <david.s.gordon@intel.com>) id 1YLYM7-0002YH-0l
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 09:33:31 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59644)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <david.s.gordon@intel.com>) id 1YLYM5-0002OK-KT
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 09:33:30 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <david.s.gordon@intel.com>) id 1YLYM2-0002XL-DB
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 09:33:29 -0500
Received: from mga11.intel.com ([192.55.52.93]:40945)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <david.s.gordon@intel.com>) id 1YLYM2-0002Wu-69
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 09:33:26 -0500
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
	by fmsmga102.fm.intel.com with ESMTP; 11 Feb 2015 06:33:22 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.09,558,1418112000"; d="scan'208";a="453142417"
Received: from dsgordon-linux.isw.intel.com (HELO [10.102.226.149])
	([10.102.226.149])
	by FMSMGA003.fm.intel.com with ESMTP; 11 Feb 2015 06:18:44 -0800
Message-ID: <54DB6831.7090307@intel.com>
Date: Wed, 11 Feb 2015 14:33:21 +0000
From: Dave Gordon <david.s.gordon@intel.com>
Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way,
	Swindon SN3 1RJ
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-Mailman-Approved-At: Wed, 11 Feb 2015 11:50:05 -0500
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
X-Mailman-Approved-At: Wed, 11 Feb 2015 13:05:17 -0500
Subject: [bug-diffutils] bug#19835: RFC: diff: skip initial columns before
	comparing
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Feb 2015 16:51:12 -0000

When comparing certain types of files, notably timestamped logfiles
such as the output of dmesg(1), it's necessary to ignore the initial
characters on each line, otherwise every line is different. In the
simplest case, this can be done by applying 'cut(1)' to each input;
but then, important information about when the difference(s) occurred is
lost, and it can be difficult to find the relevant lines in the original
files, especially if they are highly repetitive (as logfiles often are).
When is needed in this situation is to ignore the timestamps for
purposes of comparison, but then include them in any lines copied to
the output.

So this patch adds a new option (long form only) "--ignore-initial=N" to
ignore the first N characters of each line. This is done by skipping the
first N characters of each line in find_and_hash_each_line(), and
likewise lines_differ(). The hashing or comparison of the remaining part
of the line then proceeds as usual.

One subtle point: if both of the lines have less than N characters, the
lines are considered equal iff they have the same length. Usually, the
type of file you would use this option with will have a fixed-format
prefix (which is the part to be ignored), and a line missing this prefix
is generally an indication of a formatting error. So a line with the
prefix but no further content should NOT match an empty line or a line
with a truncated prefix; but we still want two empty lines to match each
other.

For example, with --ignore-initial=10:

These lines match:
[22:47:25] hello
[23:17:24] hello

These lines don't match:
[22:47:25] hello
[23:17:24]

Nor do these:
[22:47:]
[23:17:24]

But these do:
[NOCLOCK]
[CLKFAIL]

Hope this looks useful!
.Dave.

-----------------------
diff --git a/src/diff.c b/src/diff.c
index 50d0365..eccce21 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -121,6 +121,7 @@ enum
   NO_IGNORE_FILE_NAME_CASE_OPTION,
   NORMAL_OPTION,
   SDIFF_MERGE_ASSIST_OPTION,
+  SKIP_INITIAL_OPTION,
   STRIP_TRAILING_CR_OPTION,
   SUPPRESS_BLANK_EMPTY_OPTION,
   SUPPRESS_COMMON_LINES_OPTION,
@@ -173,6 +174,7 @@ static struct option const longopts[] =
   {"ignore-blank-lines", 0, 0, 'B'},
   {"ignore-case", 0, 0, 'i'},
   {"ignore-file-name-case", 0, 0, IGNORE_FILE_NAME_CASE_OPTION},
+  {"ignore-initial", 1, 0, SKIP_INITIAL_OPTION},
   {"ignore-matching-lines", 1, 0, 'I'},
   {"ignore-space-change", 0, 0, 'b'},
   {"ignore-tab-expansion", 0, 0, 'E'},
@@ -580,6 +582,18 @@ main (int argc, char **argv)
          sdiff_merge_assist = true;
          break;

+       case SKIP_INITIAL_OPTION:
+         numval = strtoumax (optarg, &numend, 10);
+         if (! (0 < numval && numval <= SIZE_MAX) || *numend)
+           try_help ("invalid initial skip '%s'", optarg);
+         if (initial_skip != numval)
+           {
+             if (initial_skip)
+               fatal ("conflicting initial skip options");
+             initial_skip = numval;
+           }
+         break;
+
        case STRIP_TRAILING_CR_OPTION:
          strip_trailing_cr = true;
          break;
@@ -724,7 +738,8 @@ main (int argc, char **argv)
   files_can_be_treated_as_binary =
     (brief & binary
      & ~ (ignore_blank_lines | ignore_case | strip_trailing_cr
-         | (ignore_regexp_list.regexps || ignore_white_space)));
+         | (ignore_regexp_list.regexps || ignore_white_space
+                 || initial_skip)));

   switch_string = option_list (argv + 1, optind - 1);

@@ -895,6 +910,7 @@ static char const * const option_help_msgid[] = {
   N_("-w, --ignore-all-space          ignore all white space"),
   N_("-B, --ignore-blank-lines        ignore changes where lines are
all blank"),
   N_("-I, --ignore-matching-lines=RE  ignore changes where all lines
match RE"),
+  N_("    --ignore-initial=SKIP       ignore the initial SKIP
characters of each line"),
   "",
   N_("-a, --text                      treat all files as text"),
   N_("    --strip-trailing-cr         strip trailing carriage return on
input"),
diff --git a/src/diff.h b/src/diff.h
index e9f0471..b638a3f 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -125,6 +125,9 @@ XTERN enum DIFF_white_space ignore_white_space;
 /* Ignore changes that affect only blank lines (-B).  */

+/* Skip this many initial characters on each line */
+XTERN size_t initial_skip;
+
 /* Files can be compared byte-by-byte, as if they were binary.
    This depends on various options.  */
 XTERN bool files_can_be_treated_as_binary;
diff --git a/src/io.c b/src/io.c
index 463ee35..7e15996 100644
--- a/src/io.c
+++ b/src/io.c
@@ -232,13 +232,18 @@ find_and_hash_each_line (struct file_data *current)
   bool diff_length_compare_anyway =
     ig_white_space != IGNORE_NO_WHITE_SPACE;
   bool same_length_diff_contents_compare_anyway =
-    diff_length_compare_anyway | ig_case;
+    diff_length_compare_anyway | ig_case || initial_skip != 0;

   while (p < suffix_begin)
     {
       char const *ip = p;
       hash_value h = 0;
       unsigned char c;
+      size_t skip = initial_skip;
+
+      while (skip--)
+       if ((c = *p++) == '\n')
+         goto hashing_done;

       /* Hash this line until we find a newline.  */
       switch (ig_white_space)
diff --git a/src/util.c b/src/util.c
index 016057d..0acba06 100644
--- a/src/util.c
+++ b/src/util.c
@@ -413,6 +413,16 @@ lines_differ (char const *s1, char const *s2)
   register char const *t1 = s1;
   register char const *t2 = s2;
   size_t column = 0;
+  size_t skip = initial_skip;
+
+  while (skip--)
+    {
+      register unsigned char c1 = *t1++;
+      register unsigned char c2 = *t2++;
+
+      if (c1 == '\n' || c2 == '\n')
+       return c1 != c2;
+    }

   while (1)
     {





From MAILER-DAEMON Wed Feb 11 18:30:12 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YLgjT-0006Am-VP
	for mharc-bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:30:11 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55301)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgjS-00069U-2k
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:30:10 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgjM-0005lj-Sc
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:30:10 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:49134)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgjM-0005l6-Q1
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:30:04 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgjL-0004tq-Vh
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:30:04 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Wed, 11 Feb 2015 23:30:03 +0000
Resent-Message-ID: <handler.19509.B19509.142369735818757@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 19509
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: patch
To: 19509@debbugs.gnu.org
Received: via spool by 19509-submit@debbugs.gnu.org id=B19509.142369735818757
	(code B ref 19509); Wed, 11 Feb 2015 23:30:03 +0000
Received: (at 19509) by debbugs.gnu.org; 11 Feb 2015 23:29:18 +0000
Received: from localhost ([127.0.0.1]:40374 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YLgib-0004sT-Oo
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 18:29:18 -0500
Received: from kolbaba.stable.cz ([88.86.120.103]:36596)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <ondrej@svobodasoft.cz>) id 1YLgiZ-0004sF-CI
	for 19509@debbugs.gnu.org; Wed, 11 Feb 2015 18:29:16 -0500
Received: from localhost (kolbaba.miton.cz [127.0.0.1])
	by kolbaba.stable.cz (Postfix) with ESMTP id 3861621AB0
	for <19509@debbugs.gnu.org>; Thu, 12 Feb 2015 00:29:09 +0100 (CET)
X-Virus-Scanned: amavisd-new at kolbaba.stable.cz
Received: from kolbaba.stable.cz ([127.0.0.1])
	by localhost (kolbaba.stable.cz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id FpD-oflirO2I for <19509@debbugs.gnu.org>;
	Thu, 12 Feb 2015 00:29:05 +0100 (CET)
Received: from [10.0.0.8] (38.211.broadband18.iol.cz [109.81.211.38])
	by kolbaba.stable.cz (Postfix) with ESMTPSA id 96BB121AF0;
	Thu, 12 Feb 2015 00:29:04 +0100 (CET)
Message-ID: <54DBE5BF.3010009@svobodasoft.cz>
Date: Thu, 12 Feb 2015 00:29:03 +0100
From: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
References: <54A9AB0D.1090900@svobodasoft.cz>
In-Reply-To: <54A9AB0D.1090900@svobodasoft.cz>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#19509: bug#19509: [PATCH] diff: treat fifos as
	identical
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Feb 2015 23:30:10 -0000

Hello Paul,

may I ask you to review this little patch (and its successor that I will 
be also bumping shortly)?

Thank you! :-)

Regards,
Ondra Svoboda

On 4.1.2015 22:05, Ondřej Svoboda wrote:
> (Continuation of the previous patch; may I ask the good people of the 
> list to review both?)
>
> This avoids unwanted "differences" like
>
>   File dev1/fifo1 is a fifo while file dev2/fifo1 is a fifo
> ---
>  src/diff.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/diff.c b/src/diff.c
> index a3e1b6f..cf2c62a 100644
> --- a/src/diff.c
> +++ b/src/diff.c
> @@ -1299,6 +1299,11 @@ compare_files (struct comparison const *parent,
>            status = EXIT_FAILURE;
>          }
>      }
> +      else if (S_ISFIFO (cmp.file[0].stat.st_mode)
> +               && S_ISFIFO (cmp.file[0].stat.st_mode))
> +    {
> +      /* Both are fifos.  */
> +    }
>        else
>      {
>        /* We have two files that are not to be compared.  */





From MAILER-DAEMON Wed Feb 11 18:32:08 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YLglM-0006Gq-8i
	for mharc-bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:32:08 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55432)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLglJ-0006F8-Q2
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:32:06 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLglG-0006XJ-Jq
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:32:05 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:49138)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLglG-0006XD-HP
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:32:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLglG-0004xj-Bx
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:32:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Paul Eggert <eggert@cs.ucla.edu>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Wed, 11 Feb 2015 23:32:02 +0000
Resent-Message-ID: <handler.19509.B19509.142369746319005@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 19509
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>,
	19509@debbugs.gnu.org
Received: via spool by 19509-submit@debbugs.gnu.org id=B19509.142369746319005
	(code B ref 19509); Wed, 11 Feb 2015 23:32:02 +0000
Received: (at 19509) by debbugs.gnu.org; 11 Feb 2015 23:31:03 +0000
Received: from localhost ([127.0.0.1]:40378 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YLgkJ-0004wT-8r
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 18:31:03 -0500
Received: from smtp.cs.ucla.edu ([131.179.128.62]:58104)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <eggert@cs.ucla.edu>) id 1YLgkG-0004vy-Sq
	for 19509@debbugs.gnu.org; Wed, 11 Feb 2015 18:31:01 -0500
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id 4D065A600E3;
	Wed, 11 Feb 2015 15:30:54 -0800 (PST)
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 oeOeK+QtWpXd; Wed, 11 Feb 2015 15:30:54 -0800 (PST)
Received: from [192.168.1.9] (pool-173-55-11-52.lsanca.fios.verizon.net
	[173.55.11.52])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 00FE9A600DD;
	Wed, 11 Feb 2015 15:30:53 -0800 (PST)
Message-ID: <54DBE629.1060302@cs.ucla.edu>
Date: Wed, 11 Feb 2015 15:30:49 -0800
From: Paul Eggert <eggert@cs.ucla.edu>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
References: <54A9AB0D.1090900@svobodasoft.cz> <54DBE5BF.3010009@svobodasoft.cz>
In-Reply-To: <54DBE5BF.3010009@svobodasoft.cz>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#19509: bug#19509: [PATCH] diff: treat fifos as
	identical
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Feb 2015 23:32:06 -0000

Ondřej Svoboda wrote:
>       }
> +      else if (S_ISFIFO (cmp.file[0].stat.st_mode)
> +               && S_ISFIFO (cmp.file[0].stat.st_mode))
> +    {
> +      /* Both are fifos.  */
> +    }

If they're the *same* fifo, they should compare the same (and already do, if I'm 
not mistaken).  But if they're *different* fifos?




From MAILER-DAEMON Wed Feb 11 18:38:07 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YLgr9-0007dE-OO
	for mharc-bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:38:07 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56408)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgr7-0007cF-NZ
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:38:06 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgr4-00007I-IA
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:38:05 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:49142)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgr4-00007E-F0
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:38:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgr4-00055y-2h
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:38:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Wed, 11 Feb 2015 23:38:02 +0000
Resent-Message-ID: <handler.19509.B19509.142369785719550@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 19509
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: patch
To: Paul Eggert <eggert@cs.ucla.edu>, 19509@debbugs.gnu.org
Received: via spool by 19509-submit@debbugs.gnu.org id=B19509.142369785719550
	(code B ref 19509); Wed, 11 Feb 2015 23:38:02 +0000
Received: (at 19509) by debbugs.gnu.org; 11 Feb 2015 23:37:37 +0000
Received: from localhost ([127.0.0.1]:40382 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YLgqf-00055G-3b
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 18:37:37 -0500
Received: from kolbaba.stable.cz ([88.86.120.103]:42176)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <ondrej@svobodasoft.cz>) id 1YLgqc-000551-Bi
	for 19509@debbugs.gnu.org; Wed, 11 Feb 2015 18:37:34 -0500
Received: from localhost (kolbaba.miton.cz [127.0.0.1])
	by kolbaba.stable.cz (Postfix) with ESMTP id B559A208CB
	for <19509@debbugs.gnu.org>; Thu, 12 Feb 2015 00:37:28 +0100 (CET)
X-Virus-Scanned: amavisd-new at kolbaba.stable.cz
Received: from kolbaba.stable.cz ([127.0.0.1])
	by localhost (kolbaba.stable.cz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 762IunxSqUGa for <19509@debbugs.gnu.org>;
	Thu, 12 Feb 2015 00:37:25 +0100 (CET)
Received: from [10.0.0.8] (38.211.broadband18.iol.cz [109.81.211.38])
	by kolbaba.stable.cz (Postfix) with ESMTPSA id CC82B204A0;
	Thu, 12 Feb 2015 00:37:23 +0100 (CET)
Message-ID: <54DBE7B2.5010201@svobodasoft.cz>
Date: Thu, 12 Feb 2015 00:37:22 +0100
From: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
References: <54A9AB0D.1090900@svobodasoft.cz>
	<54DBE5BF.3010009@svobodasoft.cz> <54DBE629.1060302@cs.ucla.edu>
In-Reply-To: <54DBE629.1060302@cs.ucla.edu>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#19509: bug#19509: [PATCH] diff: treat fifos as
	identical
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Feb 2015 23:38:06 -0000

I also posed this question to myself -- how can we tell two fifos apart? 
Do they by any chance store e.g. a file descriptor when they are being used?

I am not aware of any comparison done to fifos but I may as well be wrong.

On 12.2.2015 00:30, Paul Eggert wrote:
> Ondřej Svoboda wrote:
>>       }
>> +      else if (S_ISFIFO (cmp.file[0].stat.st_mode)
>> +               && S_ISFIFO (cmp.file[0].stat.st_mode))
>> +    {
>> +      /* Both are fifos.  */
>> +    }
>
> If they're the *same* fifo, they should compare the same (and already 
> do, if I'm not mistaken).  But if they're *different* fifos?
>





From MAILER-DAEMON Wed Feb 11 18:41:09 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YLgu5-0008LF-4X
	for mharc-bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:41:09 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56697)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgu2-0008Hk-MN
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:41:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgty-0000kx-C8
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:41:06 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:49146)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgty-0000kq-8k
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:41:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLgtx-0005Ac-T5
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 18:41:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Wed, 11 Feb 2015 23:41:01 +0000
Resent-Message-ID: <handler.19508.B19508.142369803019827@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 19508
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: patch
To: 19508@debbugs.gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Received: via spool by 19508-submit@debbugs.gnu.org id=B19508.142369803019827
	(code B ref 19508); Wed, 11 Feb 2015 23:41:01 +0000
Received: (at 19508) by debbugs.gnu.org; 11 Feb 2015 23:40:30 +0000
Received: from localhost ([127.0.0.1]:40386 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YLgtR-00059j-RQ
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 18:40:30 -0500
Received: from kolbaba.stable.cz ([88.86.120.103]:44103)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <ondrej@svobodasoft.cz>) id 1YLgtP-00059U-Au
	for 19508@debbugs.gnu.org; Wed, 11 Feb 2015 18:40:28 -0500
Received: from localhost (kolbaba.miton.cz [127.0.0.1])
	by kolbaba.stable.cz (Postfix) with ESMTP id D571420977
	for <19508@debbugs.gnu.org>; Thu, 12 Feb 2015 00:40:21 +0100 (CET)
X-Virus-Scanned: amavisd-new at kolbaba.stable.cz
Received: from kolbaba.stable.cz ([127.0.0.1])
	by localhost (kolbaba.stable.cz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ZM1KmTGDZyc3 for <19508@debbugs.gnu.org>;
	Thu, 12 Feb 2015 00:40:18 +0100 (CET)
Received: from [10.0.0.8] (38.211.broadband18.iol.cz [109.81.211.38])
	by kolbaba.stable.cz (Postfix) with ESMTPSA id C37C520C8C;
	Thu, 12 Feb 2015 00:40:16 +0100 (CET)
Message-ID: <54DBE85F.5080803@svobodasoft.cz>
Date: Thu, 12 Feb 2015 00:40:15 +0100
From: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
References: <54A9A7E6.8020305@svobodasoft.cz>
In-Reply-To: <54A9A7E6.8020305@svobodasoft.cz>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#19508:  bug#19508: [PATCH] diff: compare major,
	minor numbers of block/character special files
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Feb 2015 23:41:07 -0000

Paul, this is the first patch in the series (and is succeeded by the 
fifo one), I am sorry for the confusion.

Could you please give it a look?

Thanks :-)
Ondra Svoboda

On 4.1.2015 21:51, Ondřej Svoboda wrote:
> This deals with situation such as
>
>   File dev1/block1 is a block special file while file dev2/block1 is
>   a block special file
>
> in case the major and minor numbers are identical.
> If stat.st_rdev does not match, a message is given:
>
>   Block special files dev1/block1 and dev2/block1 differ: 1,2 (3,2)
> ---
>  src/diff.c | 23 +++++++++++++++++++++++
>  src/diff.h |  1 +
>  src/util.c |  9 +++++++++
>  3 files changed, 33 insertions(+)
>
> diff --git a/src/diff.c b/src/diff.c
> index ff28377..a3e1b6f 100644
> --- a/src/diff.c
> +++ b/src/diff.c
> @@ -1276,6 +1276,29 @@ compare_files (struct comparison const *parent,
>            status = EXIT_FAILURE;
>          }
>      }
> +      else if ((S_ISBLK (cmp.file[0].stat.st_mode)
> +            && S_ISBLK (cmp.file[1].stat.st_mode))
> +           || (S_ISCHR (cmp.file[0].stat.st_mode)
> +               && S_ISCHR (cmp.file[1].stat.st_mode)))
> +    {
> +      if (cmp.file[0].stat.st_rdev != cmp.file[1].stat.st_rdev)
> +        {
> +          char major_minor0[20], major_minor1[20];
> +          format_major_minor (major_minor0, cmp.file[0].stat.st_rdev);
> +          format_major_minor (major_minor1, cmp.file[1].stat.st_rdev);
> +
> +          const char *message = S_ISBLK (cmp.file[0].stat.st_mode) ?
> +            "Block special files %s and %s differ: %s (%s)\n" :
> +            "Character special files %s and %s differ: %s (%s)\n";
> +          message5 (message,
> +            file_label[0] ? file_label[0] : cmp.file[0].name,
> +            file_label[1] ? file_label[1] : cmp.file[1].name,
> +            major_minor0, major_minor1);
> +
> +          /* This is a difference.  */
> +          status = EXIT_FAILURE;
> +        }
> +    }
>        else
>      {
>        /* We have two files that are not to be compared.  */
> diff --git a/src/diff.h b/src/diff.h
> index 465e4bc..098e75f 100644
> --- a/src/diff.h
> +++ b/src/diff.h
> @@ -390,3 +390,4 @@ extern void print_script (struct change *, struct 
> change * (*) (struct change *)
>  extern void setup_output (char const *, char const *, bool);
>  extern void translate_range (struct file_data const *, lin, lin,
>                               long int *, long int *);
> +extern void format_major_minor (char *buffer, const dev_t st_rdev);
> diff --git a/src/util.c b/src/util.c
> index 2d6d3fc..4773003 100644
> --- a/src/util.c
> +++ b/src/util.c
> @@ -24,6 +24,7 @@
>  #include <system-quote.h>
>  #include <xalloc.h>
>  #include "xvasprintf.h"
> +#include <sys/types.h>
>   char const pr_program[] = PR_PROGRAM;
>  @@ -907,3 +908,11 @@ debug_script (struct change *sp)
>     fflush (stderr);
>  }
> +
> +/* Format a device number as major,minor. */
> +
> +void
> +format_major_minor (char *buffer, const dev_t st_rdev)
> +{
> +  sprintf (buffer, "%u,%u", (major (st_rdev)), (minor (st_rdev)));
> +}





From MAILER-DAEMON Wed Feb 11 19:26:08 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YLhbc-0004Tp-2h
	for mharc-bug-diffutils@gnu.org; Wed, 11 Feb 2015 19:26:08 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36538)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLhbZ-0004RG-Eu
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 19:26:06 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLhbW-0006Cw-36
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 19:26:05 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:49179)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLhbW-0006Cs-0Q
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 19:26:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLhbV-0006DE-Qv
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 19:26:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Eric Blake <eblake@redhat.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Thu, 12 Feb 2015 00:26:01 +0000
Resent-Message-ID: <handler.19509.B19509.142370075523868@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 19509
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>,
	Paul Eggert <eggert@cs.ucla.edu>, 19509@debbugs.gnu.org
Received: via spool by 19509-submit@debbugs.gnu.org id=B19509.142370075523868
	(code B ref 19509); Thu, 12 Feb 2015 00:26:01 +0000
Received: (at 19509) by debbugs.gnu.org; 12 Feb 2015 00:25:55 +0000
Received: from localhost ([127.0.0.1]:40419 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YLhbP-0006Ct-8K
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 19:25:55 -0500
Received: from mx1.redhat.com ([209.132.183.28]:44389)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <eblake@redhat.com>) id 1YLhbL-0006Ch-RO
	for 19509@debbugs.gnu.org; Wed, 11 Feb 2015 19:25:53 -0500
Received: from int-mx10.intmail.prod.int.phx2.redhat.com
	(int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1C0Phr1008625
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256
	verify=FAIL); Wed, 11 Feb 2015 19:25:43 -0500
Received: from [10.3.113.9] ([10.3.113.9])
	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id t1C0Phrq002706; Wed, 11 Feb 2015 19:25:43 -0500
Message-ID: <54DBF306.90006@redhat.com>
Date: Wed, 11 Feb 2015 17:25:42 -0700
From: Eric Blake <eblake@redhat.com>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
References: <54A9AB0D.1090900@svobodasoft.cz>	<54DBE5BF.3010009@svobodasoft.cz>
	<54DBE629.1060302@cs.ucla.edu> <54DBE7B2.5010201@svobodasoft.cz>
In-Reply-To: <54DBE7B2.5010201@svobodasoft.cz>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="kXNnGfdoDglkUFkEb0cpuhlBM7PP1jqli"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#19509: bug#19509: bug#19509: [PATCH] diff:
	treat fifos as identical
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Feb 2015 00:26:06 -0000

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

On 02/11/2015 04:37 PM, Ond=C5=99ej Svoboda wrote:
> I also posed this question to myself -- how can we tell two fifos apart=
?
> Do they by any chance store e.g. a file descriptor when they are being
> used?
>=20
> I am not aware of any comparison done to fifos but I may as well be wro=
ng.

fstat() will tell you if two fds are the same fifo - their st_dev and
st_ino will be equal.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--kXNnGfdoDglkUFkEb0cpuhlBM7PP1jqli
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
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJU2/MGAAoJEKeha0olJ0NqkzcIAKjq4Er3IWiRJYUFJm7aveiF
x4DU+NCwojkbdnnAfJreL35F0shfnV+dcSSZgGI+HRu7dx2dRP9829pgR89Ow5YS
XcwXJCignoadS2XVdFcJUZ4rzCo9rmMsFqN+fuXEIXIK9OnkbJ/+atfmhwbhfPKE
BKGn78MIqUnR/EvIiVsWGGDifvajfH0HK1qtn6eI404/2WFDrokzgXeoof9GluGX
QseaShcIz4Vsu2HNypui60f+thYS5Wnl3lNC/zqnmed4aPOOOQz0Ja/G4UioXTzx
V2rgCi61QCMm+/iy77ycutUHiJmuB73DNVBgBzTnbmgeXfWrFiLIzXhnmYLog1o=
=OMau
-----END PGP SIGNATURE-----

--kXNnGfdoDglkUFkEb0cpuhlBM7PP1jqli--




From MAILER-DAEMON Wed Feb 11 23:23:10 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1YLlJ0-00040p-27
	for mharc-bug-diffutils@gnu.org; Wed, 11 Feb 2015 23:23:10 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49157)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLlIx-0003yk-Ur
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 23:23:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLlIs-0001Po-Vs
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 23:23:07 -0500
Received: from debbugs.gnu.org ([140.186.70.43]:49243)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLlIs-0001Pk-St
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 23:23:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1YLlIs-0003oP-8Q
	for bug-diffutils@gnu.org; Wed, 11 Feb 2015 23:23:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-diffutils@gnu.org
Resent-Date: Thu, 12 Feb 2015 04:23:02 +0000
Resent-Message-ID: <handler.19509.B19509.142371494714604@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 19509
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords: patch
To: Eric Blake <eblake@redhat.com>, Paul Eggert <eggert@cs.ucla.edu>,
	19509@debbugs.gnu.org
Received: via spool by 19509-submit@debbugs.gnu.org id=B19509.142371494714604
	(code B ref 19509); Thu, 12 Feb 2015 04:23:02 +0000
Received: (at 19509) by debbugs.gnu.org; 12 Feb 2015 04:22:27 +0000
Received: from localhost ([127.0.0.1]:40483 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1YLlIJ-0003nT-0D
	for submit@debbugs.gnu.org; Wed, 11 Feb 2015 23:22:27 -0500
Received: from kolbaba.stable.cz ([88.86.120.103]:38128)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <ondrej@svobodasoft.cz>) id 1YLlIG-0003nF-8f
	for 19509@debbugs.gnu.org; Wed, 11 Feb 2015 23:22:24 -0500
Received: from localhost (kolbaba.miton.cz [127.0.0.1])
	by kolbaba.stable.cz (Postfix) with ESMTP id 6764A21269
	for <19509@debbugs.gnu.org>; Thu, 12 Feb 2015 05:22:18 +0100 (CET)
X-Virus-Scanned: amavisd-new at kolbaba.stable.cz
Received: from kolbaba.stable.cz ([127.0.0.1])
	by localhost (kolbaba.stable.cz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id jRwB6U-PbC6g for <19509@debbugs.gnu.org>;
	Thu, 12 Feb 2015 05:22:15 +0100 (CET)
Received: from [10.0.0.8] (38.211.broadband18.iol.cz [109.81.211.38])
	by kolbaba.stable.cz (Postfix) with ESMTPSA id 7EDF220565;
	Thu, 12 Feb 2015 05:22:12 +0100 (CET)
Message-ID: <54DC2A73.9020804@svobodasoft.cz>
Date: Thu, 12 Feb 2015 05:22:11 +0100
From: =?UTF-8?Q?Ond=C5=99ej?= Svoboda <ondrej@svobodasoft.cz>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
References: <54A9AB0D.1090900@svobodasoft.cz>	<54DBE5BF.3010009@svobodasoft.cz>
	<54DBE629.1060302@cs.ucla.edu> <54DBE7B2.5010201@svobodasoft.cz>
	<54DBF306.90006@redhat.com>
In-Reply-To: <54DBF306.90006@redhat.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 140.186.70.43
Subject: [bug-diffutils] bug#19509: bug#19509: bug#19509: [PATCH] diff:
	treat fifos as identical
X-BeenThere: bug-diffutils@gnu.org
List-Id: "All diffutils discussion." <bug-diffutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/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: <https://lists.gnu.org/mailman/listinfo/bug-diffutils>,
	<mailto:bug-diffutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Feb 2015 04:23:08 -0000

Thank you, Eric!

I will try it out.

On 12.2.2015 01:25, Eric Blake wrote:
> On 02/11/2015 04:37 PM, Ondřej Svoboda wrote:
>> I also posed this question to myself -- how can we tell two fifos apart?
>> Do they by any chance store e.g. a file descriptor when they are being
>> used?
>>
>> I am not aware of any comparison done to fifos but I may as well be wrong.
> fstat() will tell you if two fds are the same fifo - their st_dev and
> st_ino will be equal.
>





