I am sending this answer to the list again, because it was my initial
mistake that I sent the first copy of my last message to your address
instead of to the list.

Sorry, Denys, I was never talking about the scenario you are mentioning,
really just about overwriting an existing character device by a regular
file, so it gets its contents. No more, no less. And I still insist that
it is fair to expect that this will work. I am not talking about copying
a device onto something else and not about copying recursively either.
Only this:

cp /regular/file /character/device

Without unlinking the device before copying the source file into it. It
is so straightforward it almost hurts. ;-) Why on earth should this not
work by default (without tweaking the source code)?


Denys Vlasenko:
> On Tuesday 11 September 2007 18:12, Alexander Kriegisch wrote:
>>> I'm not sure there are users which really need
>>> "cp -r dir1 dir2" to follow pre-existing dir2/dir1/xxx
>>> symlinks.
>> I am not, either. I just need regular files overwriting devices by not
>> unlinking them first (resulting in them being gone and recreated in a
>> wrong fashion), because it is what can be expected not only by
>> Coreutils, but also by BusyBox. Be it with or without a switch, to me it
>> seems this should be default behaviour. There is just no point in
>> replacing a device by a regular file.
> 
> When you do recursive directory copy, you obviously
> want to have *a copy of the directory*, not anything else.
> 
> Just think for a second what "cp -r /a/dev /" can do
> if you have /a/dev/hda.
> 
> I was burned by it more than once, when I have several trees
> of symlinks to files, and I accidentally modify original file
> because cp "writes through the symlink" instead of replacing it.
> Not as tragic as catting a file into /dev/hda,
> but still annoying.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to