From owner-freebsd-hackers@freebsd.org Wed May 27 23:38:43 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 979442F2965 for ; Wed, 27 May 2020 23:38:43 +0000 (UTC) (envelope-from fnoyanisi@yahoo.com) Received: from sonic301-3.consmr.mail.bf2.yahoo.com (sonic301-3.consmr.mail.bf2.yahoo.com [74.6.129.42]) (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 49XS2V1VQyz4Mlq for ; Wed, 27 May 2020 23:38:41 +0000 (UTC) (envelope-from fnoyanisi@yahoo.com) X-YMail-OSG: YiEDdjAVM1mzOq4HjuinLjlgFEWp14pXcsssErSCPQP_FeDVdH87JhXuHi9_lyc e5vk40fw_AvYh0pDzcopIxbaxRPvblNQOX.rZVtbWSvsdqyCCVEHhWAd94eCO6Hih78JZBdgi3fc vNN1wupZkhMEnTShg2D.7_SAIDsIEfSgDqB9wFybSfGk9eet.j7bjzPVOhp8Di0ReXl9VcMKlKSo 3vab.hmRe8uV1wEgU7yWCUgifVxB3MIuUEVbZB41HcyUgaNJAlY97FluHnBgoOyeKqHlSjQp3gwY j_JD49sgGxWHKkmQNwd2T_Pp1Xvo2dKGvGeeifnkkaLUjZzZ.iLUMEzImt_D8o1nh_s6h2hTt9SN J9yxtVn_my6OhD6mbu_ov2_kRbmTy9fTMxPxBnQ9Q14kczi4Onqkn6Y8T92aCV.1bS3w8m0jHj1h U.H6H8Ej5XGlMAWG6JZBa8kzJ4qnnj38bJhLFGlsNEOniqr_nmFidqRVHSOTQ5aCk1paw57LY_ZO lTqjFPOyHsFI07cEYX7OUdPjQJyOxsxgkXRS3u.4Z.J_K3TSV0L3ItP8HLE.rvz2EnWjgkkE61ow gcKpOh65MF.jaD8HZaZOQOY7iO4cJb3KE3P4JpCOnzCAbCKOcYGJXJLwlvTqjKWzqzMsZ5QBxfKu RMXgLV0IDovMdjY9X5x_MoCnBlGkYgx3l87a7UC1KVc1Wld7iki0_widmgZrT7unZsLB5Wc_n2ky 0cC1xWMPsIXcR.veffuNWkdwUhub5xjOAlt1NAfGWVo4ijJvdJiHAubbx70uPF5ra71BBoV.cAlg 7M4OVc7FFitSysRiQNtZnhaSCdJ.IJn4DasrZyVMTHWuHy_hhzU4Omnbfldx0ey_QRnKHhrWTc4B uBGDw7xG4Dlmex3oprNywcYAQjh3k7rmGJiThfc5hJFtX7xj.CCqS2QOwB2Yg1Z79V5zut_tGIo5 TGftskW5k9iIW3oSsxwUCKzlWNSqunVmYU2p1otl8uyaiLqe0JYtvwTtsvcnK0oOrm_o.IIODjv. EYcP1.7OpGfHhYpKN_cS6Yd7zbhDmF.8v_OSINZJxF5r92QA7dVqiU5__O73IPDn11gbWQ9prOEy c88WXkIMnkGbXRBXdqhZp0LmRxLfqMFioaRpI6IugMxBAezY2TYMRlj6Nc6Xe_alGWr9j6iRaW0j QvBS9uYtYTAFHKenOz3UP8ia7N5oQEpU.HsWdg4kDTGD2PS8SK3NeV.Ze2RGwIPwF1hUWnmt20Pl UwOcEQUSBpjWGFR_gYxIavqTGlnei.hAklqtXFWJHUlhVK_hyyGDg4cBz_TS0.kNjQUr4PB7R.sy XqVR8Gudo7s2fBFKxKpDonT3uRoYANDZLURqE8Vc4m9_KueWiD5J1Q9dMUmZND4Rf2_qpHTQT3DG 7N9Q2twPo Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Wed, 27 May 2020 23:38:40 +0000 Received: by smtp431.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID cee78586872de35e91d5896b3b331e44; Wed, 27 May 2020 23:38:37 +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: Date: Thu, 28 May 2020 11:38:31 +1200 Cc: Baptiste Daroussin , freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <42477983-D45B-4068-8949-15E4026C0857@yahoo.com> 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: Yuri Pankov X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49XS2V1VQyz4Mlq X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.37 / 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.90)[-0.904]; FREEMAIL_TO(0.00)[fastmail.com]; 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(-0.97)[-0.974]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-0.99)[-0.991]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[74.6.129.42:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[74.6.129.42:from]; 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 23:38:43 -0000 > On 27/05/2020, at 9:52 PM, Yuri Pankov wrote: >=20 > Fehmi Noyan ISI via freebsd-hackers wrote: >>> 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 >=20 > Great! I wasn't discouraging you, rather trying to understand what = case exactly we are talking about. Also, I think the -N option = description in the man page should look more like GNU's one, as = currently (I think) it implies that -r is used and we are comparing = directories recursively. > _______________________________________________ >=20 Yes, the BSD diff.1 man page also needs updating since the current = wording implies that diff(1) does not treat missing files as empty = unless it is found in any one of the directories. GNU diff=E2=80=99s = approach here is more loose I think. Fehmi=20