bug-bash
[Top][All Lists]
Advanced

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

DEBUG trap and job names


From: Sebastian Kapfer
Subject: DEBUG trap and job names
Date: Thu, 22 Jun 2006 19:51:51 +0200

Hello dear bash-bug readers,

I'm quite sure I have found a micro-bug in the bash which should take
about two lines of code to fix -- if you know where to put them.  I
tried to locate the problem myself, but the innards of bash traps remain
a mystery to me.  Anyway, the description is here:

https://launchpad.net/distros/ubuntu/+source/bash/+bug/41082

For your convenience, I'm replicating the report here: >>>>>

When a DEBUG trap is set, it overwrites the current foreground job's job
name (name as seen in the 'jobs' listing).

Reproduction:

1. set trap, e.g. trap echo DEBUG
2. launch foreground process
3. Ctrl+Z to background it
4. type 'jobs'

Example:

sh-3.1$ sleep 600 &
[1] 2870
sh-3.1$ jobs
[1]+ Running sleep 600 &
sh-3.1$ fg
sleep 600

[1]+ Stopped(SIGTSTP) sleep 600
sh-3.1$ trap echo DEBUG
sh-3.1$ fg

sleep 600

[1]+ Stopped(SIGTSTP) sleep 600
sh-3.1$ sleep 600

[2]+ Stopped(SIGTSTP) echo
sh-3.1$ jobs

[1]- Stopped(SIGTSTP) sleep 600
[2]+ Stopped(SIGTSTP) echo
sh-3.1$

<<<<<

Obviously, both job names should be "sleep 600" since the echo has
already executed and is in a trap anyway.

I would be very grateful if someone in the know would spend a few
thoughts on this one :-)

For the record:  I'm running bash version "3.1.17(1)-release", at least
that's what Ubuntu calls it, should be up-to-date.

-- 
Best Regards,  | Hi! I'm a .signature virus. Copy me into
 Sebastian     | your ~/.signature to help me spread!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]