{"thread":{"id":"24743","subject":"[BUG RFC/PATCH] git-cvsimport","startedAt":"2010-08-14T15:33:07Z","lastAt":"2010-08-16T17:43:06Z","messageCount":6,"participants":["Ævar Arnfjörð Bjarmason","Jonathan Nieder","Michael Haggerty","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"148092","messageId":"AANLkTikxxqgNpmqfFQq+5GVd7VAW2DTaro5anRHcx6Tt@mail.gmail.com","threadId":"24743","inReplyTo":null,"subject":"[BUG RFC/PATCH] git-cvsimport","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-14T15:33:07Z","receivedAt":"2010-08-14T15:33:07Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This is more of a BUG than a RFC/PATCH.\n\nNow that Junio has applied my patch to not write test results under\nharness I can:\n\n    sudo chown -R root t\n\nAnd run the tests with --root=/dev/shm under prove, except for 3\ngit-cvsimport tests. I have pending patches to these, after they'll\nget in I'll fix that.\n\nBut the reason they hang is interesting:\n\n    rm -rf /tmp/meh;\n    git init /tmp/meh &&\n    cd /tmp/meh &&\n    sudo chown -R root /home/avar/g/git/t/t9601/cvsroot &&\n    cvsps --norc -q --cvs-direct -u -A --root\n/home/avar/g/git/t/t9601/cvsroot module\n    Initialized empty Git repository in /tmp/meh/.git/\n\ncvsps will just hang due to the unfriendly chmod. Maybe we want\nsomething like the below to deal with that.\n\nHowever, even then it'll still hang on something else, I haven't\nlooked into what. I'm just going to fix this by having it copy the\nthings it needs to the --root directory.\n\n git-cvsimport.perl |   21 +++++++++++++++++++--\n 1 files changed, 19 insertions(+), 2 deletions(-)\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex 9e03eee..1a93fb4 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -688,8 +688,25 @@ unless ($opt_P) {\n        }\n        ($cvspsfh, $cvspsfile) = tempfile('gitXXXXXX', SUFFIX => '.cvsps',\n                                          DIR => File::Spec->tmpdir());\n-       while (<CVSPS>) {\n-           print $cvspsfh $_;\n+       # Alarm because \"cvsps --norc -q --cvs-direct -u -A --root\n+       # /home/avar/g/git/t/t9601/cvsroot module\" will hang forever if\n+       # the \"t9601/cvsroot\" directory isn't writable by us.\n+       {\n+               my $got_input;\n+               my $start = time;\n+               local $SIG{ALRM} = sub {\n+                       unless ($got_input) {\n+                               die sprintf \"cvsps left us hanging for\n%d seconds, do you have permission to write to %s?\",\n+                                   time() - $start,\n+                                   $opt_d;\n+                       }\n+               };\n+               alarm 10;\n+               while (<CVSPS>) {\n+                       $got_input = 1;\n+                       print $cvspsfh $_;\n+               }\n+               alarm 0;\n        }\n        close CVSPS;\n        $? == 0 or die \"git cvsimport: fatal: cvsps reported error\\n\";\n"},{"id":"148108","messageId":"20100814210928.GC2372@burratino","threadId":"24743","inReplyTo":"AANLkTikxxqgNpmqfFQq+5GVd7VAW2DTaro5anRHcx6Tt@mail.gmail.com","subject":"Re: [BUG RFC/PATCH] git-cvsimport","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-14T21:09:28Z","receivedAt":"2010-08-14T21:09:28Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> cvsps will just hang due to the unfriendly chmod.\n\nCould this be fixed in cvsps[1]?\n\n(Afterwards, it might still make sense to look into workarounds, of\ncourse.)\n\n[1] http://ydirson.free.fr/en/software/scm/cvsps.html\n"},{"id":"148111","messageId":"AANLkTimxaVZC7j7Dwz-vLSPU2Na=b9zEC+8HsS7wF6Sc@mail.gmail.com","threadId":"24743","inReplyTo":"20100814210928.GC2372@burratino","subject":"Re: [BUG RFC/PATCH] git-cvsimport","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-14T21:39:00Z","receivedAt":"2010-08-14T21:39:00Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sat, Aug 14, 2010 at 21:09, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> cvsps will just hang due to the unfriendly chmod.\n>\n> Could this be fixed in cvsps[1]?\n\nMaybe, but that's a hairy beast I'm not going to tackle :)\n\nThe main intent was actually just to get this into the collective\nmemory of the list archive, this sort of thing probably never happens\nin the wild, and the added alarm/die complexity of dealing with it\nprobably isn't worth the effort.\n\nI'm going to fix up the test though, once Junio merges my other\npatches, which would conflict with this.\n"},{"id":"148177","messageId":"4C68BD66.9060506@alum.mit.edu","threadId":"24743","inReplyTo":"AANLkTikxxqgNpmqfFQq+5GVd7VAW2DTaro5anRHcx6Tt@mail.gmail.com","subject":"Re: [BUG RFC/PATCH] git-cvsimport","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2010-08-16T04:24:06Z","receivedAt":"2010-08-16T04:24:06Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> This is more of a BUG than a RFC/PATCH.\n> \n> Now that Junio has applied my patch to not write test results under\n> harness I can:\n> \n>     sudo chown -R root t\n> \n> And run the tests with --root=/dev/shm under prove, except for 3\n> git-cvsimport tests. I have pending patches to these, after they'll\n> get in I'll fix that.\n> \n> But the reason they hang is interesting:\n> \n>     rm -rf /tmp/meh;\n>     git init /tmp/meh &&\n>     cd /tmp/meh &&\n>     sudo chown -R root /home/avar/g/git/t/t9601/cvsroot &&\n>     cvsps --norc -q --cvs-direct -u -A --root\n> /home/avar/g/git/t/t9601/cvsroot module\n>     Initialized empty Git repository in /tmp/meh/.git/\n> \n> cvsps will just hang due to the unfriendly chmod. Maybe we want\n> something like the below to deal with that.\n> \n> However, even then it'll still hang on something else, I haven't\n> looked into what. I'm just going to fix this by having it copy the\n> things it needs to the --root directory.\n\nMy guess is that cvsps is using CVS commands to access the test CVS\nrepository, and that CVS wants to write to the file CVSROOT/history to\nlog what is being done.  The logging behavior can be turned off either:\n\n* by using the \"-R\" option when invoking CVS.  This is a global option,\nmeaning that it has to appear before the subcommand: \"cvs -R update\"\nrather than \"cvs update -R\".\n\n* by setting the \"$CVSREADONLYFS\" environment variable.\n\nApparently -R and \"$CVSREADONLYFS\" were added in CVS 1.12.1, which was\nreleased in 2003.\n\nMichael\n"},{"id":"148188","messageId":"7vpqxicyoy.fsf@alter.siamese.dyndns.org","threadId":"24743","inReplyTo":"4C68BD66.9060506@alum.mit.edu","subject":"Re: [BUG RFC/PATCH] git-cvsimport","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-16T16:25:01Z","receivedAt":"2010-08-16T16:25:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Haggerty <mhagger@alum.mit.edu> writes:\n\n> My guess is that cvsps is using CVS commands to access the test CVS\n> repository, and that CVS wants to write to the file CVSROOT/history to\n> log what is being done.  The logging behavior can be turned off either:\n> ...\n> Apparently -R and \"$CVSREADONLYFS\" were added in CVS 1.12.1, which was\n> released in 2003.\n\nThat unfortunately does not solve much.  t9602 seems to want to create a\nnew CVSROOT/val-tags file, so if Ævar wants to keep the source tree\nread-only, the test CVS repository needs to be copied to a scratch place.\n\nPerhaps something like this?  I actually have to wonder why cvsIMPORT\nneeds to write into anywhere, though.\n\n-- >8 --\nSubject: cvs tests: do not touch test CVS repositories shipped with source\n\nSome tests in t96xx series (cvsimport) want to write into the control area\n(CVSROOT) of their test CVS repositories, but this does not work well when\nthe source area is made read-only (test trash directories are moved via\n--root=else/where option).\n\nCopy the supplied test CVS repository to a scratch place at the beginning\nof these tests.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/Makefile                         |    1 -\n t/lib-cvs.sh                       |    6 ++++++\n t/t9601-cvsimport-vendor-branch.sh |    3 +--\n t/t9602-cvsimport-branches-tags.sh |    3 +--\n t/t9603-cvsimport-patchsets.sh     |    3 +--\n 5 files changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/t/Makefile b/t/Makefile\nindex cf5f9e2..876d2ca 100644\n--- a/t/Makefile\n+++ b/t/Makefile\n@@ -28,7 +28,6 @@ pre-clean:\n \n clean:\n \t$(RM) -r 'trash directory'.* test-results\n-\t$(RM) t????/cvsroot/CVSROOT/?*\n \t$(RM) -r valgrind/bin\n \n aggregate-results-and-cleanup: $(T)\ndiff --git a/t/lib-cvs.sh b/t/lib-cvs.sh\nindex 648d161..b51d2e1 100644\n--- a/t/lib-cvs.sh\n+++ b/t/lib-cvs.sh\n@@ -30,6 +30,12 @@ case \"$cvsps_version\" in\n \t;;\n esac\n \n+setup_cvs_test_repository () {\n+\tCVSROOT=\"$(pwd)/.cvsroot\" &&\n+\tcp -r \"$TEST_DIRECTORY/$1/cvsroot\" \"$CVSROOT\" &&\n+\texport CVSROOT\n+}\n+\n test_cvs_co () {\n \t# Usage: test_cvs_co BRANCH_NAME\n \trm -rf module-cvs-\"$1\"\ndiff --git a/t/t9601-cvsimport-vendor-branch.sh b/t/t9601-cvsimport-vendor-branch.sh\nindex 3afaf56..b23479f 100755\n--- a/t/t9601-cvsimport-vendor-branch.sh\n+++ b/t/t9601-cvsimport-vendor-branch.sh\n@@ -34,8 +34,7 @@\n test_description='git cvsimport handling of vendor branches'\n . ./lib-cvs.sh\n \n-CVSROOT=\"$TEST_DIRECTORY\"/t9601/cvsroot\n-export CVSROOT\n+setup_cvs_test_repository t9601\n \n test_expect_success 'import a module with a vendor branch' '\n \ndiff --git a/t/t9602-cvsimport-branches-tags.sh b/t/t9602-cvsimport-branches-tags.sh\nindex 67878b2..ed01d8a 100755\n--- a/t/t9602-cvsimport-branches-tags.sh\n+++ b/t/t9602-cvsimport-branches-tags.sh\n@@ -6,8 +6,7 @@\n test_description='git cvsimport handling of branches and tags'\n . ./lib-cvs.sh\n \n-CVSROOT=\"$TEST_DIRECTORY\"/t9602/cvsroot\n-export CVSROOT\n+setup_cvs_test_repository t9602\n \n test_expect_success 'import module' '\n \ndiff --git a/t/t9603-cvsimport-patchsets.sh b/t/t9603-cvsimport-patchsets.sh\nindex 958bdce..93c4fa8 100755\n--- a/t/t9603-cvsimport-patchsets.sh\n+++ b/t/t9603-cvsimport-patchsets.sh\n@@ -14,8 +14,7 @@\n test_description='git cvsimport testing for correct patchset estimation'\n . ./lib-cvs.sh\n \n-CVSROOT=\"$TEST_DIRECTORY\"/t9603/cvsroot\n-export CVSROOT\n+setup_cvs_test_repository t9603\n \n test_expect_failure 'import with criss cross times on revisions' '\n \n"},{"id":"148195","messageId":"AANLkTimXAZMfXWjcb7RKE2_y6_v7MHQRK7oxK42n-5C0@mail.gmail.com","threadId":"24743","inReplyTo":"7vpqxicyoy.fsf@alter.siamese.dyndns.org","subject":"Re: [BUG RFC/PATCH] git-cvsimport","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-16T17:43:06Z","receivedAt":"2010-08-16T17:43:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Mon, Aug 16, 2010 at 16:25, Junio C Hamano <gitster@pobox.com> wrote:\n> Michael Haggerty <mhagger@alum.mit.edu> writes:\n>\n>> My guess is that cvsps is using CVS commands to access the test CVS\n>> repository, and that CVS wants to write to the file CVSROOT/history to\n>> log what is being done.  The logging behavior can be turned off either:\n>> ...\n>> Apparently -R and \"$CVSREADONLYFS\" were added in CVS 1.12.1, which was\n>> released in 2003.\n>\n> That unfortunately does not solve much.  t9602 seems to want to create a\n> new CVSROOT/val-tags file, so if Ævar wants to keep the source tree\n> read-only, the test CVS repository needs to be copied to a scratch place.\n>\n> Perhaps something like this?  I actually have to wonder why cvsIMPORT\n> needs to write into anywhere, though.\n\nThat looks good. It's pretty much exactly what I was going to submit,\nbut I was waiting until you applied my other patches to pu (since\nthey'd with that patch as I changed the setup code in the skip patches\ntoo).\n"}]}