bug-coreutils
[Top][All Lists]
Advanced

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

Re: cp/mv: add -n option to not overwrite target (Ubuntu bug #229182 )


From: Kamil Dudka
Subject: Re: cp/mv: add -n option to not overwrite target (Ubuntu bug #229182 )
Date: Tue, 6 Jan 2009 12:29:22 +0100
User-agent: KMail/1.9.6 (enterprise 0.20071012.724442)

Thanks for review.

On Tuesday 23 December 2008 01:37:54 Pádraig Brady wrote:
> For my own reference this is how I now see
> the overwrite characteristics of cp & mv:
>
> cp : default overwrite method = truncate only (file must be writable)
>   -f overwrite method = truncate falling back to unlink+create
>      (redundant if the -n option is used)
>   --remove-destination
>      overwrite method = unlink+create
>      (redundant if the -n option is used)
Should I mention this in documentation and/or help?

>   -i prompt before trying to overwrite dest
>      (overrides any preceeding -n option)
>   -n never overwrite
>      (overrides any preceeding -i option)
>
> mv : prompt to overwrite if dest not writable
>   -f never prompt before overwriting
>      (overrides any preceeding -i or -n options)
>   -i always prompt before overwriting
>      (overrides any preceeding -f or -n options)
>   -n never overwrite
>      (overrides any preceeding -f or -i options)
So in the case of mv there is no violation with FreeBSD implementation, nor 
POSIX.

> p.s. According to the FreeBSD manpages referenced in this thread,
> cp -f in FreeBSD doesn't conform to POSIX, and instead
> means as I originally thought: "try best to overwrite _and don't prompt_."
> I.E. it overrides any preceeding -i or -n options.
Yes, the behavior of FreeBSD cp -f option differs from POSIX and this patch.

Up to date version of the patch is attached.


Kamil

Attachment: 0001-cp-mv-add-n-option-to-not-overwrite-target.patch
Description: Text Data


reply via email to

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