2 # Exercise mv's file-descriptor-leak bug, reported against coreutils-5.2.1
3 # and fixed (properly) on 2004-10-21.
5 # Copyright (C) 2004, 2006 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 # This test is relatively expensive, and might well evoke a
24 # framework-failure on systems with a smaller command-line length
25 # limit so don't run it by default.
26 . $srcdir/../expensive
28 if test "$VERBOSE" = yes; then
33 . $srcdir/../other-fs-tmpdir
34 . $srcdir/../envvar-check
35 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
38 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
39 trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
40 trap '(exit $?); exit $?' 1 2 13 15
42 if test -z "$other_partition_tmpdir"; then
45 t0="$t0 $other_partition_tmpdir"
48 mkdir -p $tmp || framework_failure=1
49 cd $tmp || framework_failure=1
51 b="0 1 2 3 4 5 6 7 8 9
52 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 z
53 _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 _Z"
55 for i in `echo $b`; do
61 mkdir `cat .dirs` || framework_failure=1
62 sed 's,$,/f,' .dirs | xargs touch
64 last_file=`tail -n1 .dirs`/f
65 test -f $last_file || framework_failure=1
67 if test $framework_failure = 1; then
68 echo "$0: failure in testing framework" 1>&2
74 mv * $other_partition_tmpdir || fail=1
75 test -f $last_file/f && fail=1
78 ls -A > ../out || fail=1
79 test -s ../out && fail=1
81 (exit $fail); exit $fail