[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1701633 - /subversion/trunk/subversion/libsvn_subr/stream.c

From: Stefan Fuhrmann <stefan.fuhrmann_at_wandisco.com>
Date: Tue, 8 Sep 2015 12:54:03 +0200

On Tue, Sep 8, 2015 at 11:21 AM, Ivan Zhakov <ivan_at_visualsvn.com> wrote:

> On 7 September 2015 at 18:06, <kotkov_at_apache.org> wrote:
> > Author: kotkov
> > Date: Mon Sep 7 15:06:57 2015
> > New Revision: 1701633
> >
> > URL: http://svn.apache.org/r1701633
> > Log:
> > Fix svn_stream_for_stdin() and related functions for STDOUT and STDERR
> > that were returning streams with mark() and seek() capabilities.
> >
> > STDIN, STDOUT and STDERR don't provide general support for positioning
> > requests. This behavior is implementation-specific and depends on what's
> > passed as the corresponding handle. For example, on Linux,
> apr_file_seek()
> > that calls lseek() internally fails with ESPIPE [1] when the descriptor
> is
> > associated with a terminal device. As we cannot safely advertise mark()
> > and seek() support for these streams, don't do that.
>

Good find!

> > [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html
> >
> > * subversion/libsvn_subr/stream.c
> > (svn_stream_for_stdin, svn_stream_for_stdout, svn_stream_for_stderr):
> > Don't install mark and seek handlers.
> >
> It may be worth to introduce local helper like
> 'make_stream_from_apr_file(svn_boolean_t supports_seek)' and use it in
> svn_stream_from_apr_file2() and svn_stream_for_stdin() instead of
> clearing mark/seek handlers after calling svn_stream_from_apr_file2().
>
> Another problem that currently svn_stream_t for stdin/stderr/stdout
> pretends to support native svn_stream_skip(), while I'm not sure that
> all platforms support seek for stdin.
>

One more thing we could do is not adding mark & seek
on stream based on write-only files. I haven't tried but
that's something we should be able to do generically in
svn_stream_from_apr_file already.

-- Stefan^2.
Received on 2015-09-08 12:54:22 CEST

This is an archived mail posted to the Subversion Dev mailing list.