Checkout
kotkov
committed
on 23 Oct 18
Following up on r1836306, provide an alternative fix for allowing things
like "svn commit -F <(echo foo)" that doesn't require a more expens… Show more
Following up on r1836306, provide an alternative fix for allowing things

like "svn commit -F <(echo foo)" that doesn't require a more expensive

apr_file_info_get(APR_FINFO_SIZE | APR_FINFO_TYPE) syscall in the

low-level and commonly used function.

Instead of additionally blacklisting APR_PIPE handles, rework the code to

work under the conditions where `finfo.size` may be wrong.  That is, try to

read one more byte than necessary, expect to see an EOF, but if we don't

(e.g., for pipes), fall through to reading the remaining part of the file

chunk-by-chunk.

This approach should work correctly under all possible cases where `finfo.

size` is incorrect, and also allows to just ask for APR_FINFO_SIZE, which

is generally cheaper.  At least on Windows, this uses GetFileSizeEx() and

results in a single syscall.

* subversion/libsvn_subr/io.c

 (stringbuf_from_aprfile): Replace the additional blacklist condition for

  APR_PIPEs with the approach described above.

Show less