From: Jim Meyering Date: Sat, 15 Sep 2001 17:07:54 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: TEXTUTILS-2_0_15~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7161f22f6d9462195bb3d379fb9489c2c05f9452;p=thirdparty%2Fcoreutils.git *** empty log message *** --- diff --git a/old/fileutils/ChangeLog b/old/fileutils/ChangeLog index f210c74d2a..a1aa0eb9e2 100644 --- a/old/fileutils/ChangeLog +++ b/old/fileutils/ChangeLog @@ -1,5 +1,11 @@ 2001-09-15 Jim Meyering + * src/touch.c (EISDIR): Define to 0, if not already defined. + (touch): Give a better diagnostic for e.g., `touch /' by non-root. + Based on a patch from Michael Stone. + Reported by Jeff Sheinberg as Debian bug #101677. + * tests/touch/fail-diag: New test, for the above fix. + * src/copy.c (copy_internal) [move_mode]: Support the new --reply=... option. (UNWRITABLE): Define (factored out of copy_internal). diff --git a/tests/touch/fail-diag b/tests/touch/fail-diag new file mode 100755 index 0000000000..f1fd037b69 --- /dev/null +++ b/tests/touch/fail-diag @@ -0,0 +1,44 @@ +#!/bin/sh +# make sure touch gives reasonable diagnostics + +if test "$VERBOSE" = yes; then + set -x + touch --version +fi + +. $srcdir/../envvar-check +. $srcdir/../lang-default +PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check + +pwd=`pwd` +tmp=fail-diag.$$ +trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0 +trap '(exit $?); exit' 1 2 13 15 + +framework_failure=0 +mkdir $tmp || framework_failure=1 +cd $tmp || framework_failure=1 + +if test $framework_failure = 1; then + echo 'failure in testing framework' 1>&2 + (exit 1); exit +fi + +fail=0 + +# Before fileutils-4.1, we'd get the following misleading +# diagnostic instead of `Permission denied'. +# touch: creating `/': Is a directory +touch / > out 2>&1 && fail=1 + +touch /no/such-dir >> out 2>&1 && fail=1 + +cat > exp <<\EOF +touch: setting times of `/': Permission denied +touch: creating `/no/such-dir': No such file or directory +EOF + +cmp out exp || fail=1 +test $fail = 1 && diff out exp 2> /dev/null + +(exit $fail); exit