git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Git Mailing List <git@vger.kernel.org>,
	Martin Langhoff <martin@catalyst.net.nz>
Subject: [BUG RFC/PATCH] git-cvsimport
Date: Sat, 14 Aug 2010 15:33:07 +0000	[thread overview]
Message-ID: <AANLkTikxxqgNpmqfFQq+5GVd7VAW2DTaro5anRHcx6Tt@mail.gmail.com> (raw)

This is more of a BUG than a RFC/PATCH.

Now that Junio has applied my patch to not write test results under
harness I can:

    sudo chown -R root t

And run the tests with --root=/dev/shm under prove, except for 3
git-cvsimport tests. I have pending patches to these, after they'll
get in I'll fix that.

But the reason they hang is interesting:

    rm -rf /tmp/meh;
    git init /tmp/meh &&
    cd /tmp/meh &&
    sudo chown -R root /home/avar/g/git/t/t9601/cvsroot &&
    cvsps --norc -q --cvs-direct -u -A --root
/home/avar/g/git/t/t9601/cvsroot module
    Initialized empty Git repository in /tmp/meh/.git/

cvsps will just hang due to the unfriendly chmod. Maybe we want
something like the below to deal with that.

However, even then it'll still hang on something else, I haven't
looked into what. I'm just going to fix this by having it copy the
things it needs to the --root directory.

 git-cvsimport.perl |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 9e03eee..1a93fb4 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -688,8 +688,25 @@ unless ($opt_P) {
        }
        ($cvspsfh, $cvspsfile) = tempfile('gitXXXXXX', SUFFIX => '.cvsps',
                                          DIR => File::Spec->tmpdir());
-       while (<CVSPS>) {
-           print $cvspsfh $_;
+       # Alarm because "cvsps --norc -q --cvs-direct -u -A --root
+       # /home/avar/g/git/t/t9601/cvsroot module" will hang forever if
+       # the "t9601/cvsroot" directory isn't writable by us.
+       {
+               my $got_input;
+               my $start = time;
+               local $SIG{ALRM} = sub {
+                       unless ($got_input) {
+                               die sprintf "cvsps left us hanging for
%d seconds, do you have permission to write to %s?",
+                                   time() - $start,
+                                   $opt_d;
+                       }
+               };
+               alarm 10;
+               while (<CVSPS>) {
+                       $got_input = 1;
+                       print $cvspsfh $_;
+               }
+               alarm 0;
        }
        close CVSPS;
        $? == 0 or die "git cvsimport: fatal: cvsps reported error\n";

             reply	other threads:[~2010-08-14 15:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-14 15:33 Ævar Arnfjörð Bjarmason [this message]
2010-08-14 21:09 ` [BUG RFC/PATCH] git-cvsimport Jonathan Nieder
2010-08-14 21:39   ` Ævar Arnfjörð Bjarmason
2010-08-16  4:24 ` Michael Haggerty
2010-08-16 16:25   ` Junio C Hamano
2010-08-16 17:43     ` Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikxxqgNpmqfFQq+5GVd7VAW2DTaro5anRHcx6Tt@mail.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin@catalyst.net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).