home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.23 / text0030.txt < prev    next >
Encoding:
Text File  |  1991-06-15  |  2.3 KB  |  56 lines

  1. Submitted-by: lewine@cheshirecat.webo.dg.com (Donald Lewine)
  2.  
  3. In article <129356@uunet.UU.NET>, karish@mindcraft.com (Chuck Karish) writes:
  4. |> The C committee was trying to make it possible to write portable
  5. |> programs, not to constrain what must be present on your system.
  6. |> They were doomed to failure in an environment as complex as POSIX.
  7. |> That's why we have pathconf().  It's still reasonable to let the
  8. |> programmer know whether it's necessary to provide 13 characters
  9. |> or 256 or 1024 to hold a filename.
  10. |> 
  11.  
  12. Yes, it is very reasonable to let the programmer know whether it is
  13. necessary to 13 or 1024 characters to hold a pathname.  Alas, POSIX
  14. does not do it!  The symbols PATH_MAX and the values returned by
  15. pathconf() are pretty useless.  
  16.  
  17. The standard says that PATH_MAX is "Maximum number of bytes in a
  18. pathname" (Table 2-5).  That statement is misleading, if not a 
  19. complete lie.  PATH_MAX is the longest pathname an application is
  20. guaranteed to be able to create.  Most applications do not care 
  21. about the longest pathname the are guaranteed to be able to create.
  22. They need to know the longest pathname that will be encoundered.
  23.  
  24. In other words, how much storage should be allocated for the user's
  25. response to a "File: " prompt.  Or, how large should the buffer be
  26. for getcwd().  Or, what is the longest path a file tree walk will
  27. encounter.  _POSIX_PATH_MAX, PATH_MAX and pathconf() do not give
  28. any insight into those questions.
  29.  
  30. Since most systems define PATH_MAX to be a large number, applications
  31. that use PATH_MAX to allocate buffers for getcwd() or user-supplied
  32. pathnames tend to work.  The standard does not guarantee that they
  33. will work.
  34.  
  35. In fact, even in their intended role, these symbols are not much
  36. use.  I can always try to open() a file and see what error code
  37. comes back.
  38.  
  39. In short, the only practical value is _POSIX_PATH_MAX is to force
  40. implementers to allow 256 character pathnames on all systems.  It
  41. has no value to application programmers.
  42.  
  43. --------------------------------------------------------------------
  44. Donald A. Lewine                (508) 870-9008 Voice
  45. Data General Corporation        (508) 366-0750 FAX
  46. 4400 Computer Drive. MS D112A
  47. Westboro, MA 01580  U.S.A.
  48.  
  49. uucp: uunet!dg!lewine   Internet: lewine@cheshirecat.webo.dg.com
  50.  
  51.  
  52. Volume-Number: Volume 23, Number 34
  53.  
  54.  
  55.  
  56.