{"thread":{"id":"10127","subject":"git-cvsserver commit trouble (unexpected end of file in client)","startedAt":"2007-10-03T11:48:50Z","lastAt":"2007-10-04T21:55:02Z","messageCount":19,"participants":["Jan Wielemaker","Johannes Schindelin","Frank Lichtenheld","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"54703","messageId":"200710031348.50800.wielemak@science.uva.nl","threadId":"10127","inReplyTo":null,"subject":"git-cvsserver commit trouble (unexpected end of file in client)","fromName":"Jan Wielemaker","fromEmail":"wielemak@science.uva.nl","sentAt":"2007-10-03T11:48:50Z","receivedAt":"2007-10-03T11:48:50Z","isPatch":false,"sender":{"key":"wielemak@science.uva.nl","avatar":null},"body":"Hi,\n\nI'm pretty new to GIT. I quickly convinced our project to move to GIT,\nexcept for one guy that wants to do Windows and CVS :-( I setup a test\nand the checkout works just fine, but commit from cvs doesn't work. The\ndetails:\n\n\t* Server: git version 1.5.3.1 compiled on SuSE 10.2, 64-bits\n\t* Client, both SuSE CVS 1.12.12 and the current WinCVS cvs.exe,\n\tso it appears irrelevant.\n\nI created a test repository from a papers directory using the sequence\nbeloe. (P.s. isn't there a more elegant way to get to a bare shared repo\nfrom a set of files? I tried (mkdir papers.git && cd papers.git && git\n--bare init --shared=all), but I can't clone an empty bare repository\n(doesn't create anything), so I can't add to it).\n\n\t% cd ~/tmp/papers\n\t% git-init\n\t% git-add .\n\t% git-commit\n\t% cd /home/git\n\t% git-clone --bare --no-hardlinks ~/tmp/papers/ papers.git\n\t% cd papers.git\n\t% git-config core.sharedrepository all\n\t% chmod g+ws `find . -type d`\n\t% chmod g+w `find . -type f`\n\nAnyway, appears to work fine with GIT to clone, pull and push.  Using\nCVS over SSH, I can checkout this just fine, creating HEAD.  Now I change\na file and run \"cvs commit\" to get:\n\ngollem (2006) 11_> cvs commit -m \"test\"\ncvs [commit aborted]: end of file from server (consult above messages if any)\n\nI enabled logging and added a few statements to git-cvsserver (line 1203)\n\n    $log->info(\"Start git show-ref -s refs/heads/$state->{module}\");\n    # Remember where the head was at the beginning.\n    my $parenthash = `git show-ref -s refs/heads/$state->{module}`;\n    $log->info(\"parenthash = $parenthash\");\n    chomp $parenthash;\n    if ($parenthash !~ /^[0-9a-f]{40}$/) {\n            $log->warn(\"error 1 pserver cannot find the current HEAD of \nmodule\");\n            exit;\n    }\n\nThen I get this log output:\n\n================================================================\n2007-10-03 12:25:16 : DEBUG - Temporary directory is '/tmp/XwYVFFqjyd'\n2007-10-03 12:25:16 : DEBUG - req_Root : /home/git/papers.git\n2007-10-03 12:25:16 : DEBUG - req_Validresponses : ok error Valid-requests \nReferrer Redirect Checked-in New-entry Checksum Co\npy-file Updated Created Update-existing Merged Patched Rcs-diff Mode Mod-time \nRemoved Remove-entry Set-static-directory Clear\n-static-directory Set-sticky Clear-sticky Edit-file Template Clear-template \nNotified Module-expansion Wrapper-rcsOption M Mbi\nnary E F MT\n2007-10-03 12:25:16 : DEBUG - req_validrequests\n2007-10-03 12:25:16 : DEBUG - SEND : Valid-requests remove add status Entry \nwatchers ci tag log co Modified Questionable admi\nn Root history valid-requests Global_option Argumentx annotate Valid-responses \nUnchanged Directory rlog Argument expand-modul\nes diff editors update\n2007-10-03 12:25:16 : DEBUG - SEND : ok\n2007-10-03 12:25:16 : DEBUG - req_Globaloption : -q\n2007-10-03 12:25:16 : DEBUG - Argument : -m\n2007-10-03 12:25:16 : DEBUG - Argument : test\n2007-10-03 12:25:16 : DEBUG - Argument : --\n2007-10-03 12:25:16 : INFO  - Setting prepend to '2006/'\n2007-10-03 12:25:16 : DEBUG - Prepending '2006/' to state|directory\n2007-10-03 12:25:16 : DEBUG - req_Directory : localdir=. \nrepository=/home/git/papers.git/HEAD/2006 path=2006/ directory=2006/\n module=HEAD\n2007-10-03 12:25:16 : INFO  - Received entry line '/README.txt/1.1///' \n=> '2006/README.txt'\n2007-10-03 12:25:16 : DEBUG - Argument : README.txt\n2007-10-03 12:25:16 : INFO  - req_ci : [NULL]\n2007-10-03 12:25:16 : INFO  - Lockless commit start, basing commit \non '/tmp/XwYVFFqjyd/ud4uGbbUJg', index file is '/tmp/XwYVF\nFqjyd/3FeXMladmb'\n2007-10-03 12:25:16 : INFO  - Start git show-ref -s refs/heads/HEAD\n2007-10-03 12:25:16 : INFO  - parenthash =\n2007-10-03 12:25:16 : WARN  - error 1 pserver cannot find the current HEAD of \nmodule\n================================================================\n\nI don't like the req_ci : [NULL] very much, and the last 3 lines clearly shows \na problem.  I checked\nthe latest git repository of git. There is no change to git-cvsserver.perl.\n\nI'm still a bit too newbie to (and not much of a Perl programmer).  Does \nanyone has a clue?  Do I have\nthe wrong version for something?  Did I setup the repository wrongly?\n\n\tThanks --- Jan\n"},{"id":"54706","messageId":"200710031513.44446.wielemak@science.uva.nl","threadId":"10127","inReplyTo":"200710031348.50800.wielemak@science.uva.nl","subject":"Re: git-cvsserver commit trouble (unexpected end of file in client)","fromName":"Jan Wielemaker","fromEmail":"wielemak@science.uva.nl","sentAt":"2007-10-03T13:13:44Z","receivedAt":"2007-10-03T13:13:44Z","isPatch":false,"sender":{"key":"wielemak@science.uva.nl","avatar":null},"body":"On Wednesday 03 October 2007 13:48, Jan Wielemaker wrote:\n> Hi,\n>\n> I'm pretty new to GIT. I quickly convinced our project to move to GIT,\n> except for one guy that wants to do Windows and CVS :-( I setup a test\n> and the checkout works just fine, but commit from cvs doesn't work. The\n> details:\n>\n> \t* Server: git version 1.5.3.1 compiled on SuSE 10.2, 64-bits\n> \t* Client, both SuSE CVS 1.12.12 and the current WinCVS cvs.exe,\n> \tso it appears irrelevant.\n>\n> I created a test repository from a papers directory using the sequence\n> beloe. (P.s. isn't there a more elegant way to get to a bare shared repo\n> from a set of files? I tried (mkdir papers.git && cd papers.git && git\n> --bare init --shared=all), but I can't clone an empty bare repository\n> (doesn't create anything), so I can't add to it).\n>\n> \t% cd ~/tmp/papers\n> \t% git-init\n> \t% git-add .\n> \t% git-commit\n> \t% cd /home/git\n> \t% git-clone --bare --no-hardlinks ~/tmp/papers/ papers.git\n> \t% cd papers.git\n> \t% git-config core.sharedrepository all\n> \t% chmod g+ws `find . -type d`\n> \t% chmod g+w `find . -type f`\n>\n> Anyway, appears to work fine with GIT to clone, pull and push.  Using\n> CVS over SSH, I can checkout this just fine, creating HEAD.  Now I change\n> a file and run \"cvs commit\" to get:\n>\n> gollem (2006) 11_> cvs commit -m \"test\"\n> cvs [commit aborted]: end of file from server (consult above messages if\n> any)\n\nI start to get a clue.  Adding a line\n\n\t$log->info(\"Heads: \" . `git show-ref --heads`);\n\nI see this in the log:\n\n\t2007-10-03 14:13:44 : INFO  - Heads: 0b7b372d525a4fe7f662996fec9cd11b1038a6be \nrefs/heads/master\n\nThus, I though I created the repository the wrong way.  Tried again,\nfollowing the recipy of \nhttp://www.kernel.org/pub/software/scm/git/docs/cvs-migration.html:\n\n$ mkdir /pub/my-repo.git\n$ cd /pub/my-repo.git\n$ git --bare init --shared\n$ git --bare fetch /home/alice/myproject master:master\n\nChecked out freshly using CVS. No problem. But committing a change,\nnothing changed :-( The log output is exactly the same, showing only\nrefs/heads/master. I'm starting to suspect git-cvsserver afterall, but\nthe docs suggests it is operational for quite a while. Could someone\ngive me a clue on what am I missed?\n\n\tThanks --- Jan \n\n> I enabled logging and added a few statements to git-cvsserver (line 1203)\n>\n>     $log->info(\"Start git show-ref -s refs/heads/$state->{module}\");\n>     # Remember where the head was at the beginning.\n>     my $parenthash = `git show-ref -s refs/heads/$state->{module}`;\n>     $log->info(\"parenthash = $parenthash\");\n>     chomp $parenthash;\n>     if ($parenthash !~ /^[0-9a-f]{40}$/) {\n>             $log->warn(\"error 1 pserver cannot find the current HEAD of\n> module\");\n>             exit;\n>     }\n>\n> Then I get this log output:\n>\n> ================================================================\n> 2007-10-03 12:25:16 : DEBUG - Temporary directory is '/tmp/XwYVFFqjyd'\n> 2007-10-03 12:25:16 : DEBUG - req_Root : /home/git/papers.git\n> 2007-10-03 12:25:16 : DEBUG - req_Validresponses : ok error Valid-requests\n> Referrer Redirect Checked-in New-entry Checksum Co\n> py-file Updated Created Update-existing Merged Patched Rcs-diff Mode\n> Mod-time Removed Remove-entry Set-static-directory Clear\n> -static-directory Set-sticky Clear-sticky Edit-file Template Clear-template\n> Notified Module-expansion Wrapper-rcsOption M Mbi\n> nary E F MT\n> 2007-10-03 12:25:16 : DEBUG - req_validrequests\n> 2007-10-03 12:25:16 : DEBUG - SEND : Valid-requests remove add status Entry\n> watchers ci tag log co Modified Questionable admi\n> n Root history valid-requests Global_option Argumentx annotate\n> Valid-responses Unchanged Directory rlog Argument expand-modul\n> es diff editors update\n> 2007-10-03 12:25:16 : DEBUG - SEND : ok\n> 2007-10-03 12:25:16 : DEBUG - req_Globaloption : -q\n> 2007-10-03 12:25:16 : DEBUG - Argument : -m\n> 2007-10-03 12:25:16 : DEBUG - Argument : test\n> 2007-10-03 12:25:16 : DEBUG - Argument : --\n> 2007-10-03 12:25:16 : INFO  - Setting prepend to '2006/'\n> 2007-10-03 12:25:16 : DEBUG - Prepending '2006/' to state|directory\n> 2007-10-03 12:25:16 : DEBUG - req_Directory : localdir=.\n> repository=/home/git/papers.git/HEAD/2006 path=2006/ directory=2006/\n>  module=HEAD\n> 2007-10-03 12:25:16 : INFO  - Received entry line '/README.txt/1.1///'\n> => '2006/README.txt'\n> 2007-10-03 12:25:16 : DEBUG - Argument : README.txt\n> 2007-10-03 12:25:16 : INFO  - req_ci : [NULL]\n> 2007-10-03 12:25:16 : INFO  - Lockless commit start, basing commit\n> on '/tmp/XwYVFFqjyd/ud4uGbbUJg', index file is '/tmp/XwYVF\n> Fqjyd/3FeXMladmb'\n> 2007-10-03 12:25:16 : INFO  - Start git show-ref -s refs/heads/HEAD\n> 2007-10-03 12:25:16 : INFO  - parenthash =\n> 2007-10-03 12:25:16 : WARN  - error 1 pserver cannot find the current HEAD\n> of module\n> ================================================================\n>\n> I don't like the req_ci : [NULL] very much, and the last 3 lines clearly\n> shows a problem.  I checked\n> the latest git repository of git. There is no change to git-cvsserver.perl.\n>\n> I'm still a bit too newbie to (and not much of a Perl programmer).  Does\n> anyone has a clue?  Do I have\n> the wrong version for something?  Did I setup the repository wrongly?\n>\n> \tThanks --- Jan\n>\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"54713","messageId":"200710031657.08622.wielemak@science.uva.nl","threadId":"10127","inReplyTo":"200710031513.44446.wielemak@science.uva.nl","subject":"Re: git-cvsserver commit trouble (unexpected end of file in client)","fromName":"Jan Wielemaker","fromEmail":"wielemak@science.uva.nl","sentAt":"2007-10-03T14:57:08Z","receivedAt":"2007-10-03T14:57:08Z","isPatch":false,"sender":{"key":"wielemak@science.uva.nl","avatar":null},"body":"On Wednesday 03 October 2007 15:13, Jan Wielemaker wrote:\n> $ mkdir /pub/my-repo.git\n> $ cd /pub/my-repo.git\n> $ git --bare init --shared\n> $ git --bare fetch /home/alice/myproject master:master\n>\n> Checked out freshly using CVS. No problem. But committing a change,\n> nothing changed :-( The log output is exactly the same, showing only\n> refs/heads/master. I'm starting to suspect git-cvsserver afterall, but\n> the docs suggests it is operational for quite a while. Could someone\n> give me a clue on what am I missed?\n\nMore tests ...  As it didn't like the HEAD, and insisted it only knows\nabout master, I though what happens on\n\n\tcvs -d :ext:user@host:/git-repos.git co master\n\n<works fine>\n<edit>\n\tcvs commit\nCommit failed (unknown reason)\n\n:-(  Logfile says:\n\n================================================================\n2007-10-03 16:43:37 : INFO  - req_ci : [NULL]\n2007-10-03 16:43:37 : INFO  - Lockless commit start, basing commit \non '/tmp/VP2P\nVNHPs0/6t4xncbMoN', index file is '/tmp/VP2PVNHPs0/SO4A6pzpau'\n2007-10-03 16:43:37 : INFO  - Start git show-ref -s refs/heads/master\n2007-10-03 16:43:37 : INFO  - Heads: 0b7b372d525a4fe7f662996fec9cd11b1038a6be \nre\nfs/heads/master\n\n2007-10-03 16:43:37 : INFO  - parenthash = \n0b7b372d525a4fe7f662996fec9cd11b1038a\n6be\n\n2007-10-03 16:43:37 : INFO  - Created index '/tmp/VP2PVNHPs0/SO4A6pzpau' with \nfo\nr head master - exit status 0\n2007-10-03 16:43:37 : INFO  - Committing collections-representation.txt\n2007-10-03 16:43:37 : DEBUG - rename /tmp/VP2PVNHPs0/0SfbkMq6AN \ncollections-repr\nesentation.txt\n2007-10-03 16:43:37 : DEBUG - chmod u+rw-x collections-representation.txt\n2007-10-03 16:43:37 : INFO  - Updating file 'collections-representation.txt'\n2007-10-03 16:43:37 : DEBUG - Treehash : \naba0f583177b3b7fca05935452de22612164a7f\n3, Parenthash : 0b7b372d525a4fe7f662996fec9cd11b1038a6be\n2007-10-03 16:43:37 : INFO  - Commit hash :\n2007-10-03 16:43:37 : WARN  - Commit failed (Invalid commit hash)\n================================================================\n\n!? What happens?  Is git-cvsserver completely broken and should I thus\nforget about GIT for now (saying we cannot deal with cvs commit is\npolitically unacceptable in this project)?  Any clue?\n\n\tPlease help\n\n\t\t--- Jan\n"},{"id":"54722","messageId":"Pine.LNX.4.64.0710031711070.28395@racer.site","threadId":"10127","inReplyTo":"200710031348.50800.wielemak@science.uva.nl","subject":"Re: git-cvsserver commit trouble (unexpected end of file in client)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-03T16:11:51Z","receivedAt":"2007-10-03T16:11:51Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 3 Oct 2007, Jan Wielemaker wrote:\n\n> 2007-10-03 12:25:16 : WARN - error 1 pserver cannot find the current \n> HEAD of module\n\nAFAIR we do not allow committing via pserver protocol.  Might that be your \nproblem?\n\nCiao,\nDscho\n"},{"id":"54733","messageId":"200710032042.14842.wielemak@science.uva.nl","threadId":"10127","inReplyTo":"Pine.LNX.4.64.0710031711070.28395@racer.site","subject":"Re: git-cvsserver commit trouble (unexpected end of file in client)","fromName":"Jan Wielemaker","fromEmail":"wielemak@science.uva.nl","sentAt":"2007-10-03T18:42:14Z","receivedAt":"2007-10-03T18:42:14Z","isPatch":false,"sender":{"key":"wielemak@science.uva.nl","avatar":null},"body":"Dscho,\n\nOn Wednesday 03 October 2007 18:11, Johannes Schindelin wrote:\n> Hi,\n>\n> On Wed, 3 Oct 2007, Jan Wielemaker wrote:\n> > 2007-10-03 12:25:16 : WARN - error 1 pserver cannot find the current\n> > HEAD of module\n>\n> AFAIR we do not allow committing via pserver protocol.  Might that be your\n> problem?\n\nThanks, but no. I'm using CVS over SSH. I've been looking around in\ngit-cvsserver source a bit and it aborts quite quickly if you try a\ncommit through pserver. I get a bit further, but it cannot find the HEAD\nrevision for some reason and (from later message), if I try to checkout\nmaster instead of HEAD it finds the revision but I get a hash mismatch.\n\nI've tried a bit debugging this, but in 15 years CVS experience I never\nreally needed to debug the protocol and my GIT experience is only 2\nweeks old :-( \n\nMy hope is I'm doing something fundamentally wrong and git-cvsserver\njust doesn't give a sensible error. I did setup the git repository using\ntwo different routes, one adviced in the CVS conversion manual. GIT\noperations work just fine, so does CVS checkout. I don't think you can\nto that much wrong with cvs over ssh clients, especially if checkout\nworks just fine.\n\nDoes anyone out there has a working GIT <-> CVS+SHH setup? Based on\nwhat version of GIT? Using what route to create the repository?\n\n\tThanks --- Jan\n"},{"id":"54734","messageId":"Pine.LNX.4.64.0710031955090.28395@racer.site","threadId":"10127","inReplyTo":"200710032042.14842.wielemak@science.uva.nl","subject":"Re: git-cvsserver commit trouble (unexpected end of file in client)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-03T18:55:32Z","receivedAt":"2007-10-03T18:55:32Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 3 Oct 2007, Jan Wielemaker wrote:\n\n> On Wednesday 03 October 2007 18:11, Johannes Schindelin wrote:\n> > Hi,\n> >\n> > On Wed, 3 Oct 2007, Jan Wielemaker wrote:\n> > > 2007-10-03 12:25:16 : WARN - error 1 pserver cannot find the current\n> > > HEAD of module\n> >\n> > AFAIR we do not allow committing via pserver protocol.  Might that be \n> > your problem?\n> \n> Thanks, but no. I'm using CVS over SSH. I've been looking around in \n> git-cvsserver source a bit and it aborts quite quickly if you try a \n> commit through pserver. I get a bit further, but it cannot find the HEAD \n> revision for some reason and (from later message), if I try to checkout \n> master instead of HEAD it finds the revision but I get a hash mismatch.\n\nOkay, another stab: is your HEAD detached?\n\nCiao,\nDscho\n"},{"id":"54797","messageId":"200710040927.03977.wielemak@science.uva.nl","threadId":"10127","inReplyTo":"Pine.LNX.4.64.0710032311480.28395@racer.site","subject":"Re: git-cvsserver commit trouble (unexpected end of file in client)","fromName":"Jan Wielemaker","fromEmail":"wielemak@science.uva.nl","sentAt":"2007-10-04T07:27:03Z","receivedAt":"2007-10-04T07:27:03Z","isPatch":false,"sender":{"key":"wielemak@science.uva.nl","avatar":null},"body":"Hi Dscho,\n\nThanks for the comments.  I'll keep in on the list, just in case there is\nsomeone else with a brilliant idea.\n\nOn Thursday 04 October 2007 00:14, you wrote:\n> Hi,\n>\n> On Wed, 3 Oct 2007, Jan Wielemaker wrote:\n> > On Wednesday 03 October 2007 20:55, you wrote:\n> > > On Wed, 3 Oct 2007, Jan Wielemaker wrote:\n> > > > On Wednesday 03 October 2007 18:11, Johannes Schindelin wrote:\n> > > > > Hi,\n> > > > >\n> > > > > On Wed, 3 Oct 2007, Jan Wielemaker wrote:\n> > > > > > 2007-10-03 12:25:16 : WARN - error 1 pserver cannot find the\n> > > > > > current HEAD of module\n> > > > >\n> > > > > AFAIR we do not allow committing via pserver protocol.  Might that\n> > > > > be your problem?\n> > > >\n> > > > Thanks, but no. I'm using CVS over SSH. I've been looking around in\n> > > > git-cvsserver source a bit and it aborts quite quickly if you try a\n> > > > commit through pserver. I get a bit further, but it cannot find the\n> > > > HEAD revision for some reason and (from later message), if I try to\n> > > > checkout master instead of HEAD it finds the revision but I get a\n> > > > hash mismatch.\n> > >\n> > > Okay, another stab: is your HEAD detached?\n> >\n> > I'm a humble git beginner, though I think *my* head is still attached\n> > :-) In any case, we are talking a fresh repository and I can perfectly\n> > well clone it as well as pull and push from the clone using GIT\n> > commands. How do I tell whether the HEAD is detached?\n>\n> You can tell by looking into .git/HEAD (on the side that runs the server).\n> If it is a 40-character hex string, the HEAD is detached.  Otherwise, it\n> should contain something like \"refs/heads/master\".\n\nIts the latter, so my HEAD is still attached. I hope I understand this\ncorrectly, but browsing the docs suggests a detached head is not really\na normal situation, so I'm fine.  Right?\n\n> Other reasons for the failure could be:\n>\n> \t- your user does not have write access\n\nDefinitely ok (also put an strace -o logfile git-cvsserver \"$@\" script\naround it.  No alarming permission or non-existence errors).\n\n> \t- the uid under which git-cvsserver runs has no write access\n\nSee above\n\n> \t- you found an error that only triggers with your repo\n\nGreat!  Its so damn simple and and tried with three repos created\nin three different ways, that I'm either extremely unlucky or many\nmore should be faced with this or nobody uses git-cvsserver.\n\nI'm hoping for a command-by-command sequence that gets me a definitely\nfine repository, so at least I can see it running correctly once.  Then\nmaybe I can analyse traces in detail to see where they differ and what\nis wrong.  Somebody?\n\n\tThanks --- Jan\n"},{"id":"54808","messageId":"46823.146.50.26.20.1191496739.squirrel@webmail.science.uva.nl","threadId":"10127","inReplyTo":"200710040927.03977.wielemak@science.uva.nl","subject":"Re: git-cvsserver commit trouble BUG+Work-around","fromName":"Jan Wielemaker","fromEmail":"wielemak@science.uva.nl","sentAt":"2007-10-04T11:18:59Z","receivedAt":"2007-10-04T11:18:59Z","isPatch":false,"sender":{"key":"wielemak@science.uva.nl","avatar":null},"body":"\n>> Other reasons for the failure could be:\n>>\n>> \t- your user does not have write access\n>\n> Definitely ok (also put an strace -o logfile git-cvsserver \"$@\" script\n> around it.  No alarming permission or non-existence errors).\n>\n>> \t- the uid under which git-cvsserver runs has no write access\n>\n> See above\n>\n>> \t- you found an error that only triggers with your repo\n>\n> Great!  Its so damn simple and and tried with three repos created\n> in three different ways, that I'm either extremely unlucky or many\n> more should be faced with this or nobody uses git-cvsserver.\n\nFinally getting at what is either a bug in git-show-ref or\ngit-cvsserver.  I retried the whole lot using git-1.5.3.4:\n\n<create initial repository>\n\t% Created /home/jan/tmp/test/, added a file README with some text\n\t% git-init\n\t% git-add .\n\t% git-commit\n\n<create bare one for sharing>\n\t% cd /home/git\n\t% mkdir test.git\n\t% cd test.git\n\t% git --bare init --shared\n\t% git --bare fetch /home/jan/tmp/test master:master\n\t% git-config gitcvs.enabled 1\n\t% git-config gitcvs.logfile `pwd`/cvs.log\n\t% touch cvs.log\n\t% chmod g+w cvs.log\n\t% chgrp -R eculture .\n\n<checkout>\n\n\t% export CVS_SERVER=git-cvsserver\n\t% cvs -d:ext:jan@localhost:/home/git/test.git co HEAD\n\t% cd HEAD\n\t% emacs README\n\t% cvs commit -m test\n\tcvs [commit aborted]: end of file from server (consult above messages if\nany)\n\nSame user, so we should not have permission rights. Indeed, the trouble\nis here: git-cvsserver, near line 1203:\n\n    my $parenthash = `git show-ref -s refs/heads/$state->{module}`;\n\n$state->{module} is -of course- HEAD. git show-ref -s  refs/heads/HEAD\nindeed gives no output. git show-ref -s refs/heads/master works just\nfine.  HEAD in the repo says:\n\ngollem (test.git) 2_> cat HEAD\nref: refs/heads/master\n\nI guess this link must be picked up by either git-cvsserver or\ngit-show-ref. Right? Anyway, if I add the line marked + to\ngit-cvsserver, cvs commit and cvs add operations appear to work (I\nassume only if I work on the HEAD).\n\n    $ENV{GIT_INDEX_FILE} = $file_index;\n\n+   $state->{module} = \"master\";\n\n    # Remember where the head was at the beginning.\n\nThanks for the comments. Really worrying is that such a big flaw can be\nin stable git and remain their for at least 3 patch levels unnoticed.\n\nWill someone take care of this and fix it properly in the right place\ninstead of this dirty hack?\n\n\tThanks --- Jan\n"},{"id":"54814","messageId":"Pine.LNX.4.64.0710041352480.4174@racer.site","threadId":"10127","inReplyTo":"46823.146.50.26.20.1191496739.squirrel@webmail.science.uva.nl","subject":"Re: git-cvsserver commit trouble BUG+Work-around","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-04T12:56:00Z","receivedAt":"2007-10-04T12:56:00Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 4 Oct 2007, Jan Wielemaker wrote:\n\n> Indeed, the trouble is here: git-cvsserver, near line 1203:\n> \n>     my $parenthash = `git show-ref -s refs/heads/$state->{module}`;\n> \n> $state->{module} is -of course- HEAD. git show-ref -s refs/heads/HEAD \n> indeed gives no output. git show-ref -s refs/heads/master works just \n> fine.\n\nAh!  Did you do \"CVSROOT=:ext:blablub cvs co HEAD\"?\n\nYou should \"co master\".  The branches in git are the modules in cvs.\n\nHEAD is too volatile, you cannot make a proper module from it (imagine for \nexample \"git checkout next\" where \"next\" is a branch, followed by \"git \ncheckout html\", where \"html\" is another branch).\n\nCiao,\nDscho\n"},{"id":"54819","messageId":"200710041506.13154.wielemak@science.uva.nl","threadId":"10127","inReplyTo":"Pine.LNX.4.64.0710041352480.4174@racer.site","subject":"Re: git-cvsserver commit trouble BUG+Work-around","fromName":"Jan Wielemaker","fromEmail":"wielemak@science.uva.nl","sentAt":"2007-10-04T13:06:12Z","receivedAt":"2007-10-04T13:06:12Z","isPatch":false,"sender":{"key":"wielemak@science.uva.nl","avatar":null},"body":"Hi Dscho,\n\nOn Thursday 04 October 2007 14:56, Johannes Schindelin wrote:\n> On Thu, 4 Oct 2007, Jan Wielemaker wrote:\n> > Indeed, the trouble is here: git-cvsserver, near line 1203:\n> >\n> >     my $parenthash = `git show-ref -s refs/heads/$state->{module}`;\n> >\n> > $state->{module} is -of course- HEAD. git show-ref -s refs/heads/HEAD\n> > indeed gives no output. git show-ref -s refs/heads/master works just\n> > fine.\n>\n> Ah!  Did you do \"CVSROOT=:ext:blablub cvs co HEAD\"?\n\nYip ...\n\n> You should \"co master\".  The branches in git are the modules in cvs.\n>\n> HEAD is too volatile, you cannot make a proper module from it (imagine for\n> example \"git checkout next\" where \"next\" is a branch, followed by \"git\n> checkout html\", where \"html\" is another branch).\n\nOk.  Pretty sure I got literal HEAD from one of the examples somewhere ...\nOr, I've been blind all along.  Anyway, the maintainer may consider giving\nan error when trying to access HEAD as a module.  Would have saved about\n2 days work and its unlikely I'm the last victim :-(\n\nPart of the two days is that during all the things I tried somehow\nmessed up with master too, so the one time I tried that it failed as\nwell :-(\n\nAnyway, case closed.  On with the testing ...\n\n\tThanks --- Jan\n"},{"id":"54833","messageId":"Pine.LNX.4.64.0710041622070.4174@racer.site","threadId":"10127","inReplyTo":"200710041506.13154.wielemak@science.uva.nl","subject":"[PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-04T15:29:04Z","receivedAt":"2007-10-04T15:29:04Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nIt does not make sense to check out tags or \"HEAD\".\n\nNoticed by Jan Wielemaker.\n\n---\n\n\tOn Thu, 4 Oct 2007, Jan Wielemaker wrote:\n\n\t> On Thursday 04 October 2007 14:56, Johannes Schindelin wrote:\n\t>\n\t> > Ah!  Did you do \"CVSROOT=:ext:blablub cvs co HEAD\"?\n\t> \n\t> Yip ...\n\t> \n\t> > You should \"co master\".  The branches in git are the modules \n\t> > in cvs.\n\t> >\n\t> > HEAD is too volatile, you cannot make a proper module from it \n\t> > (imagine for example \"git checkout next\" where \"next\" is a \n\t> > branch, followed by \"git checkout html\", where \"html\" is \n\t> > another branch).\n\t> \n\t> Ok.  Pretty sure I got literal HEAD from one of the examples \n\t> somewhere ... Or, I've been blind all along.  Anyway, the \n\t> maintainer may consider giving an error when trying to access \n\t> HEAD as a module.  Would have saved about 2 days work and its \n\t> unlikely I'm the last victim :-(\n\n\tThis patch is completely untested.  Could you try it, please?\n\n\tIf it works:\n\tSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n\tCc'ed Frank, who is de-facto maintainer (according to shortlog) \n\tand Martin, who started it all IIRC.\n\n git-cvsserver.perl |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex 13dbd27..869690c 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -770,6 +770,14 @@ sub req_co\n \n     $log->debug(\"req_co : \" . ( defined($data) ? $data : \"[NULL]\" ) );\n \n+    if( system(\"git\", \"rev-parse\", \"--verify\", \"refs/heads/$module\" ) != 0 )\n+    {\n+\t$log->warn(\"Checkout failed: $module is not a branch\");\n+\tprint \"error 1 Checkout failed: $module is not a branch\\n\";\n+\tchdir \"/\";\n+\texit;\n+    }\n+\n     $log->info(\"Checking out module '$module' ($state->{CVSROOT}) to '$checkout_path'\");\n \n     $ENV{GIT_DIR} = $state->{CVSROOT} . \"/\";\n"},{"id":"54847","messageId":"20071004161812.GA31659@planck.djpig.de","threadId":"10127","inReplyTo":"Pine.LNX.4.64.0710041622070.4174@racer.site","subject":"Re: [PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-10-04T16:18:12Z","receivedAt":"2007-10-04T16:18:12Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Thu, Oct 04, 2007 at 04:29:04PM +0100, Johannes Schindelin wrote:\n> \tCc'ed Frank, who is de-facto maintainer (according to shortlog) \n> \tand Martin, who started it all IIRC.\n> \n> diff --git a/git-cvsserver.perl b/git-cvsserver.perl\n> index 13dbd27..869690c 100755\n> --- a/git-cvsserver.perl\n> +++ b/git-cvsserver.perl\n> @@ -770,6 +770,14 @@ sub req_co\n>  \n>      $log->debug(\"req_co : \" . ( defined($data) ? $data : \"[NULL]\" ) );\n>  \n> +    if( system(\"git\", \"rev-parse\", \"--verify\", \"refs/heads/$module\" ) != 0 )\n> +    {\n> +\t$log->warn(\"Checkout failed: $module is not a branch\");\n> +\tprint \"error 1 Checkout failed: $module is not a branch\\n\";\n> +\tchdir \"/\";\n> +\texit;\n> +    }\n> +\n>      $log->info(\"Checking out module '$module' ($state->{CVSROOT}) to '$checkout_path'\");\n>  \n>      $ENV{GIT_DIR} = $state->{CVSROOT} . \"/\";\n\nLooks good, haven't tested it yet, though. Care to add a testcase\nor should I take care of that?\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"54850","messageId":"Pine.LNX.4.64.0710041731550.4174@racer.site","threadId":"10127","inReplyTo":"20071004161812.GA31659@planck.djpig.de","subject":"Re: [PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-04T16:32:19Z","receivedAt":"2007-10-04T16:32:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 4 Oct 2007, Frank Lichtenheld wrote:\n\n> On Thu, Oct 04, 2007 at 04:29:04PM +0100, Johannes Schindelin wrote:\n> > \tCc'ed Frank, who is de-facto maintainer (according to shortlog) \n> > \tand Martin, who started it all IIRC.\n> > \n> > diff --git a/git-cvsserver.perl b/git-cvsserver.perl\n> > index 13dbd27..869690c 100755\n> > --- a/git-cvsserver.perl\n> > +++ b/git-cvsserver.perl\n> > @@ -770,6 +770,14 @@ sub req_co\n> >  \n> >      $log->debug(\"req_co : \" . ( defined($data) ? $data : \"[NULL]\" ) );\n> >  \n> > +    if( system(\"git\", \"rev-parse\", \"--verify\", \"refs/heads/$module\" ) != 0 )\n> > +    {\n> > +\t$log->warn(\"Checkout failed: $module is not a branch\");\n> > +\tprint \"error 1 Checkout failed: $module is not a branch\\n\";\n> > +\tchdir \"/\";\n> > +\texit;\n> > +    }\n> > +\n> >      $log->info(\"Checking out module '$module' ($state->{CVSROOT}) to '$checkout_path'\");\n> >  \n> >      $ENV{GIT_DIR} = $state->{CVSROOT} . \"/\";\n> \n> Looks good, haven't tested it yet, though. Care to add a testcase\n> or should I take care of that?\n\nI would be eternally thankful if you could add the test case, since I am \nreally short on time.\n\nCiao,\nDscho\n"},{"id":"54856","messageId":"200710041906.21004.wielemak@science.uva.nl","threadId":"10127","inReplyTo":"Pine.LNX.4.64.0710041622070.4174@racer.site","subject":"Re: [PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Jan Wielemaker","fromEmail":"wielemak@science.uva.nl","sentAt":"2007-10-04T17:06:20Z","receivedAt":"2007-10-04T17:06:20Z","isPatch":true,"sender":{"key":"wielemak@science.uva.nl","avatar":null},"body":"On Thursday 04 October 2007 17:29, Johannes Schindelin wrote:\n> It does not make sense to check out tags or \"HEAD\".\n>\n> Noticed by Jan Wielemaker.\n\nThanks (though it won't bite me a second time :-)\n\n> ) +    {\n> +\t$log->warn(\"Checkout failed: $module is not a branch\");\n> +\tprint \"error 1 Checkout failed: $module is not a branch\\n\";\n\nThere are various places where it says print \"...\", one that even\nstarted some suggestion on what might be wrong, but these things don't\nend up at a visible place when using ssh as transport. Its a good idea\nthis one is at least in the logfile as well. Not sure, but might\nprinting to stderr work better?\n\n\tCheers --- Jan\n"},{"id":"54857","messageId":"Pine.LNX.4.64.0710041816230.4174@racer.site","threadId":"10127","inReplyTo":"200710041906.21004.wielemak@science.uva.nl","subject":"Re: [PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-04T17:18:59Z","receivedAt":"2007-10-04T17:18:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 4 Oct 2007, Jan Wielemaker wrote:\n\n> On Thursday 04 October 2007 17:29, Johannes Schindelin wrote:\n> > It does not make sense to check out tags or \"HEAD\".\n> >\n> > Noticed by Jan Wielemaker.\n> \n> Thanks (though it won't bite me a second time :-)\n\nHeh.  But this is Open Source, so we can make it better for others, too.  \nThank you for spending so much time on this, and actually uncovering that \nerror in cvsserver!\n\n> > ) +    {\n> > +\t$log->warn(\"Checkout failed: $module is not a branch\");\n> > +\tprint \"error 1 Checkout failed: $module is not a branch\\n\";\n> \n> There are various places where it says print \"...\", one that even\n> started some suggestion on what might be wrong, but these things don't\n> end up at a visible place when using ssh as transport. Its a good idea\n> this one is at least in the logfile as well. Not sure, but might\n> printing to stderr work better?\n\nI think not.  AFAICT stderr is not visible with cvs either.  I somewhat \nhoped that the \"error 1\" was an indicator to the cvs client to show the \nmessage, but that's way beyond my knowledge...\n\nCiao,\nDscho\n"},{"id":"54861","messageId":"20071004180443.GB31659@planck.djpig.de","threadId":"10127","inReplyTo":"200710041906.21004.wielemak@science.uva.nl","subject":"Re: [PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-10-04T18:04:44Z","receivedAt":"2007-10-04T18:04:44Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Thu, Oct 04, 2007 at 07:06:20PM +0200, Jan Wielemaker wrote:\n> On Thursday 04 October 2007 17:29, Johannes Schindelin wrote:\n> > ) +    {\n> > +\t$log->warn(\"Checkout failed: $module is not a branch\");\n> > +\tprint \"error 1 Checkout failed: $module is not a branch\\n\";\n> \n> There are various places where it says print \"...\", one that even\n> started some suggestion on what might be wrong, but these things don't\n> end up at a visible place when using ssh as transport. Its a good idea\n\nhuh?\n\n$ CVS_SERVER=/home/djpig/devel/git/git-cvsserver cvs -d :ext:localhost:/home/djpig/devel/gitcvs.git/ co -d cvswork HEAD \ndjpig@localhost's password: \nserver doesn't support gzip-file-contents\nfatal: Needed a single revision\nCheckout failed: HEAD is not a branch\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"54878","messageId":"20071004211555.GG31659@planck.djpig.de","threadId":"10127","inReplyTo":"Pine.LNX.4.64.0710041622070.4174@racer.site","subject":"Re: [PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-10-04T21:15:57Z","receivedAt":"2007-10-04T21:15:57Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Thu, Oct 04, 2007 at 04:29:04PM +0100, Johannes Schindelin wrote:\n> diff --git a/git-cvsserver.perl b/git-cvsserver.perl\n> index 13dbd27..869690c 100755\n> --- a/git-cvsserver.perl\n> +++ b/git-cvsserver.perl\n> @@ -770,6 +770,14 @@ sub req_co\n>  \n>      $log->debug(\"req_co : \" . ( defined($data) ? $data : \"[NULL]\" ) );\n>  \n> +    if( system(\"git\", \"rev-parse\", \"--verify\", \"refs/heads/$module\" ) != 0 )\n> +    {\n> +\t$log->warn(\"Checkout failed: $module is not a branch\");\n> +\tprint \"error 1 Checkout failed: $module is not a branch\\n\";\n> +\tchdir \"/\";\n> +\texit;\n> +    }\n> +\n>      $log->info(\"Checking out module '$module' ($state->{CVSROOT}) to '$checkout_path'\");\n>  \n>      $ENV{GIT_DIR} = $state->{CVSROOT} . \"/\";\n\nI've found a problem with the patch. Since git-rev-parse will produce\noutput (which will end up at the client and confuse it), we will have to use a fork/exec\ncombination instead of system to be able to close STDOUT and STDERR of the child.\n\nShould I sent a patch on top of this one or as a replacement?\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"54881","messageId":"Pine.LNX.4.64.0710042248330.4174@racer.site","threadId":"10127","inReplyTo":"20071004211555.GG31659@planck.djpig.de","subject":"Re: [PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-04T21:49:03Z","receivedAt":"2007-10-04T21:49:03Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 4 Oct 2007, Frank Lichtenheld wrote:\n\n> On Thu, Oct 04, 2007 at 04:29:04PM +0100, Johannes Schindelin wrote:\n> > diff --git a/git-cvsserver.perl b/git-cvsserver.perl\n> > index 13dbd27..869690c 100755\n> > --- a/git-cvsserver.perl\n> > +++ b/git-cvsserver.perl\n> > @@ -770,6 +770,14 @@ sub req_co\n> >  \n> >      $log->debug(\"req_co : \" . ( defined($data) ? $data : \"[NULL]\" ) );\n> >  \n> > +    if( system(\"git\", \"rev-parse\", \"--verify\", \"refs/heads/$module\" ) != 0 )\n> > +    {\n> > +\t$log->warn(\"Checkout failed: $module is not a branch\");\n> > +\tprint \"error 1 Checkout failed: $module is not a branch\\n\";\n> > +\tchdir \"/\";\n> > +\texit;\n> > +    }\n> > +\n> >      $log->info(\"Checking out module '$module' ($state->{CVSROOT}) to '$checkout_path'\");\n> >  \n> >      $ENV{GIT_DIR} = $state->{CVSROOT} . \"/\";\n> \n> I've found a problem with the patch. Since git-rev-parse will produce\n> output (which will end up at the client and confuse it), we will have to use a fork/exec\n> combination instead of system to be able to close STDOUT and STDERR of the child.\n> \n> Should I sent a patch on top of this one or as a replacement?\n\nBetter a replacement.  Otherwise I have to fly to California with a brown \npaper bag over my HEAD.\n\nCiao,\nDscho\n"},{"id":"54883","messageId":"20071004215502.GO2137@spearce.org","threadId":"10127","inReplyTo":"Pine.LNX.4.64.0710042248330.4174@racer.site","subject":"Re: [PATCH/RFT] cvsserver: only allow checkout of branches","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-04T21:55:02Z","receivedAt":"2007-10-04T21:55:02Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Thu, 4 Oct 2007, Frank Lichtenheld wrote:\n> > \n> > Should I sent a patch on top of this one or as a replacement?\n> \n> Better a replacement.  Otherwise I have to fly to California with a brown \n> paper bag over my HEAD.\n\nThat may be the safer way to travel.  If your head is in a bag you\nhave no idea what sort of wait in the security line you are about\nto face.  Or what horrible movie they are showing you on the flight\nboth over *and* back.\n\n-- \nShawn.\n"}]}