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