Re: [PATCH v2 07/13] libdpkg: compression: do not handle EINTR
Hi!
On Sat, 2009-10-24 at 17:45:03 -0500, Jonathan Nieder wrote:
> The current callers for the compression code do not install signal
> handlers, so there is no occasion to test the EINTR handling.
> Perhaps for this reason, since commit 7bf6e0 (add support for using
> libz, 2000-12-09) when the current compression/decompression code
> was introduced, the EINTR handling has been broken in a number of
> ways:
>
> * interrupted reads were treated as end of file until very
> recently
> * interrupted writes during decompression cause portions of the
> output to be discarded
> * interrupted writes during compression are treated as errors,
> unless the interruption happens before any data from the
> output buffer can be consumed
>
> Since zlib at least cannot recover from an interrupted write
> anyway, it seems better to always treat EINTR like any other error.
> Callers should specify the SA_RESTART flag when installing signal
> handlers for correct behavior on System V style operating systems
> (such as Solaris).
I've applied this one, as it's best to explicitly fail, than to try
to handle a case that would cause subtle errors, even if the code
currently should not be susceptible to this problem. As I said on
another mail though, I might switch from using the libraries IO
functions to use the IOless compression code combined with our buffer
API.
thanks,
guillem
Reply to: