Bug 7486 - exit handler not executed on syntax errors
Summary: exit handler not executed on syntax errors
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: bash (show other bugs)
Version: unstable
Hardware: all Linux
: P2 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-29 01:19 MSD by at@altlinux.org
Modified: 2006-01-06 22:04 MSK (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description at@altlinux.org 2005-07-29 01:19:22 MSD
$ bash -ec 'trap "echo rm lock" EXIT; echo lockfile; false'
lockfile
rm lock
$ bash -ec 'trap "echo rm lock" EXIT; echo lockfile; . ./test.sh'
lockfile
bash: ./test.sh: line 3: syntax error near unexpected token `)'
$

What a funny shit.  I acquire lockfile, install exit handler, source
something and then -- suddenly! -- the exit handler is not executed.
Lockfile is left there forever.

test.sh contains garbage:
case f in
        a) a=1
        b) b=1
esac
Comment 1 at@altlinux.org 2005-07-29 01:30:00 MSD
Compare this to ash:

$ ash -ec 'trap "echo rm lock" EXIT; echo lockfile; . ./test.sh'
lockfile
./test.sh: 3: Syntax error: ")" unexpected (expecting ";;")
rm lock
$
Comment 2 Dmitry V. Levin 2005-12-31 02:19:54 MSK
Seems to be fixed in bash-3.0
Comment 3 Dmitry V. Levin 2006-01-06 22:02:02 MSK
Fixed in 3.1.1-alt1
Comment 4 Dmitry V. Levin 2006-01-06 22:04:20 MSK
Fixed in 3.1.1-alt1.