GNU bug report logs - #31577
Using -S / --starting-file causes diff to miss some files

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: diffutils; Reported by: Maxim Baz <lists.gnu@HIDDEN>; dated Thu, 24 May 2018 08:25:02 UTC; Maintainer for diffutils is bug-diffutils@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 May 2018 08:24:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 24 04:24:11 2018
Received: from localhost ([127.0.0.1]:45950 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fLlXe-00070P-HM
	for submit <at> debbugs.gnu.org; Thu, 24 May 2018 04:24:11 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48735)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lists.gnu@HIDDEN>) id 1fLdcY-0001tP-9M
 for submit <at> debbugs.gnu.org; Wed, 23 May 2018 19:56:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <lists.gnu@HIDDEN>) id 1fLdcR-0003HC-Sw
 for submit <at> debbugs.gnu.org; Wed, 23 May 2018 19:56:37 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:40478)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <lists.gnu@HIDDEN>)
 id 1fLdcR-0003H2-PI
 for submit <at> debbugs.gnu.org; Wed, 23 May 2018 19:56:35 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39681)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <lists.gnu@HIDDEN>) id 1fLdcQ-0007Jg-Bc
 for bug-diffutils@HIDDEN; Wed, 23 May 2018 19:56:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <lists.gnu@HIDDEN>) id 1fLdcN-0003F0-8L
 for bug-diffutils@HIDDEN; Wed, 23 May 2018 19:56:34 -0400
Received: from mail.maximbaz.com ([40.68.155.0]:50116)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <lists.gnu@HIDDEN>)
 id 1fLdcM-0003AI-V8
 for bug-diffutils@HIDDEN; Wed, 23 May 2018 19:56:31 -0400
Received: from [192.168.1.113] (unknown [87.59.102.187])
 (Authenticated sender: me@HIDDEN)
 by mail.maximbaz.com (Postfix) with ESMTPSA id B22D98EDD1
 for <bug-diffutils@HIDDEN>; Wed, 23 May 2018 23:56:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maximbaz.com;
 s=dkim; t=1527119776;
 h=from:sender:reply-to:subject:date:message-id:to:cc:mime-version:content-type:content-transfer-encoding:resent-to:resent-cc:resent-from:resent-sender:resent-message-id:in-reply-to:references:list-id:list-owner:list-unsubscribe:list-subscribe:list-post;
 bh=CiNF24AlIGeUNzlW5CEHIh4yv2un0ucNnSvnLkcWU+g=;
 b=igDu7VF7JYCWpZ9BtSHrhrDRT0986itHKVNSi2evC9QduqnMnn5H4znUGttgFeKP+2WhOF
 xLxZXD38ce+zHhRguZbxe1nZHXDvOX041MfDb7D6LtSZ7WoQkb4GvZ37p4ycMNSqMHgj+a
 OZ63QH1y0vPCuC2Ymp2bdD7lt4cdk0T5S6Agu2BvzLMngnxcrD8UjBG+f+sihEvzaJncUG
 OXbR8+H/OGLRIyEY62/VqL6ohpMOYtcUQSgDkk/bIMkfPoBAyU0ZA8zRfT0JsVgKK5gxmt
 vkGHv6Yog300BOhl9LRpzSiRkEtQDVjzGH4xcaGgyyxSgFjY3brxUy2atNcqWQ==
From: Maxim Baz <lists.gnu@HIDDEN>
Subject: Using -S / --starting-file causes diff to miss some files
To: bug-diffutils@HIDDEN
Openpgp: id=EB4F9E5A60D32232BB52150C12C87A28FEAC6B20;
 url=https://keybase.io/maximbaz/pgp_keys.asc
Autocrypt: addr=lists.gnu@HIDDEN; prefer-encrypt=mutual; keydata=
 xsFNBFm0eMoBEAC3SoCJFZrwfCQdalSM/8YeLc78IPPkkup95Vrk1NvTIr/f8ifGG4zbgQEG
 TgLx33JRZ0ZPUsppcvrdka4VnhrjM3Lmag8QfHrIF+2Z6zo0h3TIk9FLRVqBpO3qkojAIVLc
 4Ar6cq2t8u2rGgppsVtkAqmA4V8QmBU92yGiDVKerPk0NAIA/N5vws1yl8TjNTjd98qIlLbE
 pgvVOmwOieKSHVkz5uybwydlzyqB477wcqFDrvjx4kY7esatfjFQI6/aNkJqJvowa+RR1LZs
 og7Fm0NKEpUvbQz+bfxY4I6CVkKzheyUR6DzUBPvh/qC/a82SanKpBOLSi2rqV81Kuvl5k3Q
 aed/EmIrv9qTQLR8DzHrDlkLiMJz5bqC2x9UVNTSyTtIBO8ZqjQ/9k/ZS7r8l9ZizkREYwuO
 1X966GIo4dY+D8aKyfM3qZGNU0F9u2WnzlGO0BAFi8gzU4QoGaAixUmfCEyWb9v3F2r6fTCF
 q5yoP6QGnKSeCWF4SinMLe0yaqCkWHd2+ws/CNVL1mfbu4G9J+OI89/rLhr75c7gm2bWa5I/
 3geNp7GNA0J5a4yd3E+xvY65Gbcl9f400LiWQ7CygwE8Cgg5qxTm4ER53FOTIOZL3c9N2RXI
 5L0ryXYO9UGr83BSAik0guNupwEi4GsmmbwL5XPHO6B62HEcMwARAQABzRxNYXhpbSBCYXog
 PHBncEBtYXhpbWJhei5jb20+wsGRBBMBCgA7AhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheA
 FiEE60+eWmDTIjK7UhUMEsh6KP6sayAFAlntK2oCGQEAC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QrsmQjp9Tz7pQ42W3IWAYM0
 VgT1OeNAy1Yzg2O+2ccCowejRcfdwueSPnkJekn1qqztFKCIPw==
