From owner-freebsd-hackers@freebsd.org Thu May 28 06:26:06 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 D5BA32FF926 for ; Thu, 28 May 2020 06:26:06 +0000 (UTC) (envelope-from bsd-lists@BSDforge.com) Received: from udns.ultimatedns.net (static-24-113-41-81.wavecable.com [24.113.41.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "ultimatedns.net", Issuer "Let's Encrypt Authority X3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Xd4Z2jqfz3yjL; Thu, 28 May 2020 06:26:06 +0000 (UTC) (envelope-from bsd-lists@BSDforge.com) Received: from udns.ultimatedns.net (localhost [IPv6:0:0:0:0:0:0:0:1]) by udns.ultimatedns.net (8.15.2/8.15.2) with ESMTPS id 04S6QAaw048974 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 27 May 2020 23:26:17 -0700 (PDT) (envelope-from bsd-lists@BSDforge.com) X-Mailer: Cypht MIME-Version: 1.0 Cc: Yuri Pankov , , Fehmi Noyan ISI In-Reply-To: <20200527090652.dubjpd2y2n5yfbta@ivaldir.net> From: Chris Reply-To: bsd-lists@BSDforge.com To: Baptiste Daroussin Subject: Re: diff(1) -N behaviour - Bug 233402 Date: Wed, 27 May 2020 23:26:16 -0700 Message-Id: <3df104a8139d5252b3426ae1600bfc86@udns.ultimatedns.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 49Xd4Z2jqfz3yjL X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:11404, ipnet:24.113.0.0/16, country:US]; local_wl_ip(0.00)[24.113.41.81] 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: Thu, 28 May 2020 06:26:06 -0000 On Wed, 27 May 2020 11:06:52 +0200 Baptiste Daroussin bapt@FreeBSD=2Eorg said > On Wed, May 27, 2020 at 08:52:38PM +1200, Fehmi Noyan ISI via freebsd-hac= kers > 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 wrot= e: > > >>>=20 > > >>> Fehmi Noyan ISI via freebsd-hackers wrote: > > >>>> Hiya > > >>>> Apparently, after we switched from GNU diff to BSD diff, the -N fl= ag no > > longer assumes absent files as empty=2E > > >>>> 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 inte= ntional > > rather than a missing functionality=2E > > >>>> 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=2E > > >>>> 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 fou= nd > > >>>> in the other directory too but was of zero size=2E > > >>>> man for GNU diff > > >>>> -N, --new-file > > >>>> treat absent files as empty > > >>>=20 > > >>> I think both descriptions say the same, i=2Ee=2E "zero size" =3D=3D "em= pty=E2=80=9D? > > >> Maybe it=E2=80=99s my interpretation, but if you do not supply the s= econd > > argument to diff(1), it complains > > >> $ echo =E2=80=9Ctest=E2=80=9D > a=2Etxt > > >> $ diff -N a=2Etxt 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=2Etxt > > >> $ diff -N a=2Etxt nofile > > >> 1d0 > > >> < test > > >> $ > > >=20 > > > I must admit that I never used -N without -r, so it's probably the on= ly > > 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=2E525932000 +0300 > > > +++ b/foo 1970-01-01 03:00:00=2E000000000 +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=2Etxt > > diff: nofile=2Etxt no such file or directory > > % diff -N bar nofile=2Etxt > > 1d0 > > < foo > >=20 > > Do we want BSD diff do the same, i=2Ee=2E match the -N functionality of GNU > > diff? > >=20 > Yes we do, Why? If someone wants a GNU diff=2E Can't they simply install it? If FreeBSD diff is to become like GNU diff, what's the point of having a FreeBSD version=2E Apologies in advance if I'm missing anything here=2E Thanks=2E --Chris > if you do provide a patch I would be more than happy to review > and > apply it=2E >=20 > Best regards, > Bapt