[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: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2006-11-08 15:05:28 CET

On 11/8/06, Nik Clayton <nik@ngo.org.uk> wrote:
> All,
> SVN::Client::diff() is supposed to take (as part of its interface) two file
> handles, where the output and errors will be sent, respectively.
> If these are two file handles that correspond to files on disk then
> everything works as expected.
> Perl has the facility to open what are called "in memory" files, where the
> file corresponds to a Perl variable. This is handy way to avoid having to
> create temporary files. However, file handles created in this way don't
> work with SVN::Client::diff().
> I've attached diff.pl which shows the problem:
> Run
> ./diff.pl 0 http://svn.collab.net/repos/svn 2 1
> (or use another repo). You should see the diff printed to STDOUT.
> Change that to
> ./diff.pl 1 http://svn.collab.net/repos/svn 2 1
> to use in-memory files. I get (error message wrapped):
> Bad file descriptor: Can't write to stream: Bad file descriptor at
> diff.pl line 40
> This seems to be coming from libsvn_subr/io.c:svn_io_file_write(), which in
> turn calls apr_file_write()
> As far as Perl is concerned there shouldn't be any difference between the
> two types of file handle.
> Can anyone else reproduce this?

This is not all that surprising. The diff functions don't take
streams, they work in terms of apr_file_t, so they really do expect
there to be an actual file on disk. The fix is to rewrite them to
work in terms of streams (not trivial, IIRC), or work around it in
either the bindings or in your application by writing that in-memory
data to disk and passing in handles to those files to diff.


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 8 15:05:51 2006

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