bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mv --reply=no doesn't work as documented


From: Jan Ove Haaland
Subject: mv --reply=no doesn't work as documented
Date: Mon, 8 Dec 2003 00:08:01 +0100 (CET)

Example: 

echo a > 2; 
echo b > 3;
mv --reply=no 2 3; 

will overwrite 3 instead of aborting move operation. 


Problem: 
In copy.c:932
                  if ((x->interactive == I_ALWAYS_NO
                       && UNWRITABLE (dst_path, dst_sb.st_mode))
                      || ((x->interactive == I_ASK_USER
                           || (x->interactive == I_UNSPECIFIED
                               && x->stdin_tty
                               && UNWRITABLE (dst_path, dst_sb.st_mode)))
                          && (overwrite_prompt (dst_path, &dst_sb), 1)
                          && ! yesno ())) 


UNWRITABLE (dst_path, dst_sb.st_mode) returns false, rendering 
x->interactive == I_ALWAYS_NO irrelevant.


Solution:
Remove the offending expression and it works as documented.

                  if (x->interactive == I_ALWAYS_NO
                      || ((x->interactive == I_ASK_USER
                           || (x->interactive == I_UNSPECIFIED
                               && x->stdin_tty
                               && UNWRITABLE (dst_path, dst_sb.st_mode)))
                          && (overwrite_prompt (dst_path, &dst_sb), 1)
                          && ! yesno ())) 



Jan Ove Haaland






reply via email to

[Prev in Thread] Current Thread [Next in Thread]