bug-coreutils
[Top][All Lists]
Advanced

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

Re: cp --archive with special files


From: Mike Frysinger
Subject: Re: cp --archive with special files
Date: Thu, 5 Jul 2007 14:24:06 -0400
User-agent: KMail/1.9.7

On Monday 02 July 2007, Jim Meyering wrote:
> Mike Frysinger <address@hidden> wrote:
> > # mkdir src dst
> > # touch dst/null
> > # mknod src/null c 1 3
> > # cp -a src/* dst/
> > cp: cannot create special file `d/null': File exists
> > # cp -a s/null d/null -f
> > cp: cannot create special file `d/null': File exists
> > # ls -l d/null
> > -rw-r--r-- 1 root root 0 2007-06-28 05:41 d/null
>
> Hmm... looks like you mixed up your examples: you create src and dst,
> but operate on "s" and "d"...  But I get the point.

yeah, sorry about that ... too many open terminals

> > i think in the case where cp encounters the destination as being a
> > regular file and the source as being a special file, it should simply
> > unlink the destination and create the destination the same as if it didnt
> > exist in the first place
>
> The spec seems to require the current behavior:
> [see 4b and the description of -f.
>  Note that -a isn't standard, but presume -pR, which are]:
>
>     http://www.opengroup.org/susv3xcu/cp.html
>
> While it's not entirely clear what must happen when failing to create
> a special destination file that is not a symlink or fifo, I think the
> intent is clear -- and it doesn't permit removing the destination.
>
> Also, -f applies only to regular files.
>
> If you can depend on GNU cp, use --remove-destination instead of -f.
> That will make cp do what you want.

flipping through the spec i'd have to agree with your assessment ... thanks
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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