Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2020 11:06:52 +0200
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        Fehmi Noyan ISI <fnoyanisi@yahoo.com>
Cc:        Yuri Pankov <ypankov@fastmail.com>, freebsd-hackers@freebsd.org
Subject:   Re: diff(1) -N behaviour - Bug 233402
Message-ID:  <20200527090652.dubjpd2y2n5yfbta@ivaldir.net>
In-Reply-To: <0E0FB885-5D64-41F1-9A8B-8CEDB5884762@yahoo.com>
References:  <B380BAF4-2343-4A22-A26D-13437ECC00C2.ref@yahoo.com> <B380BAF4-2343-4A22-A26D-13437ECC00C2@yahoo.com> <94a82a22-b5c9-b797-30cc-0242f6da1c8a@fastmail.com> <4ADEBC26-0F93-45C1-B775-E6E33E95FDC1@yahoo.com> <efe1c596-f99e-5e1e-3c1a-0e4af38e3464@fastmail.com> <0E0FB885-5D64-41F1-9A8B-8CEDB5884762@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--24ygsgv57ix6tldz
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, May 27, 2020 at 08:52:38PM +1200, Fehmi Noyan ISI via freebsd-hacke=
rs wrote:
>=20
>=20
> > On 23/05/2020, at 11:47 PM, Yuri Pankov <ypankov@fastmail.com> wrote:
> >=20
> > Fehmi Noyan ISI via freebsd-hackers wrote:
> >>> On 23/05/2020, at 11:21 PM, Yuri Pankov <ypankov@fastmail.com> 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 a=
t diff(1) man page, I see that not treating absent files as empty is intent=
ional rather than a missing functionality.
> >>>> If this is not the case, I can work on patch to match to GNU diff be=
haviour, 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 "empt=
y=E2=80=9D?
> >> Maybe it=E2=80=99s my interpretation, but if you do not supply the sec=
ond 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 t=
he 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 d=
iff?
>=20
Yes we do, if you do provide a patch I would be more than happy to review a=
nd
apply it.

Best regards,
Bapt

--24ygsgv57ix6tldz
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl7OLawACgkQY4mL3PG3
Ploo2Q/8DE69TH/Ly810kFweBkQsRK1Alov9CKS6UNh23N1kKrdwm7Wwn71UkZRT
NdCOVAluGtmSlzVY9Upd5Y5OOlVpBezcDsM/MBAIP0gzY0qtr6sDTQsRc/82ZDhx
nN+8msezJ0/SwDYwUttCFpJHqMnHNUQKzY9WBWfxM+gPpng4hxw08iwAs9aQNKKF
HZfxAk1ZbPvTQj0W0cg6PH2OtocdyHdjLwaPYszlvp8fDH1+LU1cv+sdYBK9tmmn
j5kuzvK0cM14gyVy8F6jfoLgfmzoEQZyt6uOQJoD9VQ49bdz7zl587UKGNfx+K7B
PkcsVVTuyDtdKTIzaRIEzEl5re0NO4uFPKNzxdko4/xYQXZ4pKx7AORuxxUc6IPp
gbcE/MbifrjbQLJevRG8I6ejNS+TyCHOxy79AjkZRv0u1/p1oazSZE7mL8+6kmfo
Mr8BbYc8QKyhOIBWdMrgmr29U7oa+Amh04Wc4M+7CEx4uAvj+GlYypPOEQ89UHHY
Ug78HbwOLiH6YASZyb6Wj2jvWs75rGSLJRuxoWMSkMPR2QA5sUgFCc9HWY2osnUX
L9Ei5jCPo1JoEJ01BH3zQ4vJyNV1Sx0keEmcB36olXcgJ3kjxBJNNL9KM3HkiZM6
Jzhux4dQDm30lcHQXh373CMR0jc75uDm9XDtXt64vIJPyGB1obQ=
=g0VU
-----END PGP SIGNATURE-----

--24ygsgv57ix6tldz--



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