findutils-4.6.0-gnulib-S_MAGIC_NFS.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 85717b68b03bf85016c5079fbbf0c8aa2b182ba6 Mon Sep 17 00:00:00 2001
  2. From: Pádraig Brady <P@draigBrady.com>
  3. Date: Mon, 18 Jan 2016 17:29:28 +0000
  4. Subject: fts: don't unconditionally use leaf optimization for NFS
  5. NFS st_nlink are not accurate on all implementations,
  6. leading to aborts() if that assumption is made.
  7. See <https://bugzilla.redhat.com/1299169>
  8. * lib/fts.c (leaf_optimization_applies): Remove NFS from
  9. the white list, and document the issue.
  10. ---
  11. (limited to 'lib/fts.c')
  12. diff --git a/lib/fts.c b/lib/fts.c
  13. index 7e9aca6..2c9df2f 100644
  14. --- a/gl/lib/fts.c
  15. +++ b/gl/lib/fts.c
  16. @@ -718,22 +718,23 @@ leaf_optimization_applies (int dir_fd)
  17. switch (fs_buf.f_type)
  18. {
  19. - case S_MAGIC_NFS:
  20. - /* NFS provides usable dirent.d_type but not necessarily for all entries
  21. - of large directories. See <https://bugzilla.redhat.com/1252549>. */
  22. - return true;
  23. -
  24. /* List here the file system types that lack usable dirent.d_type
  25. info, yet for which the optimization does apply. */
  26. case S_MAGIC_REISERFS:
  27. case S_MAGIC_XFS:
  28. return true;
  29. + /* Explicitly list here any other file system type for which the
  30. + optimization is not applicable, but need documentation. */
  31. + case S_MAGIC_NFS:
  32. + /* NFS provides usable dirent.d_type but not necessarily for all entries
  33. + of large directories, so as per <https://bugzilla.redhat.com/1252549>
  34. + NFS should return true. However st_nlink values are not accurate on
  35. + all implementations as per <https://bugzilla.redhat.com/1299169>. */
  36. + /* fall through */
  37. case S_MAGIC_PROC:
  38. - /* Explicitly listing this or any other file system type for which
  39. - the optimization is not applicable is not necessary, but we leave
  40. - it here to document the risk. Per http://bugs.debian.org/143111,
  41. - /proc may have bogus stat.st_nlink values. */
  42. + /* Per <http://bugs.debian.org/143111> /proc may have
  43. + bogus stat.st_nlink values. */
  44. /* fall through */
  45. default:
  46. return false;
  47. --
  48. cgit v0.9.0.2