{"thread":{"id":"2238","subject":"git-cvsimport: $cvs->file() fails silently","startedAt":"2005-10-27T04:23:19Z","lastAt":"2005-11-01T01:22:37Z","messageCount":2,"participants":["Martin Langhoff"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"10689","messageId":"46a038f90510262123y4f56cf7v5494b391394ac648@mail.gmail.com","threadId":"2238","inReplyTo":null,"subject":"git-cvsimport: $cvs->file() fails silently","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2005-10-27T04:23:19Z","receivedAt":"2005-10-27T04:23:19Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"We have seen a few instances of files extracted from a remote CVS repo\nby $cvs->file() being empty, and still git-cvsimport did not die or\ncomplain. If I rewind the affected head and re-run git-cvsimport, the\nfile is imported correctly, which makes me suspect that the server\nwent away or there was some other networking glitch, and that the\nfile() and _file() methods didn't handle it gracefully.\n\nI've been through the file(), _file() and _line() methods, and they\nseem pretty conservative -- they die or return undef in all the right\nplaces. There _must_ be one place that we're missing but I just can't\nsee it.\n\nAny ideas?\n\n\n\nmartin\n"},{"id":"10906","messageId":"46a038f90510311722y56eadd3bj1ae53db05c496c67@mail.gmail.com","threadId":"2238","inReplyTo":"46a038f90510262123y4f56cf7v5494b391394ac648@mail.gmail.com","subject":"Re: git-cvsimport: $cvs->file() fails silently","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2005-11-01T01:22:37Z","receivedAt":"2005-11-01T01:22:37Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 10/27/05, Martin Langhoff <martin.langhoff@gmail.com> wrote:\n> There _must_ be one place that we're missing but I just can't\n> see it.\n\nGot some more info on this. The output of cvsimport when this happens\nlooks like this:\n\nRead from remote host cvs.sourceforge.net: Connection reset by peer\nRead from remote host cvs.sourceforge.net: Connection reset by peer\nUpdate course/enrol.php:  bytes\nUse of uninitialized value in split at\n/home/martin/local/git/git-cvsimport line 362.\nUpdate lang/en/moodle.php: 66792 bytes\nTree ID ef11ad5a0cf917e98bc477837de1b3f587e12027\nParent ID e972b3a28e1c4802fc5af6a996164c93fb4f3e53\nCommitted patch 20143 (MOODLE_15_STABLE 2005-10-31 20:31:57)\nCommit ID 95a748b0d9cd6dc74e65497561514fa5858c149c\n\nAround line 335  $res = $self->_line($fh); is returning '', which is\ndefined but otherwise empty. I've patched cvsimport thus to try and\ncatch this kind of error:\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex bbb83fb..f594df3 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -337,6 +337,10 @@ sub file {\n        }\n        close ($fh);\n\n+       if ($res eq '') {\n+           die \"Looks like the server has gone away during the transaction!\";\n+       }\n+\n        return ($name, $res);\n }\n\n@@ -764,6 +768,9 @@ while(<CVS>) {\n                my $rev = $3;\n                $fn =~ s#^/+##;\n                my ($tmpname, $size) = $cvs->file($fn,$rev);\n+               if ($size eq '') {\n+                       die \"Should not happen! Something went wrong\nwith the remote connection\";\n+               }\n                if($size == -1) {\n                        push(@old,$fn);\n                        print \"Drop $fn\\n\" if $opt_v;\n\nNow, I'm sure we can catch it in the \"right\" place, but I'm not sure\nwhere that is.\n\ncheers,\n\n\nmartin\n"}]}