diff options
Diffstat (limited to 'tests/cp/thru-dangling')
-rwxr-xr-x | tests/cp/thru-dangling | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/cp/thru-dangling b/tests/cp/thru-dangling index 0503af943..0256a167c 100755 --- a/tests/cp/thru-dangling +++ b/tests/cp/thru-dangling @@ -1,5 +1,5 @@ #!/bin/sh -# Ensure that cp works when the destination is a dangling symlink +# Ensure that cp works as documented, when the destination is a dangling symlink # Copyright (C) 2007 Free Software Foundation, Inc. @@ -26,10 +26,19 @@ fi ln -s no-such dangle || framework_failure echo hi > f || framework_failure echo hi > exp || framework_failure +echo "cp: not writing through dangling symlink \`dangle'" \ + > exp-err || framework_failure fail=0 -cp f dangle > out 2>&1 || fail=1 +# Starting with 6.9.90, this usage fails, by default: +cp f dangle > err 2>&1 && fail=1 + +compare err exp-err || fail=1 +test -f no-such && fail=1 + +# But you can set POSIXLY_CORRECT to get the historical behavior. +POSIXLY_CORRECT=1 cp f dangle > out 2>&1 || fail=1 cat no-such >> out || fail=1 compare out exp || fail=1 |