🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1215

Meaning of `diff - -' ?

#1215
From: Francois Pinard
Date: Fri, 01 Jan 1993 14:18
39 lines
1835 bytes
Hi, people.  This is a followup on my own report:

   This is GNU diff 2.0, installed with GNU C 1.41 under COFF
   encapsulation on a 386/ix 2.0.2 system, waiting for Hurd :-).

   The command `diff - -' exits right away with status 0 without reading
   standard input at all.  By contrast, `diff - /dev/null' reads standard
   input until end of file.

   It is not clear from the documentation what `diff - -' really means.
   I would suggest that this particular case be caught and diagnosed as
   improper usage, and be also documented as such.

Paul Eggert writes to me:

   Why must it be improper?

Standard input is some kind of `volatile' file.  Each time you look at
it, its content may differ.  The same way it would be improper for a C
compiler to optimize out:

	volatile int variable;
	[...]

	if (variable != variable)
	  {
	    /* some code */
	  }

it is improper for diff to optimize out `diff - -'.

But instead of torturing diff into reopening standard input for
getting the second instance of standard input, say, it's better to
leave the behaviour undefined, and implement it as an illegal usage.

-- 
Franc,ois Pinard       ``Happy GNU Year!''      pinard@iro.umontreal.ca
(514) 588-4656                                   ...!uunet!iros1!pinard
About the League for Programming Freedom?  Email me or lpf@uunet.uu.net
Technical Details
Message-ID: <9301011418.AA06496@icule.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!icule.UUCP!pinard
References: <9212302123.AA02072@icule.UUCP>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!icule.UUCP!pinard
From: pinard@icule.UUCP (Francois Pinard)
Subject: Meaning of `diff - -' ?
Message-ID: <9301011418.AA06496@icule.UUCP>
Sender: gnulists@ai.mit.edu
Reply-To: pinard@iro.umontreal.ca
Organization: GNUs Not Usenet
References: <9212302123.AA02072@icule.UUCP>
Distribution: gnu
Date: Fri, 1 Jan 1993 14:18:40 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 40