DEBUG trap and job names

2006-06-22 Thread Sebastian Kapfer

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!



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: DEBUG trap and job names

2006-06-22 Thread Chet Ramey
Sebastian Kapfer wrote:
> 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

This has already been fixed for bash-3.2.  Thanks for the report.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


check_dev_tty - What does it do?

2006-06-22 Thread John Carter


Here is the bash-3.1 code from general.c for check_dev_tty.

It is invoked shortly after main...

void
check_dev_tty ()
{
  int tty_fd;
  char *tty;

  tty_fd = open ("/dev/tty", O_RDWR|O_NONBLOCK);

  if (tty_fd < 0)
{
  tty = (char *)ttyname (fileno (stdin));
  if (tty == 0)
  return;
  tty_fd = open (tty, O_RDWR|O_NONBLOCK);
}
  close (tty_fd);
}

It seems to open and close /dev/tty and return nothing.

This seems very strange to me.

Why is it doing this?



John Carter Phone : (64)(3) 358 6639
Tait ElectronicsFax   : (64)(3) 359 4632
PO Box 1645 ChristchurchEmail : [EMAIL PROTECTED]
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."


From this principle, all of life and physics may be deduced.



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash