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

Re: Bug with SVN::Client::diff() and in-memory files

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2006-11-08 21:19:18 CET

On Wed, Nov 08, 2006 at 11:39:46AM -0500, David Glasser wrote:
> On 11/8/06, Malcolm Rowe <malcolm-svn-dev@farside.org.uk> wrote:
>
> >Just to clarify: we're talking solely about the filehandles passed as
> >the output and error 'streams' for diff, not anything related to the
> >input files (which yes, need to be mmapable).
>
> An attempt to bump svn_client_diff to use svn_streams turns into a
> need to do the same to svn_io_run_diff, which then implies
> svn_io_run_cmd, which then implies svn_io_start_cmd, which does
> certainly appear to start doing file-specific things. That's probably
> the place to look.
>

So the problem boils down to this:

- Perl IO memory-backed globs are implemented using the "scalar" PerlIO
  layer, which doesn't make any use of a filehandle (so PerlIO_fileno()
  returns -1).
- svn_swig_pl_make_file() successfully makes an apr_file_t* that refers
  to a filehandle -1, but then attempting to write anything to that
  handle fails, obviously.

The solution is probably just to change svn_swig_pl_make_file() so that
it returns an svn_error_t*, and make it return a sensible error message
if it sees a PerlIO fileno of -1, because that indicates a
non-filehandle-backed PerlIO handle that we aren't going to be able to
wrap in an apr_file_t.

Actually solving the problem would require us to be able to exec()
commands with stdin/out/err connected to non-file-handle-backed streams.
Of course, that's impossible.

Instead, we'd need to create a temporary file (pipe?) to store the
input or output and then connect filehandles to that, marshalling the
data to or from the svn_stream_t* to the filehandle as necessary.
(We'd also want the ability to detect and extract filehandles from
apr_file_t-wrapping-svn_stream_t's, because I suspect we'd want to
short-circuit all that nonsense in the usual case).

All that sounds rather.. hard.

Regards,
Malcolm

  • application/pgp-signature attachment: stored
Received on Wed Nov 8 21:20:38 2006

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