Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2020 23:38:32 +1200
From:      Fehmi Noyan ISI <fnoyanisi@yahoo.com>
To:        Yuri Pankov <ypankov@fastmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: diff(1) -N behaviour - Bug 233402
Message-ID:  <4ADEBC26-0F93-45C1-B775-E6E33E95FDC1@yahoo.com>
In-Reply-To: <94a82a22-b5c9-b797-30cc-0242f6da1c8a@fastmail.com>
References:  <B380BAF4-2343-4A22-A26D-13437ECC00C2.ref@yahoo.com> <B380BAF4-2343-4A22-A26D-13437ECC00C2@yahoo.com> <94a82a22-b5c9-b797-30cc-0242f6da1c8a@fastmail.com>

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


> 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 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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ADEBC26-0F93-45C1-B775-E6E33E95FDC1>