Bug#447153: /usr/bin/scp: Fails to notice write errors

Michal Suchanek hramrach at centrum.cz
Wed Nov 14 10:03:12 EST 2007


On 13/11/2007, Colin Watson <cjwatson at debian.org> wrote:
> On Tue, Nov 13, 2007 at 12:02:25AM +0100, Peter Stuge wrote:
> > On Mon, Nov 12, 2007 at 06:33:54PM +0000, Colin Watson wrote:
> > > To openssh-unix-dev: does anyone think this is worth a workaround?
> >
> > Gut feeling is that it should be fixed wherever the problem is.
>
> Yeah, that's why I sent my mail to the CIFS list as well. Kernels won't
> get upgraded instantly even if it gets fixed right away though, so
> OpenSSH might want to regard it as a portability fix ...
>
> > > The ftruncate seems rather unnecessary if we've already written out
> > > the required number of bytes anyway.
> >
> > Not neccessarily, we may be overwriting a larger file with the same
> > name.
>
> Indeed; see the other part of this thread.
>

I tried a few experiments, and I was not able to reproduce the problem

a) against a Windows XP share
which points in the direction of Samba server or Samba <-> Samba incompatibility

b) in my favourite scripting language because it puts a sync before the truncate
This could be used in scp as well, it is minimal change to the code:

open: Success
write: Success
ftruncate: Success
close: Success

open: Success
write: Success
fsync: No space left on device
ftruncate: No space left on device
close: No space left on device

Duplication voodoo also works:

open: Success
write: Success
dup: Success
close dup: No space left on device
ftruncate: No space left on device
close: No space left on device

Thanks

Michal


More information about the openssh-unix-dev mailing list