bug-coreutils
[Top][All Lists]
Advanced

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

Re: cp --sparse might corrupt DEST


From: Szakacsits Szabolcs
Subject: Re: cp --sparse might corrupt DEST
Date: Mon, 8 Mar 2004 01:08:00 +0100 (MET)

On Mon, 8 Mar 2004, Jim Meyering wrote:

> Did you actually run a command like this?
> 
>   cp --sparse=always sparse-image-file.img /dev/hda1

Yes and no. I thought this is impossible earlier (I remembered I tried it
once) but Pelle suggested it can be done and I tested it on a loop device.
It indeed worked, I mean the file was incorrectly copied.
 
> Did it produce any diagnostic?  On what OS?

AFAIR Linux 2.4.latest (when I sent my report).

> I did the following on a linux-2.6.2 system:
> 
>   # dd bs=1 seek=100k of=a < /dev/null
>   # cp --sparse=always a /dev/fd0
>   cp: writing `/dev/fd0': Invalid argument
>   [Exit 1]
> 
> The diagnostic was due to a failing ftruncate.

Yes, this is what should happen as I remembered. But because I don't have
floppy drives anymore, test partitions, etc I tried loop device. It worked
so I thought I remembered wrong.

On the other hand, I also remember a bunch of 'cp something /dev/fd0'
instructions from many documents and if you search the net you can also
find them.

But I also remember, I never liked cp to a device because I've found it
unreliable in general (I blamed bad floppies). This sparse issue could
explain it (autodetect).

Also, if the length of the SOURCE was the same as the device size then
perhaps no ftruncate ...

Sorry I don't know cp's history.

        Szaka





reply via email to

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