Greetings,
[please Cc: me on replies]
Subversion 1.6.1 on Cygwin 1.5 seems to break Git-SVN for https://
repositories (svn+ssh:// continues to work), downgrading Subversion to
1.5.6 fixes things for me.
Git-SVN uses Subversion's Perl bindings, and SVN::Ra uses APR Pools, which
in turn seem to do Stupid Things[tm] by creating a temp file of constant
name "tempfile.tmp" (this may be prone to symlink attacks).
At any rate, this (= delete a file and have the same process recreate a
new file with the same name) isn't supported by Cygwin.
Suggested solution: use mkstemp() or other safe ways to obtain a unique,
random file name.
Details are at the following URLs, with key excerpts directly below:
--------------------------
http://article.gmane.org/gmane.comp.version-control.git/117347
$ git svn fetch
M file1
A file2
A file3
A file4
r15 = 70a56f818a057442e29161170e28c5df4b38a811 (git-svn)
Permission denied: Can't open
'/cygdrive/c/DOKUME~1/login/LOKALE~1/Temp/tempfile.tmp': Permission denied
at /usr/local/libexec/git-core/git-svn line 2540
--------------------------
and http://article.gmane.org/gmane.comp.version-control.git/117472
The code snippet below is from Git-SVN, line numbers relative to it.
I debugged this a bit further, and the damage (i. e. removal of the
tempfile) apparently happens
in $pool->clear; in line 4355. I single-stepped it, and the
apr_pool_clear(...) is the culprit, it unlinks() the tempfile, making this
location unusable.
The temp file is generated when the Reporter object is created through
$self->do_update in line 4336.
It remains unclear to me who generates the non-unique filename (it's
...\Temp\tempfile.tmp for me), I've not found the code that generates the
file names.
Questions:
- How can I either make sure that the temporary file name for the reporter
gets either a unique name (near line 4336, through SVN::Ra...)
- or is that the temp file truncated, rather than deleted, near line 4355
(through SVN::Pool::clear)?
- Is there any way to influence how the SVN::Ra::Reporter obtains
temporary files?
I seem to be unable to trace this down to the actual functions, but then
again, my perlboot is rather holey...
Any help?
4132 package Git::SVN::Ra;
4133 use vars qw/@ISA $config_dir $_log_window_size/;
4134 use strict;
4135 use warnings;
4136 my ($ra_invalid, $can_do_switch, %ignored_err, $RA);
4137
....
4324 sub gs_do_update {
4325 my ($self, $rev_a, $rev_b, $gs, $editor) = @_;
4326 my $new = ($rev_a == $rev_b);
4327 my $path = $gs->{path};
4328
4329 if ($new && -e $gs->{index}) {
4330 unlink $gs->{index} or die
4331 "Couldn't unlink index: $gs->{index}: $!\n";
4332 }
4333 my $pool = SVN::Pool->new;
4334 $editor->set_path_strip($path);
4335 my (@pc) = split m#/#, $path;
: 4336 my $reporter = $self->do_update($rev_b, (@pc ? shift @pc :
''),
4337 1, $editor, $pool);
4338 my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();
4339
4340 # Since we can't rely on svn_ra_reparent being available,
we'll
4341 # just have to do some magic with set_path to make it so
4342 # we only want a partial path.
4343 my $sp = '';
4344 my $final = join('/', @pc);
4345 while (@pc) {
4346 $reporter->set_path($sp, $rev_b, 0, @lock, $pool);
4347 $sp .= '/' if length $sp;
4348 $sp .= shift @pc;
4349 }
4350 die "BUG: '$sp' != '$final'\n" if ($sp ne $final);
4351
4352 $reporter->set_path($sp, $rev_a, $new, @lock, $pool);
4353
4354 $reporter->finish_report($pool);
: 4355 $pool->clear;
4356 $editor->{git_commit_ok};
4357 }
--
Matthias Andree
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1942580
Received on 2009-04-27 16:29:35 CEST