{"thread":{"id":"8336","subject":"[PATCH] t9400: Work around CVS' deficiencies","startedAt":"2007-05-27T12:33:05Z","lastAt":"2007-05-27T12:33:10Z","messageCount":6,"participants":["Frank Lichtenheld"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"43410","messageId":"1180269190126-git-send-email-frank@lichtenheld.de","threadId":"8336","inReplyTo":null,"subject":"Various git-cvsserver patches","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-27T12:33:05Z","receivedAt":"2007-05-27T12:33:05Z","isPatch":false,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"Frank Lichtenheld (5):\n      cvsserver: Correct inetd.conf example in asciidoc documentation\n      cvsserver: Note that CVS_SERVER can also be specified as method variable\n      cvsserver: Fix some typos in asciidoc documentation\n      t9400: Work around CVS' deficiencies\n      cvsserver: Handle 'cvs login'\n\n Documentation/git-cvsserver.txt |   27 ++++++++++++++++++---------\n git-cvsserver.perl              |    8 +++++---\n t/t9400-git-cvsserver-server.sh |   33 +++++++++++++++++++++++++++++++--\n 3 files changed, 54 insertions(+), 14 deletions(-)\n\nThe first three patches are some fixes/improvements to the asciidoc\ndocumentation. Just some random stuff that I noticed while working\non git-cvsserver.\n\nThe forth one is a good example how much CVS actually sucks\nregarding data security and deterministic behaviour.\n\nAll of these should be suitable for maint.\n\nThe fifth is a small feature enhancement for git-cvsserver. It\nadds support for 'cvs login' over pserver.\n\nI think this is trivial enough to go to master directly, but feel free\nto let it rot in next first.\n"},{"id":"43411","messageId":"1180269190852-git-send-email-frank@lichtenheld.de","threadId":"8336","inReplyTo":"1180269190126-git-send-email-frank@lichtenheld.de","subject":"[PATCH] cvsserver: Correct inetd.conf example in asciidoc documentation","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-27T12:33:06Z","receivedAt":"2007-05-27T12:33:06Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"While the given example worked, it made us look rather\nincompetent. Give the correct reason why one needs the\nmore complex syntax and change the example to reflect\nthat.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n Documentation/git-cvsserver.txt |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt\nindex d22844b..9f0d990 100644\n--- a/Documentation/git-cvsserver.txt\n+++ b/Documentation/git-cvsserver.txt\n@@ -46,11 +46,13 @@ INSTALLATION\n    cvspserver stream tcp nowait nobody git-cvsserver pserver\n \n ------\n-Note: In some cases, you need to pass the 'pserver' argument twice for\n-git-cvsserver to see it. So the line would look like\n+Note: Some inetd servers let you specify the name of the executable\n+independently of the value of argv[0] (i.e. the name the program assumes\n+it was executed with). In this case the correct line in /etc/inetd.conf\n+looks like\n \n ------\n-   cvspserver stream tcp nowait nobody git-cvsserver pserver pserver\n+   cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver\n \n ------\n No special setup is needed for SSH access, other than having GIT tools\n-- \n1.5.2-rc3.GIT\n"},{"id":"43413","messageId":"1180269200838-git-send-email-frank@lichtenheld.de","threadId":"8336","inReplyTo":"1180269190126-git-send-email-frank@lichtenheld.de","subject":"[PATCH] cvsserver: Note that CVS_SERVER can also be specified as method variable","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-27T12:33:07Z","receivedAt":"2007-05-27T12:33:07Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"Reasonably new versions of the cvs CLI client allow one to\nspecifiy CVS_SERVER as a method variable directly in\nCVSROOT. This is way more convinient than using an\nenvironment variable since it gets saved in CVS/Root.\n\nSince I only discovered this by accident I guess there\nmight be others out there that learnt CVS on the 1.11\nseries (or even earlier) and profit from such a note\nabout cvs improvements in the last couple years.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n Documentation/git-cvsserver.txt |   12 +++++++++++-\n 1 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt\nindex 9f0d990..ca7579d 100644\n--- a/Documentation/git-cvsserver.txt\n+++ b/Documentation/git-cvsserver.txt\n@@ -57,7 +57,17 @@ looks like\n ------\n No special setup is needed for SSH access, other than having GIT tools\n in the PATH. If you have clients that do not accept the CVS_SERVER\n-env variable, you can rename git-cvsserver to cvs.\n+environment variable, you can rename git-cvsserver to cvs.\n+\n+Note: Newer cvs versions (>= 1.12.11) also support specifying\n+CVS_SERVER directly in CVSROOT like\n+\n+------\n+cvs -d \":ext;CVS_SERVER=git-cvsserver:user@server/path/repo.git\" co <HEAD_name>\n+------\n+This has the advantage that it will be saved in your 'CVS/Root' files and\n+you don't need to worry about always setting the correct environment\n+variable.\n --\n 2. For each repo that you want accessible from CVS you need to edit config in\n    the repo and add the following section.\n-- \n1.5.2-rc3.GIT\n"},{"id":"43412","messageId":"11802692101535-git-send-email-frank@lichtenheld.de","threadId":"8336","inReplyTo":"1180269190126-git-send-email-frank@lichtenheld.de","subject":"[PATCH] cvsserver: Fix some typos in asciidoc documentation","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-27T12:33:08Z","receivedAt":"2007-05-27T12:33:08Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n Documentation/git-cvsserver.txt |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt\nindex ca7579d..e5005f0 100644\n--- a/Documentation/git-cvsserver.txt\n+++ b/Documentation/git-cvsserver.txt\n@@ -86,7 +86,7 @@ write access to the log file and to the database (see\n SSH, the users of course also need write access to the git repository itself.\n \n [[configaccessmethod]]\n-All configuration variables can also be overriden for a specific method of\n+All configuration variables can also be overridden for a specific method of\n access. Valid method names are \"ext\" (for SSH access) and \"pserver\". The\n following example configuration would disable pserver access while still\n allowing access over SSH.\n@@ -128,7 +128,7 @@ Database Backend\n \n git-cvsserver uses one database per git head (i.e. CVS module) to\n store information about the repository for faster access. The\n-database doesn't contain any persitent data and can be completly\n+database doesn't contain any persistent data and can be completely\n regenerated from the git repository at any time. The database\n needs to be updated (i.e. written to) after every commit.\n \n-- \n1.5.2-rc3.GIT\n"},{"id":"43408","messageId":"11802692201027-git-send-email-frank@lichtenheld.de","threadId":"8336","inReplyTo":"1180269190126-git-send-email-frank@lichtenheld.de","subject":"[PATCH] t9400: Work around CVS' deficiencies","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-27T12:33:09Z","receivedAt":"2007-05-27T12:33:09Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"If we are too fast with our changes, the file in\nthe working copy might still have the same mtime\nas noted in the CVS/Entries. This will cause CVS\nto happily report to the server that the file is\nunmodified which can lead to data loss (and in\nour case test failure).\n\nCVS sucks!\n\nWork around that by sleeping for a second.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n t/t9400-git-cvsserver-server.sh |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex 7f9c6e2..76a9b1a 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -250,6 +250,7 @@ test_expect_success 'cvs update (merge)' \\\n    git commit -q -m \"Merge test (merge)\" &&\n    git push gitcvs.git >/dev/null &&\n    cd cvswork &&\n+   sleep 1 && touch merge &&\n    GIT_CONFIG=\"$git_config\" cvs -Q update &&\n    diff -q merge ../expected'\n \n@@ -292,6 +293,7 @@ test_expect_success 'cvs update (merge no-op)' \\\n     git commit -q -m \"Merge test (no-op)\" &&\n     git push gitcvs.git >/dev/null &&\n     cd cvswork &&\n+    sleep 1 && touch merge &&\n     GIT_CONFIG=\"$git_config\" cvs -Q update &&\n     diff -q merge ../merge'\n \n-- \n1.5.2-rc3.GIT\n"},{"id":"43409","messageId":"11802692303581-git-send-email-frank@lichtenheld.de","threadId":"8336","inReplyTo":"1180269190126-git-send-email-frank@lichtenheld.de","subject":"[PATCH] cvsserver: Handle 'cvs login'","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-27T12:33:10Z","receivedAt":"2007-05-27T12:33:10Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"Since this is a trivial variation of the general pserver\nauthentication, there is really no reason not to support\nit.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n git-cvsserver.perl              |    8 +++++---\n t/t9400-git-cvsserver-server.sh |   29 +++++++++++++++++++++++++++++\n 2 files changed, 34 insertions(+), 3 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex 1de5177..2b4825a 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -95,9 +95,10 @@ $state->{method} = 'ext';\n if (@ARGV && $ARGV[0] eq 'pserver') {\n     $state->{method} = 'pserver';\n     my $line = <STDIN>; chomp $line;\n-    unless( $line eq 'BEGIN AUTH REQUEST') {\n+    unless( $line =~ /^BEGIN (AUTH|VERIFICATION) REQUEST$/) {\n        die \"E Do not understand $line - expecting BEGIN AUTH REQUEST\\n\";\n     }\n+    my $request = $1;\n     $line = <STDIN>; chomp $line;\n     req_Root('root', $line) # reuse Root\n        or die \"E Invalid root $line \\n\";\n@@ -109,10 +110,11 @@ if (@ARGV && $ARGV[0] eq 'pserver') {\n     }\n     $line = <STDIN>; chomp $line;    # validate the password?\n     $line = <STDIN>; chomp $line;\n-    unless ($line eq 'END AUTH REQUEST') {\n-       die \"E Do not understand $line -- expecting END AUTH REQUEST\\n\";\n+    unless ($line eq \"END $request REQUEST\") {\n+       die \"E Do not understand $line -- expecting END $request REQUEST\\n\";\n     }\n     print \"I LOVE YOU\\n\";\n+    exit if $request eq 'VERIFICATION'; # cvs login\n     # and now back to our regular programme...\n }\n \ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex 76a9b1a..e9ef315 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -67,6 +67,22 @@ git\n END AUTH REQUEST\n EOF\n \n+cat >login-anonymous <<EOF\n+BEGIN VERIFICATION REQUEST\n+$SERVERDIR\n+anonymous\n+\n+END VERIFICATION REQUEST\n+EOF\n+\n+cat >login-git <<EOF\n+BEGIN VERIFICATION REQUEST\n+$SERVERDIR\n+git\n+\n+END VERIFICATION REQUEST\n+EOF\n+\n test_expect_success 'pserver authentication' \\\n   'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&\n    tail -n1 log | grep -q \"^I LOVE YOU$\"'\n@@ -80,6 +96,19 @@ test_expect_success 'pserver authentication failure (non-anonymous user)' \\\n    fi &&\n    tail -n1 log | grep -q \"^I HATE YOU$\"'\n \n+test_expect_success 'pserver authentication (login)' \\\n+  'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&\n+   tail -n1 log | grep -q \"^I LOVE YOU$\"'\n+\n+test_expect_success 'pserver authentication failure (login/non-anonymous user)' \\\n+  'if cat login-git | git-cvsserver pserver >log 2>&1\n+   then\n+       false\n+   else\n+       true\n+   fi &&\n+   tail -n1 log | grep -q \"^I HATE YOU$\"'\n+\n \n #--------------\n # CONFIG TESTS\n-- \n1.5.2-rc3.GIT\n"}]}