Peter Cordes <[EMAIL PROTECTED]> wrote:
>  Note that the ftruncate man page says ftruncate can fail (when called to
> extend a file) on filesystems like VFAT.  I don't know if vfat even supports
> sparse files, but you need to make sure the file actually ends up at the
> right length, unless you want to just return an error when someone uses cp
> --sparse to a lame filesystem.

VFAT does not support sparse files, and so cp --sparse=always
simply creates a file full of zero bytes when copying a sparse
file to such a file system.  No problem.

You can demonstrate it like this on a Linux system.
BTW, cp's use of ftruncate works fine (returns 0) there,
but even if it were to fail, there is code to handle that.

    cd /tmp                                            &&
    dd bs=1 seek=128K of=sp < /dev/null 2> /dev/null   &&
    dd if=/dev/zero of=1 bs=8192 count=50 2> /dev/null &&
    mkdir mnt && mkfs -t vfat 1 > /dev/null            &&
    mount -oloop 1 mnt && cd mnt                       &&
    cp --sparse=always /tmp/sp .                       &&
    du -sk sp

The above prints  this:

    128     sp

Run this to clean up:

    cd /tmp && umount /tmp/mnt && rm -r 1 mnt sp


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to