r-3.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # Create and remove a directory with more than 254 files.
  3. # Copyright (C) 1997-2018 Free Software Foundation, Inc.
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. # An early version of my rewritten rm failed to remove all of
  15. # the files on SunOS4 when there were 254 or more in a directory.
  16. # And the rm from coreutils-5.0 exposes the same problem when there
  17. # are 338 or more files in a directory on a Darwin-6.5 system
  18. . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
  19. print_ver_ rm
  20. mkdir t || framework_failure_
  21. cd t || framework_failure_
  22. # Create 500 files (20 * 25).
  23. for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j; do
  24. files=
  25. for j in a b c d e f g h i j k l m n o p q r s t u v w x y; do
  26. files="$files $i$j"
  27. done
  28. touch $files || framework_failure_
  29. done
  30. test -f 0a || framework_failure_
  31. test -f by || framework_failure_
  32. cd .. || framework_failure_
  33. rm -rf t || fail=1
  34. test -d t && fail=1
  35. Exit $fail