GNU bug report logs - #29961
[PATCH] mv: document the missing atomicity of 'mv -n'

Previous Next

Package: coreutils;

Reported by: Kamil Dudka <kdudka <at> redhat.com>

Date: Wed, 3 Jan 2018 15:03:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#29961: closed ([PATCH] mv: document the missing atomicity of
 'mv -n')
Date: Wed, 10 Jan 2018 08:54:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 10 Jan 2018 00:53:07 -0800
with message-id <c274f30d-d6d3-2946-94ce-223aebfba2ea <at> cs.ucla.edu>
and subject line Re: bug#29961: [PATCH] mv -n: do not overwrite the destination
has caused the debbugs.gnu.org bug report #29961,
regarding [PATCH] mv: document the missing atomicity of 'mv -n'
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
29961: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29961
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Kamil Dudka <kdudka <at> redhat.com>
To: bug-coreutils <at> gnu.org
Subject: [PATCH] mv: document the missing atomicity of 'mv -n'
Date: Wed,  3 Jan 2018 16:01:47 +0100
* src/mv.c (usage): Add note about the missing atomicity of 'mv -n'.
* doc/coreutils.texi (mv invocation): Likewise.
---
 doc/coreutils.texi | 3 +++
 src/mv.c           | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 3fa083085..e7ca6a737 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -9660,6 +9660,9 @@ If the response is not affirmative, the file is skipped.
 Do not overwrite an existing file.
 @mvOptsIfn
 This option is mutually exclusive with @option{-b} or @option{--backup} option.
+Note that the operation is not atomic.  If @var{dest} appears after
+@command{mv} has checked its non-existence, it can be overwritten despite
+the @option{-n} option is used.
 
 @item -u
 @itemx --update
diff --git a/src/mv.c b/src/mv.c
index a8df730a7..a08e75649 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -306,6 +306,8 @@ Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\
   -i, --interactive            prompt before overwrite\n\
   -n, --no-clobber             do not overwrite an existing file\n\
 If you specify more than one of -i, -f, -n, only the final one takes effect.\n\
+NOTE: The operation is not atomic.  If DEST appears after mv has checked its\n\
+non-existence, it can be overwritten despite the -n option is used.\n\
 "), stdout);
       fputs (_("\
       --strip-trailing-slashes  remove any trailing slashes from each SOURCE\n\
-- 
2.13.6



[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pádraig Brady <P <at> draigBrady.com>,
 Kamil Dudka <kdudka <at> redhat.com>
Cc: 29961-done <at> debbugs.gnu.org
Subject: Re: bug#29961: [PATCH] mv -n: do not overwrite the destination
Date: Wed, 10 Jan 2018 00:53:07 -0800
No further comment, so I installed the proposed patches and I'm closing this bug 
report.


This bug report was last modified 7 years and 139 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.