🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Francois Pinard Wed, 30 Dec 1992 21:23
Meaning of `diff - -' ?
#1186
Author: Francois Pinard
Date: Wed, 30 Dec 1992 21:23
15 lines
1169 bytes
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.

-- 
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
Meaning of `diff - -' ?
#1215
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads