Bash sometimes backgrounds pipelines which are intended to be run in
the foreground. This problem appeared after compiling bash without
defining HAVE_UNISTD_H to avoid a problem with typeahead.
The patch below seems to fix this. Your line numbers may vary.
*** bash-1.10/jobs.c Sun Oct 6 17:24:43 1991
--- bash-1.10.local/jobs.c Mon Oct 7 03:57:01 1991
***************
*** 882,887 ****
--- 888,894 ----
fprintf (stderr, "%s: child setpgid (%d to %d) error %d: %s\n",
shell_name, mine, pipeline_pgrp, errno,
(char *)strerror (errno));
+ #if !defined (Ultrix)
if (pipeline_pgrp == mine)
{
if (!async_p)
***************
*** 891,896 ****
--- 898,907 ----
pipe_read (pgrp_pipe);
#endif
}
+ #else
+ if (!async_p)
+ give_terminal_to (pipeline_pgrp);
+ #endif
}
else /* Without job control... */
{
--
There are a handful of UNIX tools that will help | John W. Eaton
you to find bugs, though none is really first-rate. | j...@che.utexas.edu
-- Kernighan and Pike |
Here's a patch that fixes the same problem, but solves the general case.
*** jobs.c.orig Thu Sep 26 16:38:45 1991
--- jobs.c Mon Oct 7 16:24:28 1991
***************
*** 883,888 ****
--- 883,890 ----
shell_name, mine, pipeline_pgrp, errno,
(char *)strerror (errno));
+ #if defined (PIPELINE_PGRP)
if (pipeline_pgrp == mine)
{
+ #endif
if (!async_p)
give_terminal_to (pipeline_pgrp);
***************
*** 890,895 ****
#if defined (PGRP_PIPE)
pipe_read (pgrp_pipe);
- #endif
}
}
else /* Without job control... */
--- 892,897 ----
#if defined (PGRP_PIPE)
pipe_read (pgrp_pipe);
}
+ #endif
}
else /* Without job control... */
--
``Teach them politics and war so their sons may study medicine and mathematics
in order to give their children a right to study painting, poetry, music, and
architecture.''
Chet Ramey, CWRU Inet: ch...@po.CWRU.Edu NeXT Mail: ch...@macbeth.INS.CWRU.Edu