tag 274705 + patch
thanks

So the relevant code seems to be in src/copy.c, where it checks if
"--reply=no" was set _and_ the file isn't overwritable; or if "-i" was
set, or if no option was given and the file isn't overwritable. So
"--reply=no" has an effect when you do:

        touch a b
        chmod 000 b
        mv --reply=no a b  # can't overwrite, so do nothing

This seems quite deliberate, but afaics it's a bug. I think the attached
patch fixes the problem.

Cheers,
aj
--- coreutils-5.2.1/src/copy.c.orig     2005-08-20 16:26:04.950327240 +1000
+++ coreutils-5.2.1/src/copy.c  2005-08-20 16:26:18.483269920 +1000
@@ -946,8 +946,7 @@
              /* cp and mv treat -i and -f differently.  */
              if (x->move_mode)
                {
-                 if ((x->interactive == I_ALWAYS_NO
-                      && UNWRITABLE (dst_path, dst_sb.st_mode))
+                 if ((x->interactive == I_ALWAYS_NO)
                      || ((x->interactive == I_ASK_USER
                           || (x->interactive == I_UNSPECIFIED
                               && x->stdin_tty

Reply via email to