Message-ID: <bd9a33aa-6bc7-6780-5efb-29e938613fe9@HIDDEN>
Date: Thu, 24 May 2018 01:56:06 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.8.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=maximbaz.com;
 s=dkim; t=1527119776;
 h=from:sender:reply-to:subject:date:message-id:to:cc:mime-version:content-type:content-transfer-encoding:resent-to:resent-cc:resent-from:resent-sender:resent-message-id:in-reply-to:references:list-id:list-owner:list-unsubscribe:list-subscribe:list-post;
 bh=CiNF24AlIGeUNzlW5CEHIh4yv2un0ucNnSvnLkcWU+g=;
 b=j4uW/EXNs/FKgHGvjGQyXi8kk6xbYFDfOLcotiJTdvrdY49GkaQ+Q36rNW/UAlhf6hIuip
 2OfxEN85NGgEhr6N23ujvov0RbHGNA7Q78hkBkI0A5bC7FRrC/uRPcoJu3P2iDzcH4cvq9
 KJkr0TPaeYJAYERsWBhV+c2buzflQDqeKkTqlVx7BFSNK2flPw4IwZsEjWh6GB8Vpe9eBy
 GWdpcNDSknjIwmyBPhgfXIy4gxeYTvbiedRylxmsUxhOlPSkl5qOWJr/xNFtpra8T3uD5u
 qtGN6wvGoJVi8aLYS79CeUwZJtDaeSr0cXaagvLFJdO5Q1eicf5vWRdTOe9Tcw==
ARC-Seal: i=1; s=dkim; d=maximbaz.com; t=1527119776; a=rsa-sha256; cv=none;
 b=GJHsRUrwPwNnWi/mXIc12FH2prwr8/PNHYTsitq0Xzfx3faVz52TlmnoUrkQzME5Zu5CWvMwqXtfoCKBnV2V5DXyove87w1wwD8PI//3amIgN6rszfUBDfeYivpEv2O6pUAROh+PdfuDIZ/1EvMbiLe7TNNKlLqKck4PemSAzrtGvorPjSDFo/QLTrcpmxfpN7ta49VC0gQ6gMoQ57iK0gFOdpICdQEVWMDjrwpSWCNxR7nQX8tJrNxWJuq2xlPCjEIc/F7mgJFZ7zADJCCzFURVDvzgri4J0j/WFNKeIpARr8ofdasnIMUfKZBuBKRTuvLmXdqm3OjEXdh38tF1/g==
ARC-Authentication-Results: i=1; auth=pass smtp.auth=me@HIDDEN
 smtp.mailfrom=lists.gnu@HIDDEN
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 24 May 2018 04:24:09 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hello,

The manual describes -S option as "start with FILE when comparing directo=
ries". My intuition is that this should behave like -O option in git-diff=
 [1]: show differences in FILE first, then show differences in all other =
files. However, it appears that diff behaves in a different (and quite we=
ird) way: it first composes an ordered list of files to compare, then cut=
s off the beginning of this list until FILE, and only then starts compari=
ng the remaining files. This is extremely unintuitive and I consider this=
 a bug (and if happens to be "by design", then I propose a new feature re=
quest for -O option =F0=9F=99=82)


Specific example:

Create file structure as below, all files in the directory "one" should h=
ave word "one" as the contents, all files in the directory "two" should w=
ord "two" as the contents (so all files are different).

=E2=9D=AF tree -a
.
=E2=94=9C=E2=94=80=E2=94=80 one
=E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 dir
=E2=94=82=C2=A0=C2=A0 =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 f=
ile
=E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 .hidden-dir
=E2=94=82=C2=A0=C2=A0 =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 f=
ile
=E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 .hidden-file
=E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 zfile
=E2=94=94=E2=94=80=E2=94=80 two
    =E2=94=9C=E2=94=80=E2=94=80 dir
    =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 file
    =E2=94=9C=E2=94=80=E2=94=80 .hidden-dir
    =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 file
    =E2=94=9C=E2=94=80=E2=94=80 .hidden-file
    =E2=94=94=E2=94=80=E2=94=80 zfile

6 directories, 8 files

=E2=9D=AF diff -ur one two | grep '+++' | wc -l
4

=E2=9D=AF diff -ur -S zfile one two | grep '+++' | wc -l
1

=E2=9D=AF diff -ur -S zfile one two                    =20
diff --color --unified -ur -S zfile one/zfile two/zfile
--- one/zfile   2018-05-24 01:23:49.237899164 +0200
+++ two/zfile   2018-05-24 01:24:58.260920662 +0200
@@ -1 +1 @@
-one
+two


I expect both diff calls to output differences in 4 files, only the secon=
d call to print differences in the file "zfile" first.


[1]: https://git-scm.com/docs/git-diff#git-diff--Oltorderfilegt



Regards,
Maxim Baz




Acknowledgement sent to Maxim Baz <lists.gnu@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-diffutils@HIDDEN. Full text available.
Report forwarded to bug-diffutils@HIDDEN:
bug#31577; Package diffutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.