Re: [PATCH] test-lib.sh: work around ksh's trap shortcomings

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

 



Junio C Hamano wrote:

> Yeah, I think I got the subtle distinction between [PATCH FYI], [PATCH]
> and ones with and without sign-offs.

Heh, so subtle as to be unintentional. I think I mucked up that posting.
I should have labeled them all FYI and numbered them. I did hope there
would be some discussion that would result in a followup patch for
submission.

> I've read "trap" section of 1003.1 2004 three times but I do not see the
> exact definition of "EXIT" condition mentioned.  Is the behaviour to
> consider "function return" the EXIT condition considered a "shortcoming"
> (aka bug)?

No, I think it is the defined behavior for the Korn shell.

The SunOS 5.7 man page states:

     If sig  is  0 or EXIT and the trap  statement is exe-
     cuted inside the body of a function, then the com-
     mand arg is executed after the function completes.
     If sig is 0 or EXIT for a trap   set  outside  any
     function, the command arg is executed on exit from
     the shell.

The IRIX 6.5 man page has the exact same wording.

On linux, the man page for the public domain Korn shell states

    Functions  defined with the function reserved word are treated differ-
    ently in the following ways from functions defined with the  ()  nota-
    tion:

        ...

      - The EXIT trap, if set in a function, will be executed after the
        function returns.

But then later in the trap section:

    The original Korn shell’s DEBUG trap and the  handling  of  ERR
    and EXIT traps in functions are not yet implemented.


If Korn shell is to be supported, it seems that trap on EXIT must be
avoided within functions. I think the only one is in git-bisect.

-brandon

--
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