From owner-freebsd-hackers@freebsd.org Sat May 23 11:47:39 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 758C22C88B5 for ; Sat, 23 May 2020 11:47:39 +0000 (UTC) (envelope-from ypankov@fastmail.com) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49ThRt4jSYz3Zm3 for ; Sat, 23 May 2020 11:47:38 +0000 (UTC) (envelope-from ypankov@fastmail.com) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id E82237CA; Sat, 23 May 2020 07:47:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 23 May 2020 07:47:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=J 5dQ4LEupAE1ML1uoI29lZMEIqtbsgI8cmZaWjiQ/r8=; b=UXmY1evMVo22KPD/u 9OAE1dVEDyguidINJwYcvws1fHsOkbYq4u1FBMdXVt6VUT1eJiNfExmOrx1RFKSm 583QkDZ3ObuF98IgGk0A8WbTWzYJ/vaX1hKVLNhrt0/7tv/5i/QwvZMwnojz0SEb R4UBfUgvbNx00iBQHIjByyyoYdS1CtpoEUaQu6uVBqep+kR4Iyi41Xr7atKMWXqH hTzeyS2ow3mMLzlkdR7QB028U5J2BMHLx1tU5REVuOV08ZLxnfdcQ2AcTrY8Dvb2 zM/U4nnuvAlxt/HkTiYyArIxuGFc213U6ppgpLiJqP/ZPOgnI/Ac/aWkDFZRWFWI exSSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=J5dQ4LEupAE1ML1uoI29lZMEIqtbsgI8cmZaWjiQ/ r8=; b=QZ79UinSkRJros5Q1ROjAgMK1P6FQM+sQE5QBcJG2/fl0y8GRUo9CGKAc 8Hgfr6GNG66WkxschCtmMKinx0Ml5/fMueE0JSpHewABjsqE+9Wjrek3Q4V7CCdq LYpf61LqDz7FwgyQF6ScKl1qlcxhUI32orbLoEeVazMjNjTJ6+MrT2NQ2EJE8SEY tJAvlW9hDoPjkVQqvP/RrKleeeCY83RbEeTMRb5VeDf2YBy+Grte/nOLQVtGhoGa zVp3rwhAIBLhmx+yTL9VRrcFIpe/F3I78NtopCZIhXnUOiaexLwCOXxqpxtduYFn STWz4yI25kvAFrvI8rois4d6crwWA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudduhedggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtke ertddtfeejnecuhfhrohhmpegjuhhrihcurfgrnhhkohhvuceohihprghnkhhovhesfhgr shhtmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpedvheeihfefhfehleejkeekle ehueehfeekleejgefggffgvdekvdduudefudelveenucfkphepudekkedrudeivddrudei iedruddtjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpeihphgrnhhkohhvsehfrghsthhmrghilhdrtghomh X-ME-Proxy: Received: from [10.0.0.100] (unknown [188.162.166.107]) by mail.messagingengine.com (Postfix) with ESMTPA id D7A0130664F6; Sat, 23 May 2020 07:47:33 -0400 (EDT) Subject: Re: diff(1) -N behaviour - Bug 233402 To: Fehmi Noyan ISI Cc: freebsd-hackers@freebsd.org References: <94a82a22-b5c9-b797-30cc-0242f6da1c8a@fastmail.com> <4ADEBC26-0F93-45C1-B775-E6E33E95FDC1@yahoo.com> From: Yuri Pankov Message-ID: Date: Sat, 23 May 2020 14:47:32 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <4ADEBC26-0F93-45C1-B775-E6E33E95FDC1@yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 49ThRt4jSYz3Zm3 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=fastmail.com header.s=fm3 header.b=UXmY1evM; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=QZ79UinS; dmarc=pass (policy=none) header.from=fastmail.com; spf=pass (mx1.freebsd.org: domain of ypankov@fastmail.com designates 64.147.123.19 as permitted sender) smtp.mailfrom=ypankov@fastmail.com X-Spamd-Result: default: False [-3.45 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.19:c]; FREEMAIL_FROM(0.00)[fastmail.com]; RWL_MAILSPIKE_GOOD(0.00)[64.147.123.19:from]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[fastmail.com:+,messagingengine.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[fastmail.com,none]; NEURAL_HAM_SHORT(-0.32)[-0.318]; FREEMAIL_TO(0.00)[yahoo.com]; RECEIVED_SPAMHAUS_PBL(0.00)[188.162.166.107:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[fastmail.com]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[64.147.123.19:from]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.02)[-1.020]; R_DKIM_ALLOW(-0.20)[fastmail.com:s=fm3,messagingengine.com:s=fm2]; RCVD_TLS_LAST(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.02)[-1.016]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[] 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: Sat, 23 May 2020 11:47:39 -0000 Fehmi Noyan ISI via freebsd-hackers wrote: > > >> On 23/05/2020, at 11:21 PM, Yuri Pankov wrote: >> >> 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’s 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 >> >> I think both descriptions say the same, i.e. "zero size" == "empty”? > > Maybe it’s my interpretation, but if you do not supply the second argument to diff(1), it complains > $ echo “test” > 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 “test” > a.txt > $ diff -N a.txt 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.525932000 +0300 +++ b/foo 1970-01-01 03:00:00.000000000 +0300 @@ -1 +0,0 @@ -bar