Subject: Re: bug#19072: cp does not work with davfs2 (fuse) under GNU/Linux; coreutils-8.21

From: Pádraig Brady <[email-masked]>
Date: Mon, 17 Nov 2014 16:11:16 +0000

On 17/11/14 14:36, Klaus-Jürgen Wolf wrote:
> I have to correct my former comment: cp --sparse=never only works with very small files, e.g. 542 bytes.
> 
> (PWD=/home/kj/MyDrive)
> 
> $ /bin/cp --sparse=never ~/prj/kaese/cpp/Makefile .
> $ stat Makefile
>   File: ‘Makefile’
>   Size: 542             Blocks: 2          IO Block: 4096   regular file
> Device: 28h/40d Inode: 18825536    Links: 1
> Access: (0644/-rw-r--r--)  Uid: ( 1000/      kj)   Gid: ( 1000/      kj)
> Access: 2014-11-17 15:27:05.000000000 +0100
> Modify: 2014-11-17 15:27:05.000000000 +0100
> Change: 2014-11-17 15:27:05.000000000 +0100
>  Birth: -
> 
> $ dd if=/dev/zero conv=notrunc count=1 seek=1 of=/home/kj/MyDrive/eio.test
> 1+0 records in
> 1+0 records out
> 512 bytes (512 B) copied, 0.00248944 s, 206 kB/s
> 
> But, with longer files:
> 
> $ /bin/cp --sparse=never ~/Tc7200.bin .
> /bin/cp: error writing ‘./Tc7200.bin’: Input/output error
> /bin/cp: failed to extend ‘./Tc7200.bin’: Input/output error
> 
> $ ll ~/Tc7200.bin
> -rw-r--r-- 1 kj kj 26296 Sep  8 21:45 /home/kj/Tc7200.bin
> 
> I need to say that using tar, I can produce much longer files:
> 
> $ stat kaese20141116.7z 
>   File: ‘kaese20141116.7z’
>   Size: 981305          Blocks: 1917       IO Block: 4096   regular file
> Device: 28h/40d Inode: 18802464    Links: 1
> Access: (0644/-rw-r--r--)  Uid: ( 1000/      kj)   Gid: ( 1000/      kj)
> Access: 2014-11-16 11:13:20.000000000 +0100
> Modify: 2014-11-16 11:12:48.000000000 +0100
> Change: 2014-11-16 11:12:55.000000000 +0100
>  Birth: -
> 

With --sparse=never we really should only be doing write()s to the destination.
That could be confirmed with:

  strace cp --sparse=never ~/Tc7200.bin .

The only thing left that I can think of is the size of the writes is causing a problem.
cp will read and write 64KiB by default. tar may be using smaller than this and so
not triggering the issue?

I searched for that issue and noticed this fuse issue:
http://thread.gmane.org/gmane.comp.file-systems.fuse.devel/14095

thanks,
Pádraig.