home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / std_unix / volume.31 / text0083.txt < prev    next >
Encoding:
Text File  |  1993-07-15  |  3.6 KB  |  76 lines

  1. Submitted-by: jazz@hal.com (Jason Zions)
  2.  
  3. Regarding the question of 1003.2 "grep -s" supressing EISDIR for
  4. NFS-accessible directories:
  5.  
  6. NOTE 1
  7. Remember that 1003.2 does *not* assume its pieces are running on a 1003.1-
  8. conforming system. While it's not a bad idea to reason about 1003.2 behavior
  9. from the standpoint of implementations on 1003.1-conforming systems, keep in
  10. mind that such reasoning is not guaranteed to be reflected in the standard.
  11.  
  12. NOTE 2
  13. When reasoning about 1003.1-conforming systems, please remember that a sys-
  14. tem which so much as hints at the existence of files or directories accessed
  15. via NFS is no longer strictly-conforming, since accessing files over NFS
  16. doesn't yield the exact set of semantics required by 1003.1.  If you really
  17. need a strictly-conforming system, don't configure NFS into the kernel.
  18.  
  19. mib@churchy.gnu.ai.mit.edu (Michael I Bushnell) writes:
  20. >>The real lose here (surprise, surprise) is that NFS is the culprit
  21. >>here.  The correct place for the EISDIR to be returned is to the open
  22. >>call, not to the read.  Errors should not be returned from read and
  23. >>write if they can be detected at open time and are thoroughly
  24. >>non-transient.
  25.  
  26. According to 1003.1-1990, EISDIR is only returned when opening a directory
  27. for write or read/write; the standard is silent concerning opening
  28. directories with O_READONLY. It's bad enough that NFS breaks read() (see
  29. below); breaking open() too would have been awful.
  30.  
  31. casper@fwi.uva.nl (Casper H.S. Dik) writes:
  32. >No. NFS is not the culprit. You cannot detect this at open time.
  33. >When you read a directory, you'll open it with open and read it
  34. >with getdents(). When you open a file for reading, you'll use the
  35. >exact same open call. You cannot detect this error at open time.
  36.  
  37. When you read a directory in POSIX, you open it with opendir() and read it
  38. with readdir(). That's it; no open(), no getdents().
  39.  
  40. In this case NFS is indeed the culprit; it breaks the 1003.1 behavior of
  41. allowing an application to read() from a directory. This restriction is
  42. arbitrary; the NFS protocol itself allows it. Making read() fail on
  43. NFS-accessed directories was a tool to catch programs that examined
  44. directories using read() and assuming they knew what the actual structures
  45. in the directory looked like. In a POSIX environment, this restriction is
  46. unnecessary; conforming POSIX applications never try that, using the 1003.1
  47. interfaces instead.
  48.  
  49. In fact, when 1003.8 (POSIX Transparent File Access) sees the light of
  50. publicationand legitimizes NFS under POSIX (so to speak), this restriction
  51. will *have* to go away if one wishes to claim ones implementation conforms
  52. to 1003.8.  Strictly conforming applications don't try to read() directories
  53. with the assumption that they're doing something equivalent to readdir(),
  54. since the standard doesn't say they can; however, a strictly-conforming
  55. application is allowed to read() a directory for any purpose.
  56.  
  57. In any event, I'd suspect that the spirit of 1003.2, interpreted with
  58. respect to a 1003.1 implementation that also supports NFS files, would be
  59. that "-s" would suppress EISDIR on a directory, since those implementations
  60. really do place directories in the category of "You can't read this".
  61.  
  62. However, you should file a Request for Interpretation; contact the IEEE
  63. Standards Department for specific instructions on how to do this. It's a
  64. formal process; until you get an interpretation, anything you hear from
  65. anyone, even the chair or tech editor of 1003.2, is mere opinion.
  66.  
  67. As usual, I am speaking as an individual technical expert, *not* as a
  68. spokesperson for 1003.8, POSIX, PASC, IEEE-CS, IEEE, etc.
  69.  
  70. Jason Zions
  71. Chair, 1003.8 POSIX Transparent File Access
  72.  
  73.  
  74. Volume-Number: Volume 31, Number 85
  75.  
  76.