2006-09-29 09:54:24 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
# Exercise the Darwin/MacOS bug worked around on 2006-09-29,
|
|
|
|
|
# whereby rm would fail to remove all entries in a directory.
|
|
|
|
|
|
2026-01-01 10:56:16 -08:00
|
|
|
# Copyright (C) 2006-2026 Free Software Foundation, Inc.
|
2006-09-29 09:54:24 +00:00
|
|
|
|
2007-07-23 14:35:58 +02:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2006-09-29 09:54:24 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-23 14:35:58 +02:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
2006-09-29 09:54:24 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2017-09-19 01:13:23 -07:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2006-09-29 09:54:24 +00:00
|
|
|
|
2012-09-02 21:55:12 +02:00
|
|
|
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
2010-11-17 21:35:31 +01:00
|
|
|
print_ver_ rm
|
2006-09-29 09:54:24 +00:00
|
|
|
|
|
|
|
|
# Create a directory containing many files.
|
|
|
|
|
# What counts is a combination of the number of files and
|
|
|
|
|
# the lengths of their names. For details, see
|
2017-11-06 06:26:41 -08:00
|
|
|
# https://lists.gnu.org/r/bug-coreutils/2006-09/msg00326.html
|
2011-08-04 20:52:31 +02:00
|
|
|
mkdir b || framework_failure_
|
|
|
|
|
cd b || framework_failure_
|
2012-04-03 20:32:44 +02:00
|
|
|
for i in $(seq 1 250); do
|
|
|
|
|
touch $(printf %040d $i) || framework_failure_
|
2006-09-29 09:54:24 +00:00
|
|
|
done
|
2011-08-04 20:52:31 +02:00
|
|
|
cd .. || framework_failure_
|
2006-09-29 09:54:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# On a buggy system, this would fail with the diagnostic,
|
2012-01-07 17:47:58 +01:00
|
|
|
# "cannot remove directory 'b': Directory not empty"
|
2006-09-29 09:54:24 +00:00
|
|
|
rm -rf b || fail=1
|
|
|
|
|
|
|
|
|
|
test -d b && fail=1
|
|
|
|
|
|
2008-09-07 10:31:27 +02:00
|
|
|
Exit $fail
|