diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2007-03-16 21:41:50 +0100 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-03-16 21:41:50 +0100 |
commit | 369aaf7e5dcabf995683eea9a3a1e497ade9cd12 (patch) | |
tree | 0e0bd52515194d06487acb8b6e25331011a53c3f | |
parent | 39e85b7258340611a77a70e2ad46184f1081bbdf (diff) | |
download | coreutils-369aaf7e5dcabf995683eea9a3a1e497ade9cd12.tar.xz |
* src/copy.c: Include filemode.h.
(overwrite_prompt): Say "try to overwrite", not "overwrite", to
make it clearer that the attempt may fail. Problem reported by
Dan Jacobson in:
http://lists.gnu.org/archive/html/bug-coreutils/2007-03/msg00130.html
Output symbolic mode as well as numeric.
* tests/mv/i-2 (fail): Adjust to new prompt format.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | src/copy.c | 9 | ||||
-rwxr-xr-x | tests/mv/i-2 | 4 |
3 files changed, 19 insertions, 4 deletions
@@ -1,3 +1,13 @@ +2007-03-16 Paul Eggert <eggert@cs.ucla.edu> + + * src/copy.c: Include filemode.h. + (overwrite_prompt): Say "try to overwrite", not "overwrite", to + make it clearer that the attempt may fail. Problem reported by + Dan Jacobson in: + http://lists.gnu.org/archive/html/bug-coreutils/2007-03/msg00130.html + Output symbolic mode as well as numeric. + * tests/mv/i-2 (fail): Adjust to new prompt format. + 2007-03-15 Jim Meyering <jim@meyering.net> Enforce policy: don't use *scanf functions. diff --git a/src/copy.c b/src/copy.c index 49bbb8ce4..4bdb75cbb 100644 --- a/src/copy.c +++ b/src/copy.c @@ -38,6 +38,7 @@ #include "euidaccess.h" #include "error.h" #include "fcntl--.h" +#include "filemode.h" #include "filenamecat.h" #include "full-write.h" #include "getpagesize.h" @@ -797,10 +798,14 @@ overwrite_prompt (char const *dst_name, struct stat const *dst_sb) { if (euidaccess (dst_name, W_OK) != 0) { + char perms[12]; /* "-rwxrwxrwx " ls-style modes. */ + strmode (dst_sb->st_mode, perms); + perms[10] = '\0'; fprintf (stderr, - _("%s: overwrite %s, overriding mode %04lo? "), + _("%s: try to overwrite %s, overriding mode %04lo (%s)? "), program_name, quote (dst_name), - (unsigned long int) (dst_sb->st_mode & CHMOD_MODE_BITS)); + (unsigned long int) (dst_sb->st_mode & CHMOD_MODE_BITS), + &perms[1]); } else { diff --git a/tests/mv/i-2 b/tests/mv/i-2 index ae7c5a135..36d1ce474 100755 --- a/tests/mv/i-2 +++ b/tests/mv/i-2 @@ -2,7 +2,7 @@ # Test both cp and mv for their behavior with -if and -fi # The standards (POSIX and SuS) dictate annoyingly inconsistent behavior. -# Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 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 @@ -61,7 +61,7 @@ cp -if e f < y > out 2>&1 || fail=1 # Make sure out contains the prompt. case "`cat out`" in - "cp: overwrite \`f', overriding mode 0000?"*) ;; + "cp: try to overwrite \`f', overriding mode 0000 (---------)?"*) ;; *) fail=1 ;; esac |