Re: [PATCH 1/2] t/test-lib.sh: Let test_must_fail fail on signals only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 15, 2008 at 10:54:25PM -0700, Junio C Hamano wrote:

> Anything that returns error() from its cmd_xxx() routine, for example,
> would end up exiting with (-1).  Is it "such bogus" error codes, though?

I think it is bogus, because it is being implicitly truncated to an
unsigned 8-bit value (at least on Linux -- I have no idea what other
platforms do). So your -1 is actually 255. Portably speaking, C defines
only the macros EXIT_SUCCESS and EXIT_FAILURE; in practice, I don't know
what is most common.

Bad side effects of not treating your exit codes as unsigned 8-bit
integers:

  - the exit values are easily confused with other things, like signal
    death. As in this case. We have modified our checking code in the
    test scripts, but there may be other, less robust code out there.

  - other exit values can be mistaken as success. Obviously 256, -256,
    512, -512, etc all produce an erroneous "success". Now we aren't
    doing this, as we are using "-1", but it just seems a bit cleaner to
    be up front about what is happening (and the 255 we end up with is
    unnecessarily confusing; some documents, like this one:

      http://tldp.org/LDP/abs/html/exitcodes.html

    claim 255 as "out of range").

So what we are doing now isn't terrible, but since it was noted (and did
in fact cause a problem!), I just expected a "let's stop doing that"
patch in the original series.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux