git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use exit 1 instead of die when req_Root fails.
@ 2007-10-17 14:05 Brian Gernhardt
  2007-10-17 14:39 ` Morten Welinder
  2007-10-17 19:06 ` Frank Lichtenheld
  0 siblings, 2 replies; 13+ messages in thread
From: Brian Gernhardt @ 2007-10-17 14:05 UTC (permalink / raw)
  To: git, spearce

This was causing test failures because die was exiting 255.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
---

 Shawn, I sent this in a couple weeks ago but it looks like it never
 made it into your repo.  It fixes test failures on my machine that have
 been plauging me for months.

 git-cvsserver.perl |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 13dbd27..0d55fec 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -145,8 +145,10 @@ if ($state->{method} eq 'pserver') {
     }
     my $request = $1;
     $line = <STDIN>; chomp $line;
-    req_Root('root', $line) # reuse Root
-       or die "E Invalid root $line \n";
+    unless (req_Root('root', $line)) { # reuse Root
+       print "E Invalid root $line \n";
+       exit 1;
+    }
     $line = <STDIN>; chomp $line;
     unless ($line eq 'anonymous') {
        print "E Only anonymous user allowed via pserver\n";
-- 
1.5.3.4.206.g0cef9

^ permalink raw reply related	[flat|nested] 13+ messages in thread
* Re: git-cvsserver test failures (still)
@ 2007-10-04  1:19 Frank Lichtenheld
  2007-10-04  1:43 ` [PATCH] Use exit 1 instead of die when req_Root fails Brian Gernhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Frank Lichtenheld @ 2007-10-04  1:19 UTC (permalink / raw)
  To: Brian Gernhardt; +Cc: Git Mailing List

Hi.

Some investigations on this:

On Wed, Oct 03, 2007 at 03:50:18PM -0400, Brian Gernhardt wrote:
> This appears to be from git-cvsserver.perl:148-9:
> 
>     req_Root('root', $line) # reuse Root
>        or die "E Invalid root $line \n";
> 
> This fails the test suite because die() exits with code 255 (checked  
> with "perl -e 'die'; echo $?"), which is outside what  
> test_expect_failure accepts (see t/test-lib.sh:179).
> 
> My questions become:
> 1) Why hasn't this hit anyone else?

die doesn't always quit with 255:

"exits with the current value of $! (errno).  If $! is 0, exits with the
value of "($? >> 8)" (backtick ‘command‘ status).  If "($? >> 8)" is 0,
exits with 255"

On my system $! is 9 for these cases and so it exits with exit code 9.

> 2) Is this where these tests are supposed to fail?

yes, IIRC

> 3) If it is, should the code be using print and exit 1 instead of die?

I think that would be the best solution, yes.

> 4) If not, should the test be altered to end with "|| false" or  
> similar so the test passes?

Gruesse,
-- 
Frank Lichtenheld <frank@lichtenheld.de>
www: http://www.djpig.de/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-10-18 18:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-17 14:05 [PATCH] Use exit 1 instead of die when req_Root fails Brian Gernhardt
2007-10-17 14:39 ` Morten Welinder
2007-10-17 15:16   ` Brian Gernhardt
2007-10-17 15:39     ` Lars Hjemli
2007-10-17 18:40       ` Brian Gernhardt
2007-10-17 19:27         ` Lars Hjemli
2007-10-18 18:54     ` Jan Hudec
2007-10-17 19:08   ` Frank Lichtenheld
2007-10-17 19:06 ` Frank Lichtenheld
2007-10-17 19:15   ` Brian Gernhardt
2007-10-18  5:04     ` Shawn O. Pearce
2007-10-18 13:33       ` Frank Lichtenheld
  -- strict thread matches above, loose matches on Subject: below --
2007-10-04  1:19 git-cvsserver test failures (still) Frank Lichtenheld
2007-10-04  1:43 ` [PATCH] Use exit 1 instead of die when req_Root fails Brian Gernhardt

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 NNTP newsgroup(s).