From owner-freebsd-hackers@freebsd.org Wed May 27 09:11:12 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E560F32CDFA for ; Wed, 27 May 2020 09:11:12 +0000 (UTC) (envelope-from fnoyanisi@yahoo.com) Received: from sonic311-13.consmr.mail.bf2.yahoo.com (sonic311-13.consmr.mail.bf2.yahoo.com [74.6.131.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49X4nX1C7xz41CP for ; Wed, 27 May 2020 09:11:12 +0000 (UTC) (envelope-from fnoyanisi@yahoo.com) X-YMail-OSG: q_UePDoVM1mW.Jw2GDyBguVESGLrWvnsujWw4j1ZoM8r7kz6etj.TFt8DHu.5DO bIoBbPbKnbdH4.3hwt4xztj9TyEQgrNlcylFC1zCZeaBvan7eOp23.nZ8awl440OqUikHKEANaor jvsvz3rnLgAiUKj1F8jRjL.zg8tqcLKQzENhbhxg8tXwEuxnRvIHlm1p1zyhc0iQ3NYTfM3iOaud IVcY3wAT0DOiptw3EavWYOqE.sjEKs1w0chsqzFxZ2jmTuQx_8NTvxmKOxW06zk3gxhpv1b2pGr9 VLdHywgW5Yo4uGFEeDv5KWE9JwD6UUSZCkrWywTtDmsKz3ZiN1mWria5YYpLZ2En3haYNEu89dTg AkJJOjDUCxmQAmv9IALXr.yQN5tl.Nd5HbkIQzX8EK5lmZjURNYTsiZCpu6Op.O3WW4HkvVkwnZw _ePi5hvZuCiu5HS2TpwAqpf1YabBUzUxzZJGc8GY26cGG8XvnXLr04H_6dkhMoL55Kxjq9JRrTfO kmik3UX68Yu95yrXvDwB1Hn8quVy9UiYk37amC5sQ_sOFp83CQBviEkxq90nDvivR1wfdD4PPyF7 Tgvc4om9NEyLJk9UgizwTascLNIAt.QLXEX7eqBJTK1tP0uEw92pKfRfTxmTdcQ2EP858ik4wZTM eswoCzu.xzMxo5_0ippiA7YsTuwvCCShHmuk7UfnHD4BmGJ6ak.iFe29KsovtMR3mGVyXmpjOilZ 3GIlJ2IbLbxv.aTh6rfNreamoVebrLlkGn5cQfN_7b7NAdrpx9YU9FwRMne3PUa8cOkqI9qguoij XQcWWvIYmg0wqlCVL22aJbSDz2RYhoApM6aJ.4.0cUlV8L4zxBH8t54bGn0IoQm4JsW.baZng0qf W0KvMVFPVSCzWIOd8SiqSAXK9gtJ207qmAvhWxDWBDOsB0VHCd9q3BqBhRe4zxYLJwQ4RdMTkHfj yrDpGJXEB5AzLA2qY_hOZH64Inwlk.UehGo4SPAbpNxDdSokob2BqZubBSj4sJv1tU.jS4XLAvoK K0ZUMH4wm.piK8Orvew3Bjhw76jE9i3uncZj5YOqbxllCEUhCCWXy0VVQEmNOA2A3mhJW0VlEbrz 6oie1HTRSbxx1jOe8PH.lIT4IV9bfmfc1sfjFjRdSVSYerHMca_7vDiy0obtVl_74PjFxmLL7U24 5wFtfPDDWrOGIhif8EbFowdB1nXqEfEuo2DC13KhKTF4jDO6paWeiuKHInStoF7UpMcZw4ygbyOm gN4EwJT6JxWyl6.H7CJoLFkgS6nFvPhgmNml7z7PYxQOZA84idJ6kh3NCtVbsSZqE_PIy_29AhWL JfO4aYfk1ahb5OaJPg.ydlXZNBWKhGGdqri_Zu1AKC0iA8F4yzpPnF0CsK9TxNwfBkHG_nr9kxJ7 vMso6FnfWVLPpvTiQ Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Wed, 27 May 2020 09:11:11 +0000 Received: by smtp423.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID c81b73961fdddf14bec03c84aaeb958e; Wed, 27 May 2020 09:11:08 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: diff(1) -N behaviour - Bug 233402 From: Fehmi Noyan ISI In-Reply-To: <20200527090652.dubjpd2y2n5yfbta@ivaldir.net> Date: Wed, 27 May 2020 21:11:02 +1200 Cc: Yuri Pankov , freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <94a82a22-b5c9-b797-30cc-0242f6da1c8a@fastmail.com> <4ADEBC26-0F93-45C1-B775-E6E33E95FDC1@yahoo.com> <0E0FB885-5D64-41F1-9A8B-8CEDB5884762@yahoo.com> <20200527090652.dubjpd2y2n5yfbta@ivaldir.net> To: Baptiste Daroussin X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49X4nX1C7xz41CP X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.35 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-0.84)[-0.838]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:26101, ipnet:74.6.128.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.02)[-1.019]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-0.995]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[74.6.131.123:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[74.6.131.123:from]; FREEMAIL_CC(0.00)[fastmail.com,freebsd.org]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2020 09:11:13 -0000 > On 27/05/2020, at 9:06 PM, Baptiste Daroussin = wrote: >=20 > On Wed, May 27, 2020 at 08:52:38PM +1200, Fehmi Noyan ISI via = freebsd-hackers wrote: >>=20 >>=20 >>> On 23/05/2020, at 11:47 PM, Yuri Pankov = wrote: >>>=20 >>> Fehmi Noyan ISI via freebsd-hackers wrote: >>>>> On 23/05/2020, at 11:21 PM, Yuri Pankov = wrote: >>>>>=20 >>>>> Fehmi Noyan ISI via freebsd-hackers wrote: >>>>>> Hiya >>>>>> Apparently, after we switched from GNU diff to BSD diff, the -N = flag no longer assumes absent files as empty. >>>>>> There is a bug report about GNU diff compatibility but when I = look at diff(1) man page, I see that not treating absent files as empty = is intentional rather than a missing functionality. >>>>>> If this is not the case, I can work on patch to match to GNU diff = behaviour, otherwise, this bug report can be closed I think. >>>>>> What=E2=80=99s your take on this? >>>>>> -N --new-file >>>>>> If a file is found in only one directory, act as if it was = found >>>>>> in the other directory too but was of zero size. >>>>>> man for GNU diff >>>>>> -N, --new-file >>>>>> treat absent files as empty >>>>>=20 >>>>> I think both descriptions say the same, i.e. "zero size" =3D=3D = "empty=E2=80=9D? >>>> Maybe it=E2=80=99s my interpretation, but if you do not supply the = second argument to diff(1), it complains >>>> $ echo =E2=80=9Ctest=E2=80=9D > a.txt >>>> $ diff -N a.txt nofile >>>> diff: nofile: No such file or directory >>>> $ >>>> GNU diff assumes an empty file for the missing second file and = makes the comparison >>>> $ echo =E2=80=9Ctest=E2=80=9D > a.txt >>>> $ diff -N a.txt nofile >>>> 1d0 >>>> < test >>>> $ >>>=20 >>> I must admit that I never used -N without -r, so it's probably the = only case that needs fixing? >>>=20 >>> $ mkdir a b >>> $ echo bar > a/foo >>> $ diff -ruN a b >>> diff -ruN a/foo b/foo >>> --- a/foo 2020-05-23 14:44:34.525932000 +0300 >>> +++ b/foo 1970-01-01 03:00:00.000000000 +0300 >>> @@ -1 +0,0 @@ >>> -bar >>>=20 >>=20 >> Took me a while to reply=E2=80=A6 >> With -N, GNU diff does not give an ENOENT >>=20 >> % echo foo > bar >> % diff bar nofile.txt >> diff: nofile.txt no such file or directory >> % diff -N bar nofile.txt >> 1d0 >> < foo >>=20 >> Do we want BSD diff do the same, i.e. match the -N functionality of = GNU diff? >>=20 > Yes we do, if you do provide a patch I would be more than happy to = review and > apply it. >=20 > Best regards, > Bapt Cheers=E2=80=A6 I will be working on it and update bug 233402