Bug#607267: /usr/bin/scp: fails to notice close() errors
Excerpts from Helmut Grohne's message of Sat Dec 03 17:33:04 +0100 2011:
> On Sun, Jan 02, 2011 at 03:48:05PM +0100, Michal Suchanek wrote:
> > This same issue also happens with cp(1) from coreutils.
> I verified that this statement is wrong.
It is not.
> 1) The coreutils actually check the return value of close which can be
> seen on copy.c. It has precisely two calls to close and both are
> 2) I created a simple LD_PRELOAD library to make close fail (attached).
> Running cp foo bar with this library preloaded (i.e. failing any close
> with EIO) I get the following output and return value 1:
> cp: closing `foo': Input/output error
> This is correct behaviour. Since scp invokes cp for local copies, the
> test originally submitted testcase
> Michal Suchanek wrote earlier:
> > $ scp /scratch/junk . ; echo $?
> > 0
> > $ rm junk
> is wrong as well. This command would output a similar error message to
> the one above. However this does not invalidate the bug immediately. To
> be sure, remote transfers need to be checked as well.
Please read the analysis in the latter message.
> A quick grep of the openssh source indicates that checking close is
> overrated. Who needs errors anyway? I want that it works!!1!eleven
And for it to work it needs to report errors when they happen.