Package: bash
Version: 3.2-4
Severity: normal
Tags: patch
This bug was iniatially reported by Joe Peterson, and patch was accepted
for Bash4.
Joe reported:
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -
DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -
DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -
DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -march=i686 -
O2 -pipe
uname output: Linux crater 2.6.26-rc6-git4 #1 SMP PREEMPT Wed Jun 18
15:24:32 MDT 2008 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz GenuineIntel
GNU/Linux
Machine Type: i686-pc-linux-gnu
Bash Version: 3.2
Patch Level: 33
Release Status: release
Description:
Doing "su foo" (where foo is a user set to use "bash" as the
shell),
if the user has an "stty" command in .bashrc, and there is a
slight
delay before this command is reached (because of previous
commands,
etc. - note that a "sleep 2" often demonstrates this), the stty
process will sometimes hang in state "T", having received the
ERESTARTSYS error over and over.
The cause seems to be that the tty->pgrp process id is not equal
to the task_pgrp(current) process id when the kernel's
tty_io.c:ttr_check_change() function is called, invoking the
error.
One process id is that of the "su", and the other is that of
"bash"
(child of the su).
Repeat-By:
Make a user "foo" with a .bashrc containing only:
sleep 2
stty ixany
Log into the console as root, then "su foo". It seems to often
not hang the first time (the prompt appears after a couple of
seconds
as expected), but exiting and redoing it will often hang. There
is a degree of intermittent behavior, suggesting a timing issue.
The hang can be broken by then doing "killall -9 stty".
-- System Information:
Debian Release: 5.0.3
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages bash depends on:
ii base-files 5lenny4 Debian base system
miscellaneous f
ii debianutils 2.30 Miscellaneous utilities
specific t
ii libc6 2.7-18 GNU C Library: Shared
libraries
ii libncurses5 5.7+20081213-1 shared libraries for
terminal hand
Versions of packages bash recommends:
pn bash-completion <none> (no description available)
Versions of packages bash suggests:
pn bash-doc <none> (no description available)
-- no debconf information
--===============0255541241==
Content-Type: text/x-diff; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="jobs.c.patch"
*** jobs.c.20080704 2008-07-10 15:14:13.000000000 -0400
--- jobs.c 2008-07-10 15:17:59.000000000 -0400
***************
*** 266,269 ****
--- 266,270 ----
static void set_job_running __P((int));
static void setjstatus __P((int));
+ static int maybe_give_terminal_to __P((pid_t, pid_t, int));
static void mark_all_jobs_as_dead __P((void));
static void mark_dead_jobs_as_notified __P((int));
***************
*** 637,641 ****
*/
if (job_control && newjob->pgrp &&
(subshell_environment&SUBSHELL_ASYNC) == 0)
! give_terminal_to (newjob->pgrp, 0);
}
}
--- 638,642 ----
*/
if (job_control && newjob->pgrp &&
(subshell_environment&SUBSHELL_ASYNC) == 0)
! maybe_give_terminal_to (shell_pgrp, newjob->pgrp, 0);
}
}
***************
*** 3833,3836 ****
--- 3834,3863 ----
}
+ /* Give terminal to NPGRP iff it's currently owned by OPGRP. FLAGS
are the
+ flags to pass to give_terminal_to(). */
+ static int
+ maybe_give_terminal_to (opgrp, npgrp, flags)
+ pid_t opgrp, npgrp;
+ int flags;
+ {
+ int tpgrp;
+
+ tpgrp = tcgetpgrp (shell_tty);
+ if (tpgrp == npgrp)
+ {
+ terminal_pgrp = npgrp;
+ return 0;
+ }
+ else if (tpgrp != opgrp)
+ {
+ #if defined (DEBUG)
+ internal_warning ("maybe_give_terminal_to: terminal pgrp == %d
shell pgrp = %d", tpgrp, opgrp);
+ #endif
+ return -1;
+ }
+ else
+ return (give_terminal_to (npgrp, flags));
+ }
+
/* Clear out any jobs in the job array. This is intended to be used
by
children of the shell, who should not have any job structures as
baggage
--
Jesper L. Nielsen
Senior Software Engineer @ 2M-Locatel
--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org