Hello Chet, thanks for your patch file.
It is slightly broken, attached is the fixed version
of your patch.
BUT: it solves only half of the bug.
Please check it yourself, here's the script:
---
#!./bash -i
set -m; cat
echo Finished!
while :; do jobs; sleep 2; done
---

Run this script, then do
killall -STOP cat
You'll start seeing the output of "jobs" every 2 seconds,
and the cat is marked "Stopped".
Then do
killall -CONT cat
Nothing changes, the cat is still listed as stopped.
Then bash will run terminate_stopped_jobs() on it. :(
Do you know how to fix also this?

29.12.2011 20:54, Chet Ramey wrote:
> When you run bash with -i, interactive and interactive_shell are set
> when initialize_job_control is called, so the correct initialization
> happens.  It's only later that job control gets turned off inappropriately.
As a side note it would be nice to not flip the "interactive"
value back and forth to make the code understanding
easier.
--- shell.c.old 2009-11-19 18:05:54.000000000 +0300
+++ shell.c     2011-12-29 21:07:24.960908301 +0400
@@ -1618,7 +1618,7 @@
   expand_aliases = posixly_correct;    /* XXX - was 0 not posixly_correct */
   no_line_editing = 1;
 #if defined (JOB_CONTROL)
-  set_job_control (0);
+  set_job_control (forced_interactive||jobs_m_flag);
 #endif /* JOB_CONTROL */
 }
 
--- flags.h.old 2009-01-04 22:32:29.000000000 +0300
+++ flags.h     2011-12-30 14:18:28.171298742 +0400
@@ -47,7 +47,7 @@
   echo_command_at_execute, no_invisible_vars, noclobber,
   hashing_enabled, forced_interactive, privileged_mode,
   asynchronous_notification, interactive_comments, no_symbolic_links,
-  function_trace_mode, error_trace_mode, pipefail_opt;
+  function_trace_mode, error_trace_mode, pipefail_opt, jobs_m_flag;
 
 #if 0
 extern int lexical_scoping;

Reply via email to