[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#29961: [PATCH] mv: document the missing atomicity of 'mv -n'
From: |
Pádraig Brady |
Subject: |
bug#29961: [PATCH] mv: document the missing atomicity of 'mv -n' |
Date: |
Wed, 3 Jan 2018 15:08:51 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 03/01/18 15:01, Kamil Dudka wrote:
> * 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
> address@hidden 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\
Eep, Seems like we should use RENAME_NOREPLACE in this case,
rather than document the caveat?
This is already used in shred.
cheers,
Pádraig
- bug#29961: [PATCH] mv: document the missing atomicity of 'mv -n', Kamil Dudka, 2018/01/03
- bug#29961: [PATCH] mv: document the missing atomicity of 'mv -n',
Pádraig Brady <=
- bug#29961: [PATCH] mv: document the missing atomicity of 'mv -n', Kamil Dudka, 2018/01/03
- bug#29961: [PATCH] mv -n: do not overwrite the destination, Kamil Dudka, 2018/01/04
- bug#29961: [PATCH] mv -n: do not overwrite the destination, Paul Eggert, 2018/01/04
- bug#29961: [PATCH] mv -n: do not overwrite the destination, Kamil Dudka, 2018/01/04
- bug#29961: [PATCH] mv -n: do not overwrite the destination, Paul Eggert, 2018/01/04
- bug#29961: [PATCH] mv -n: do not overwrite the destination, Kamil Dudka, 2018/01/05
- bug#29961: [PATCH] mv -n: do not overwrite the destination, Pádraig Brady, 2018/01/05
- bug#29961: [PATCH] mv -n: do not overwrite the destination, Kamil Dudka, 2018/01/05
- bug#29961: [PATCH] mv -n: do not overwrite the destination, Paul Eggert, 2018/01/05