home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / utils / bug / 2304 < prev    next >
Encoding:
Text File  |  1993-01-01  |  1.7 KB  |  55 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!icule.UUCP!pinard
  3. From: pinard@icule.UUCP (Francois Pinard)
  4. Subject: Meaning of `diff - -' ?
  5. Message-ID: <9301011418.AA06496@icule.UUCP>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: pinard@iro.umontreal.ca
  8. Organization: GNUs Not Usenet
  9. References: <9212302123.AA02072@icule.UUCP>
  10. Distribution: gnu
  11. Date: Fri, 1 Jan 1993 14:18:40 GMT
  12. Approved: bug-gnu-utils@prep.ai.mit.edu
  13. Lines: 40
  14.  
  15. Hi, people.  This is a followup on my own report:
  16.  
  17.    This is GNU diff 2.0, installed with GNU C 1.41 under COFF
  18.    encapsulation on a 386/ix 2.0.2 system, waiting for Hurd :-).
  19.  
  20.    The command `diff - -' exits right away with status 0 without reading
  21.    standard input at all.  By contrast, `diff - /dev/null' reads standard
  22.    input until end of file.
  23.  
  24.    It is not clear from the documentation what `diff - -' really means.
  25.    I would suggest that this particular case be caught and diagnosed as
  26.    improper usage, and be also documented as such.
  27.  
  28. Paul Eggert writes to me:
  29.  
  30.    Why must it be improper?
  31.  
  32. Standard input is some kind of `volatile' file.  Each time you look at
  33. it, its content may differ.  The same way it would be improper for a C
  34. compiler to optimize out:
  35.  
  36.     volatile int variable;
  37.     [...]
  38.  
  39.     if (variable != variable)
  40.       {
  41.         /* some code */
  42.       }
  43.  
  44. it is improper for diff to optimize out `diff - -'.
  45.  
  46. But instead of torturing diff into reopening standard input for
  47. getting the second instance of standard input, say, it's better to
  48. leave the behaviour undefined, and implement it as an illegal usage.
  49.  
  50. -- 
  51. Franc,ois Pinard       ``Happy GNU Year!''      pinard@iro.umontreal.ca
  52. (514) 588-4656                                   ...!uunet!iros1!pinard
  53. About the League for Programming Freedom?  Email me or lpf@uunet.uu.net
  54.  
  55.