LWN.net Logo

FYI: incompatibility in 'trap'

FYI: incompatibility in 'trap'

Posted Aug 5, 2004 15:22 UTC (Thu) by vmole (guest, #111)
Parent article: Bash 3.0 released

It turns out that one of the POSIX fixes breaks a long standing use of the 'trap' builtin. Previously, one could specify e.g.

    trap 0
to reset the signal handler to the default for signal 0. POSIX requires the form
    trap - 0
Turning POSIX mode off, or running the script with "#!/bin/bash" instead of "#!/bin/sh" solves this, but doesn't really help scripts that are meant to be portable.

(No, I didn't figure this out myself. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261948 for details.)


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds