From: Jim Meyering Date: Sat, 27 Jun 1998 20:33:22 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: FILEUTILS-3_16q~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3e1200b4a0764f5693894433750a93e34a8866e;p=thirdparty%2Fcoreutils.git *** empty log message *** --- diff --git a/tests/cp/same-file b/tests/cp/same-file index 981f0768c7..e8e303214d 100755 --- a/tests/cp/same-file +++ b/tests/cp/same-file @@ -1,4 +1,8 @@ #!/bin/sh +# Test some of cp's options and how cp handles situations in +# which a naive implementation might overwrite the source file. + +: ${CP=cp} LANGUAGE=C; export LANGUAGE LANG=C; export LANG @@ -26,14 +30,18 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2'; do case "$args" in *sl2*) ln -s foo sl2;; esac ( ( - cp $options $args 2>.err + $CP $options $args 2>.err echo $? - test -s .err && echo "[`cat .err`]" + + # Normalize the program name in the error output, + # and put brackets around the output. + test -s .err && echo "[`sed 's/^[^:][^:]*:/cp:/' .err`]" # Strip off all but the file names. ls -lG * | sed 's/^..............................................//' + # Make sure the original is unchanged and that + # the destination is a copy. for f in $args; do if test -f $f; then - # make sure the file was copied. case "`cat $f`" in "$contents") ;; *) echo cp FAILED;;