bug-bash
[Top][All Lists]
Advanced

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

current_job not properly set.


From: Eric Seidel
Subject: current_job not properly set.
Date: Mon, 25 Aug 2003 11:00:46 -0700

I've run into a problem with bash, which I have traced to the current_job not being set by the time a process is terminated with a ^C

To reproduce:

1.  make sure there are no other running bash jobs
2.  make sure shopt -s checkwinsize is enabled
3.  run a long running process, like "find /"
4. resize the window during the process (making the window slightly bigger is normally best).
5.  kill the process with ^C
6. notice that bash has not noticed the resize. (an easy way to do this is to make sure that there are things in your history which had to wrap... or if the command prompt itself had to wrap).

If you were to instead first ^Z the process, and then fg, and ^C it *WOULD* notice the resize. Also, if the process terminates normally, it notices the resize (with checkwinsize set).



This error is caused by the following code in jobs.c not getting executed:

          if (WIFSIGNALED (s) || WIFSTOPPED (s))
            {
              set_tty_state ();

/* If the current job was stopped or killed by a signal, and the user has requested it, get a possibly new window size */ if (check_window_size && job == current_job) // CURRENT_JOB IS = NO_JOB get_new_window_size (0); // THIS IS NOT GETTING EXECUTED.
            }

inside wait_for()


If you add the code:

printf("In stopped/killed code with cws: %i job:%i current_job: %i", check_window_size, job, current_job);

you will see that current_job is equal to -1 (NO_JOB) when this is reached, even though the job of the only running process is 0.


Unfortunately, I don't know enough about bash to determine where current_job should be getting set... So my current *hack* for Apple's version of bash is to remove the check job == current_job. This will cause a little more network traffic in some cases but shouldn't be too much of a problem.

If someone more knowledgeable could fix the *real* problem of current_job not being set, and send me a patch I would be very grateful.

btw, this is with
GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin7.0)

Thank you for your time and support.

Sincerely,
Eric Seidel


----------------------------
Eric Seidel
eseidel@apple.com
BSD Technologies
Apple Computer





reply via email to

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