Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 May 2020 09:50:43 -0700
From:      Chris <bsd-lists@BSDforge.com>
To:        Baptiste Daroussin <bapt@FreeBSD.org>
Cc:        Yuri Pankov <ypankov@fastmail.com>, <freebsd-hackers@freebsd.org>, <bsd-lists@bsdforge.com>
Subject:   Re: diff(1) -N behaviour - Bug 233402
Message-ID:  <dd1e14d6fcbad9471c3f3257cf9326f8@udns.ultimatedns.net>
In-Reply-To: <c56d36b42642c02f9ac0e80d5e5bc489@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 28 May 2020 11:21:16 +0200 Baptiste Daroussin bapt@FreeBSD=2Eorg said

> On 2020-05-28 08:26, Chris wrote:
> > On Wed, 27 May 2020 11:06:52 +0200 Baptiste Daroussin bapt@FreeBSD=2Eorg=
=20
> > said
> >=20
> >> On Wed, May 27, 2020 at 08:52:38PM +1200, Fehmi Noyan ISI via=20
> >> freebsd-hackers
> >> wrote:
> >> > > > > On 23/05/2020, at 11:47 PM, Yuri Pankov <ypankov@fastmail=2Ecom>
> > wrote:
> >> > > > > Fehmi Noyan ISI via freebsd-hackers wrote:
> >> > >>> On 23/05/2020, at 11:21 PM, Yuri Pankov <ypankov@fastmail=2Ecom> w=
rote:
> >> > >>> > >>> 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=2E
> >> > >>>> There is a bug report about GNU diff compatibility but when I l=
ook
> > at
> >> > diff(1) man page, I see that not treating absent files as empty is
> > intentional
> >> > rather than a missing functionality=2E
> >> > >>>> If this is not the case, I can work on patch to match to GNU di=
ff
> >> > 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 =
found
> >> > >>>>     in the other directory too but was of zero size=2E
> >> > >>>> man for GNU diff
> >> > >>>> -N, --new-file
> >> > >>>>     treat absent files as empty
> >> > >>> > >>> I think both descriptions say the same, i=2Ee=2E "zero size" =
=3D=3D
> > "empty=E2=80=9D?
> >> > >> Maybe it=E2=80=99s my interpretation, but if you do not supply th=
e second
> >> > 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 ma=
kes
> > the
> >> > comparison
> >> > >> $ echo =E2=80=9Ctest=E2=80=9D > a=2Etxt
> >> > >> $ diff -N a=2Etxt nofile
> >> > >> 1d0
> >> > >> < test
> >> > >> $
> >> > > > > I must admit that I never used -N without -r, so it's probably=
 the
> > only
> >> > case that needs fixing?
> >> > > > > $ 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
> >> > > > > Took me a while to reply=E2=80=A6
> >> > With -N, GNU diff does not give an ENOENT
> >> > > % echo foo > bar
> >> > % diff bar nofile=2Etxt
> >> > diff: nofile=2Etxt no such file or directory
> >> > % diff -N bar nofile=2Etxt
> >> > 1d0
> >> > < foo
> >> > > Do we want BSD diff do the same, i=2Ee=2E match the -N functionality o=
f GNU
> >> > diff?
> >> > 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
> >=20
>=20
> Because When I switched from GNU diff to BSD diff recently, the intent=20
> was to be mostly compatible with GNU diff (the one we had for very long,=
=20
> not necessary the very latest version if it) it has been requested by=20
> many users to avoid breakage in most script and usage of diff people=20
> were having for a long time=2E
>=20
> while what has been committed is not 100% compatible it is very close,=20
> and there is a file that documents what is missing from this=20
> implementation=2E
>=20
> Now back to the -N the behaviour Fehmi is proposing to fix is a bug in=20
> what I did implement the intent as always been to get the behaviour he=20
> describes not the one we currently have=2E
>=20
> Side note: the motivation for switching from GNU diff to BSD diff in=20
> base is the same as for the rest of the removal of the GNU components in=
=20
> base: we cannot get any update because newer version are in GPLv3)=2E
Thank you very much for taking the time to reply=2E That all makes perfect se=
nse=2E
Apologies for my ignorance, and thanks again=2E

--Chris
>=20
> Best regards,
> Bapt





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?dd1e14d6fcbad9471c3f3257cf9326f8>