{"thread":{"id":"9101","subject":"[PATCH] Proposal for git-svn","startedAt":"2007-07-18T21:07:42Z","lastAt":"2007-07-19T17:41:07Z","messageCount":3,"participants":["Benoit SIGOURE","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"47777","messageId":"FAFA899D-EC45-4313-98ED-2D0A3FF37669@lrde.epita.fr","threadId":"9101","inReplyTo":null,"subject":"[PATCH] Proposal for git-svn","fromName":"Benoit SIGOURE","fromEmail":"tsuna@lrde.epita.fr","sentAt":"2007-07-18T21:07:42Z","receivedAt":"2007-07-18T21:07:42Z","isPatch":true,"sender":{"key":"tsunanet@gmail.com","avatar":"https://avatars.githubusercontent.com/u/128281?v=4"},"body":"Hello,\n\nI'm importing many SVN repositories in Git and I ran across a problem:\nufloat.h has mode 120000but is not a link\n\nI've read the code and checked-out the revision where the problem  \noccured and it turns out that some stupid user commited a broken  \nsymlink and I think that's where the problem came from.  I'm  \nproposing the following trivial change to let git-svn clone continue  \nits work:\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 01c3904..a82baf4 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -2555,8 +2555,8 @@ sub close_file {\n                 sysseek($fh, 0, 0) or croak $!;\n                 if ($fb->{mode_b} == 120000) {\n                         sysread($fh, my $buf, 5) == 5 or croak $!;\n-                       $buf eq 'link ' or die \"$path has mode 120000\",\n-                                              \"but is not a link\\n\";\n+                       $buf eq 'link ' or warn \"$path has mode 120000\",\n+                                              \" but is not a link\\n\";\n                 }\n                 defined(my $pid = open my $out,'-|') or die \"Can't  \nfork: $!\\n\";\n                 if (!$pid) {\n\n(I also added a whitespace because \"120000but\" does not look good :D)\nI checked out the problematic revision in git and I see the broken  \nsymlink just like in SVN so I assume this change is correct.\n\n-- \nBenoit Sigoure aka Tsuna\nEPITA Research and Development Laboratory\n\n\n"},{"id":"47804","messageId":"20070719042255.GA17433@muzzle","threadId":"9101","inReplyTo":"FAFA899D-EC45-4313-98ED-2D0A3FF37669@lrde.epita.fr","subject":"Re: [PATCH] Proposal for git-svn","fromName":"Eric Wong","fromEmail":"eric@petta-tech.com","sentAt":"2007-07-19T04:22:55Z","receivedAt":"2007-07-19T04:22:55Z","isPatch":true,"sender":{"key":"eric@petta-tech.com","avatar":null},"body":"Benoit SIGOURE <tsuna@lrde.epita.fr> wrote:\n> Hello,\n> \n> I'm importing many SVN repositories in Git and I ran across a problem:\n> ufloat.h has mode 120000but is not a link\n> \n> I've read the code and checked-out the revision where the problem  \n> occured and it turns out that some stupid user commited a broken  \n> symlink and I think that's where the problem came from.  I'm  \n> proposing the following trivial change to let git-svn clone continue  \n> its work:\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 01c3904..a82baf4 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -2555,8 +2555,8 @@ sub close_file {\n>                 sysseek($fh, 0, 0) or croak $!;\n>                 if ($fb->{mode_b} == 120000) {\n>                         sysread($fh, my $buf, 5) == 5 or croak $!;\n> -                       $buf eq 'link ' or die \"$path has mode 120000\",\n> -                                              \"but is not a link\\n\";\n> +                       $buf eq 'link ' or warn \"$path has mode 120000\",\n> +                                              \" but is not a link\\n\";\n>                 }\n>                 defined(my $pid = open my $out,'-|') or die \"Can't  \n> fork: $!\\n\";\n>                 if (!$pid) {\n> \n> (I also added a whitespace because \"120000but\" does not look good :D)\n> I checked out the problematic revision in git and I see the broken  \n> symlink just like in SVN so I assume this change is correct.\n\nVery strange.  Since $buf didn't have the string \"link \" in it, did it\nhave a path name in it?  If so, the sysread() would've advanced the $fh\noffset by 5 bytes; causing an even more broken symlink to be added by git.\n\nWould the following be more correct?\n\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -2552,9 +2552,15 @@ sub close_file {\n \t\t}\n \t\tsysseek($fh, 0, 0) or croak $!;\n \t\tif ($fb->{mode_b} == 120000) {\n-\t\t\tsysread($fh, my $buf, 5) == 5 or croak $!;\n-\t\t\t$buf eq 'link ' or die \"$path has mode 120000\",\n-\t\t\t                       \"but is not a link\\n\";\n+\t\t\teval {\n+\t\t\t\tsysread($fh, my $buf, 5) == 5 or croak $!;\n+\t\t\t\t$buf eq 'link ' or die \"$path has mode 120000\",\n+\t\t\t\t\t\t       \" but is not a link\";\n+\t\t\t};\n+\t\t\tif ($@) {\n+\t\t\t\twarn \"$@\\n\";\n+\t\t\t\tsysseek($fh, 0, 0) or croak $!;\n+\t\t\t}\n \t\t}\n \t\tdefined(my $pid = open my $out,'-|') or die \"Can't fork: $!\\n\";\n \t\tif (!$pid) {\n\n-- \nEric Wong\n"},{"id":"47882","messageId":"6F6FBB0C-5CDB-4280-AD25-C805634B8B7B@lrde.epita.fr","threadId":"9101","inReplyTo":"20070719042255.GA17433@muzzle","subject":"Re: [PATCH] Proposal for git-svn","fromName":"Benoit SIGOURE","fromEmail":"tsuna@lrde.epita.fr","sentAt":"2007-07-19T17:41:07Z","receivedAt":"2007-07-19T17:41:07Z","isPatch":true,"sender":{"key":"tsunanet@gmail.com","avatar":"https://avatars.githubusercontent.com/u/128281?v=4"},"body":"On Jul 19, 2007, at 6:22 AM, Eric Wong wrote:\n\n> Benoit SIGOURE <tsuna@lrde.epita.fr> wrote:\n>> Hello,\n>>\n>> I'm importing many SVN repositories in Git and I ran across a  \n>> problem:\n>> ufloat.h has mode 120000but is not a link\n>>\n>> I've read the code and checked-out the revision where the problem\n>> occured and it turns out that some stupid user commited a broken\n>> symlink and I think that's where the problem came from.  I'm\n>> proposing the following trivial change to let git-svn clone continue\n>> its work:\n>>\n>> diff --git a/git-svn.perl b/git-svn.perl\n>> index 01c3904..a82baf4 100755\n>> --- a/git-svn.perl\n>> +++ b/git-svn.perl\n>> @@ -2555,8 +2555,8 @@ sub close_file {\n>>                 sysseek($fh, 0, 0) or croak $!;\n>>                 if ($fb->{mode_b} == 120000) {\n>>                         sysread($fh, my $buf, 5) == 5 or croak $!;\n>> -                       $buf eq 'link ' or die \"$path has mode  \n>> 120000\",\n>> -                                              \"but is not a link\\n\";\n>> +                       $buf eq 'link ' or warn \"$path has mode  \n>> 120000\",\n>> +                                              \" but is not a link \n>> \\n\";\n>>                 }\n>>                 defined(my $pid = open my $out,'-|') or die \"Can't\n>> fork: $!\\n\";\n>>                 if (!$pid) {\n>>\n>> (I also added a whitespace because \"120000but\" does not look good :D)\n>> I checked out the problematic revision in git and I see the broken\n>> symlink just like in SVN so I assume this change is correct.\n>\n> Very strange.  Since $buf didn't have the string \"link \" in it, did it\n> have a path name in it?  If so, the sysread() would've advanced the  \n> $fh\n> offset by 5 bytes; causing an even more broken symlink to be added  \n> by git.\n>\n> Would the following be more correct?\n>\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -2552,9 +2552,15 @@ sub close_file {\n>  \t\t}\n>  \t\tsysseek($fh, 0, 0) or croak $!;\n>  \t\tif ($fb->{mode_b} == 120000) {\n> -\t\t\tsysread($fh, my $buf, 5) == 5 or croak $!;\n> -\t\t\t$buf eq 'link ' or die \"$path has mode 120000\",\n> -\t\t\t                       \"but is not a link\\n\";\n> +\t\t\teval {\n> +\t\t\t\tsysread($fh, my $buf, 5) == 5 or croak $!;\n> +\t\t\t\t$buf eq 'link ' or die \"$path has mode 120000\",\n> +\t\t\t\t\t\t       \" but is not a link\";\n> +\t\t\t};\n> +\t\t\tif ($@) {\n> +\t\t\t\twarn \"$@\\n\";\n> +\t\t\t\tsysseek($fh, 0, 0) or croak $!;\n> +\t\t\t}\n>  \t\t}\n>  \t\tdefined(my $pid = open my $out,'-|') or die \"Can't fork: $!\\n\";\n>  \t\tif (!$pid) {\n>\n\nIt does look more correct though I don't get the same sha1 sums with  \nyour patch.\nActually here is what happens:\nAt revision N, b0rken symlinks are added in the SVN repos.  Up to  \nthis revision, I get the same sha1 sums.\nAt N+1, the symlinks are removed from the SVN, and sha1 sums start to  \ndiffer, for some reason.\nI expected them to be either identical all the way through or to  \ndiffer at N, but not at N+1.\n\nIn both cases the repository seem usable and I couldn't notice any  \nother difference than the sha1 sums.\n\nCheers,\n\n-- \nBenoit Sigoure aka Tsuna\nEPITA Research and Development Laboratory\n\n\n"}]}