git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Use exit 1 instead of die when req_Root fails.

From
Brian Gernhardt <benji@silverinsanity.com>
Date
Oct 17, 2007, 15:16 UTC
Message-ID
<DC3D43FD-F03D-4E0A-9C2B-DE56F9C16D60@silverinsanity.com>
In-Reply-To
<118833cc0710170739i179e7389k1e44f70086ca88be@mail.gmail.com>
On Oct 17, 2007, at 10:39 AM, Morten Welinder wrote:
Show 9 quoted lines
>>  made it into your repo.  It fixes test failures on my machine  
>> that have
>>  been plauging me for months.
>
> That sounds more like a reason to fix the test.  "die" is the perl
> standard way of reporting an error.  It will print the error message
> on stderr, not on stdout like your version does.
>
> IMHO, of course.

The problem is that die can exit with varying exit codes, and exit codes >= 128 make the test suite assume something has gone wrong with the test. In particular, because $! (errcode) and $? (previous shell command return) are both 0, it returns 255. Or at least that's how it works out on my system. I'm not sure why it doesn't do that on others.

But the test is expecting a failure here and it appears to be failing in the correct way, just with an error code test-lib.sh doesn't like. I asked on list the best way to fix it and Frank Lichtenheld said (and nobody objected until now) that this was the best way to fix it.

Also, the not printing on STRERR is identical to another section of code just below mine:

Show 5 quoted lines
>     unless ($line eq 'anonymous') {
>        print "E Only anonymous user allowed via pserver\n";
>        print "I HATE YOU\n";
>        exit 1;
>     }
However, amending my patch to print to STDERR is not difficult.
~~ Brian Gernhardt
Previous: Morten WelinderNext: Lars Hjemli
Message 3 of 12 in “Use exit 1 instead of die when req_Root fails.”
  1. Use exit 1 instead of die when req_Root fails.Brian Gernhardt, Oct 17, 2007
  2. Morten WelinderOct 17, 2007
  3. Brian GernhardtOct 17, 2007
  4. Lars HjemliOct 17, 2007
  5. Brian GernhardtOct 17, 2007
  6. Lars HjemliOct 17, 2007
  7. Jan HudecOct 18, 2007
  8. Frank LichtenheldOct 17, 2007
  9. Frank LichtenheldOct 17, 2007
  10. Brian GernhardtOct 17, 2007
  11. Shawn O. PearceOct 18, 2007
  12. Frank LichtenheldOct 18, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.