diff options
author | Jim Meyering <jim@meyering.net> | 2007-07-19 10:14:41 +0200 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-07-19 10:14:41 +0200 |
commit | 7465b002f9c8850a279568f832ff238ad5ba1476 (patch) | |
tree | 05022a53f7aecb02488253491003dd605829fbbb /tests | |
parent | 8062509aa78d50e071eb95ec8a5dae88fbc00263 (diff) | |
download | coreutils-7465b002f9c8850a279568f832ff238ad5ba1476.tar.xz |
"cp -i --update older newer" no longer prompts; same for mv
* src/copy.c (copy_internal): Perform "update" check before the
possible interactive prompt. Reported by zeno_AT_biyg_DOT_org
in <http://bugzilla.redhat.com/248591>
* tests/mv/update: Add tests for the above.
* NEWS: Mention the bug fix.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/mv/update | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/mv/update b/tests/mv/update index 0c0602414..6c3d14983 100755 --- a/tests/mv/update +++ b/tests/mv/update @@ -1,7 +1,7 @@ #!/bin/sh # make sure --update works as advertised -# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001, 2004, 2006-2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,11 +46,16 @@ fi fail=0 -for cp_or_mv in cp mv; do - # This is a no-op. - $cp_or_mv --update old new || fail=1 - case "`cat new`" in new) ;; *) fail=1 ;; esac - case "`cat old`" in old) ;; *) fail=1 ;; esac +for interactive in '' -i; do + for cp_or_mv in cp mv; do + # This is a no-op, with no prompt. + # With coreutils-6.9 and earlier, using --update with -i would + # mistakenly elicit a prompt. + $cp_or_mv $interactive --update old new < /dev/null > out 2>&1 || fail=1 + test -s out && fail=1 + case "`cat new`" in new) ;; *) fail=1 ;; esac + case "`cat old`" in old) ;; *) fail=1 ;; esac + done done # This will actually perform the rename. |