home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / utils / bug / 2020 < prev    next >
Encoding:
Text File  |  1992-11-08  |  3.7 KB  |  106 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!runx.oz.AU!bde
  3. From: bde@runx.oz.AU (Bruce Evans)
  4. Subject: du in fileutils-3.4 is confused by bad file system
  5. Message-ID: <1992Nov8.153611.26442@runx.oz.au>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: RUNX Un*x Timeshare.  Sydney, Australia.
  8. Distribution: gnu
  9. Date: Sun, 8 Nov 1992 15:36:11 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 93
  12.  
  13. du in fileutils-3.4 does not check the value returned by some chdir system
  14. calls.  This leads to irrelevant error messages when chdir("..") fails due
  15. to a missing `..' entry.  There is no point in continuing, but du continues
  16. and prints messages about directories that have become inaccessible.
  17.  
  18. du could continue if it avoided descending into directories which have no
  19. `..' entry, but I don't think that's worth doing.  My fix justs adds some
  20. error checking and reporting.  The error reports could be improved.  They
  21. are now as follows.  (1) When the directory z is missing `..' but contains
  22. `.':
  23.  
  24.     du: cannot change to `..' from directory ./z/: No such file or directory
  25.  
  26. It would be better to print `./z'.  (2)  When the directory z is missing
  27. both `.' and `..':
  28.  
  29.     du: ./z: No such file or directory
  30.     du: cannot change to `..' from directory ./z: No such file or directory
  31.  
  32. The first line has to do with `./z/.' being missing and is very misleading
  33. (the error is detected at a lower level and the higher level doesn't
  34. really know which path caused the problem).  The second line is OK except
  35. ./z should probably be quoted.
  36.  
  37. The diff below contains some other minor fixes for fileutils-3.4.
  38.  
  39. In eaccess.c, #undef NGROUPS_MAX in case it is being redefined.
  40. In eaccess.c, NGROUPS_MAX has type long if it has been defined using sysconf,
  41. and otherwise it has an unknown (?) integral type, so it may have too large
  42. a type for calling xmalloc and/or getgroups.
  43.  
  44. diff -Nrc2 fileutils-3.4/lib/eaccess.c fileu/lib/eaccess.c
  45. *** fileutils-3.4/lib/eaccess.c    Fri Sep 11 09:46:21 1992
  46. --- fileu/lib/eaccess.c    Fri Nov  6 20:28:46 1992
  47. ***************
  48. *** 28,31 ****
  49. --- 28,32 ----
  50.   #include <limits.h>
  51.   #if !defined(NGROUPS_MAX) || NGROUPS_MAX < 1
  52. + #undef NGROUPS_MAX
  53.   #define NGROUPS_MAX sysconf (_SC_NGROUPS_MAX)
  54.   #endif /* NGROUPS_MAX */
  55. ***************
  56. *** 129,134 ****
  57.         egid = getegid ();
  58.   #ifdef NGROUPS_MAX
  59. !       groups = (GETGROUPS_T *) xmalloc (NGROUPS_MAX * sizeof (GETGROUPS_T));
  60. !       ngroups = getgroups (NGROUPS_MAX, groups);
  61.   #endif
  62.       }
  63. --- 130,136 ----
  64.         egid = getegid ();
  65.   #ifdef NGROUPS_MAX
  66. !       groups = (GETGROUPS_T *)
  67. !            xmalloc ((unsigned) (NGROUPS_MAX * sizeof (GETGROUPS_T)));
  68. !       ngroups = getgroups ((int) NGROUPS_MAX, groups);
  69.   #endif
  70.       }
  71. diff -Nrc2 fileutils-3.4/src/du.c fileu/src/du.c
  72. *** fileutils-3.4/src/du.c    Fri May  1 03:55:02 1992
  73. --- fileu/src/du.c    Fri Nov  6 20:53:25 1992
  74. ***************
  75. *** 401,405 ****
  76.           {
  77.             error (0, errno, "%s", path->text);
  78. !           chdir ("..");    /* Try to return to previous directory.  */
  79.             exit_status = 1;
  80.             return 0;
  81. --- 401,407 ----
  82.           {
  83.             error (0, errno, "%s", path->text);
  84. !           if (chdir (".."))    /* Try to return to previous directory.  */
  85. !         error (1, errno, "cannot change to `..' from directory %s",
  86. !                path->text);
  87.             exit_status = 1;
  88.             return 0;
  89. ***************
  90. *** 425,429 ****
  91.       }
  92.         free (name_space);
  93. !       chdir ("..");
  94.   
  95.         str_trunc (path, pathlen - 1); /* Remove the "/" we added.  */
  96. --- 427,432 ----
  97.       }
  98.         free (name_space);
  99. !       if (chdir ("..") < 0)
  100. !         error (1, errno, "cannot change to `..' from directory %s", path->text);
  101.   
  102.         str_trunc (path, pathlen - 1); /* Remove the "/" we added.  */
  103. -- 
  104. Bruce Evans  (bde@runx.oz.au)
  105.  
  106.