August 03
[git] [svn] [perl] Permission denied: Can't open (...) Permission denied at /usr/bin/git-svn line 2389
A simple use case with
git svn fails:
$ git svn clone file:///F:/test/svn-native-repo/Initialized empty Git repository in /cygdrive/F/test/git/svn-native-repo/.git/ A sitemap.html A funcs.js A index.html A styles.cssr1 = d112a5b470fd4387c7bbb7199d0d7a065754b127 (git-svn)Permission denied: Can't open '/cygdrive/c/DOCUME~1/myself/LOCALS~1/Temp/report.tmp': Permission denied at /usr/sbin/git-core//git-svn line 2389(the dummy database dump file with 2 revisions can be obtained
here.)
after doing some investigating, we find:
Problem 1: locked resources
the offending methods in Git.pm (
/lib/perl/vendor_perl/5.xx/Git.pm) are
- hash_and_insert_object
- cat_blob
they use bidirectional pipes to pull/push data from the various git utilities, but they don't close them after this is complete. this denies Git's subsequent attempts to use these resources. specifically, i detected this for temp files, and it is very likely other resources aren't released.
to fix this, we just issue calls to the internal helper methods
- _close_hash_and_insert_object and
- _close_cat_blob
the patch is available
here.
Problem 2: syntactical quagmire
the internal helper methods
- _close_hash_and_insert_object and
- _close_cat_blob
do not work as advertised.
877: my @vars = map { 'cat_blob_' . $_ } qw(pid in out ctx);
878:
879: command_close_bidi_pipe($self->{@vars});
880: delete $self->{@vars};Edit: this was fixed in a
patch.
Resolution
When it works, it looks like this:
$ git svn clone file:///F:/test/svn-native-repo/Initialized empty Git repository in /cygdrive/F/test/git/.git/ A sitemap.html A funcs.js A index.html A styles.cssr1 = d112a5b470fd4387c7bbb7199d0d7a065754b127 (git-svn) M index.htmlr2 = 02241150fa90ffc4c4d57d23fe7286afce122409 (git-svn)Checked out HEAD: file:///F:/test/svn-native-repo r2environment details:- win xp home sp2- Cygwin: 1.5.25 (latest)- Git: 1.6.0.2 (latest)- subversion-perl: 1.4.6 (latest)- Perl: 5.10.0 (latest)and all related dependencies, obtained with cygwin's setup.exe. Edit:
[12 Oct 2008 03:20:25] updated for 1.6.0.2 (also
23abd3f)