Debian Bug report logs - #224543
bash: monitor mode causes emacs as $EDITOR to hang on kernel 2.6

version graph

Package: bash; Maintainer for bash is Matthias Klose <doko@debian.org>; Source for bash is src:bash (PTS, buildd, popcon).

Reported by: Jim Paris <jim@jim.sh>

Date: Sat, 20 Dec 2003 00:33:01 UTC

Severity: normal

Tags: patch

Found in version 2.05b-12

Fixed in version bash/3.1-3

Done: Matthias Klose <doko@debian.org>

Bug is archived. No further changes may be made.

Forwarded to chet@po.cwru.edu

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#224543; Package bash. (full text, mbox, link).


Acknowledgement sent to Jim Paris <jim@jim.sh>:
New Bug report received and forwarded. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Jim Paris <jim@jim.sh>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: bash: monitor mode causes emacs as $EDITOR to hang on kernel 2.6
Date: Fri, 19 Dec 2003 19:27:47 -0500
Package: bash
Version: 2.05b-12
Severity: normal


OK, this is crazy, not sure where to report the bug.  But I noticed
that when running "vipw", "crontab -e", "vigr", etc, with
EDITOR="emacs", emacs will completely hang on startup about 25% of the
time, and the presense of a bash option can trigger it.

TEST CASE 1:
------------
env -i EDITOR=emacs TERM=linux SHELLOPTS= bash --noprofile --norc -c "while true; do crontab -e ; done"

Hit ^X ^C rapidly to keep exiting emacs.  No problems.

TEST CASE 2:
------------
env -i EDITOR=emacs TERM=linux SHELLOPTS=monitor bash --noprofile --norc -c "while true; do crontab -e ; done"

Hit ^X ^C rapidly to keep exiting emacs.  Soon, a copy hangs on
startup, process in stopped state (T), cannot be restarted with
SIGCONT, only killed with SIGKILL.

TEST CASE 3:
------------
env -i EDITOR=nano TERM=linux SHELLOPTS=monitor bash --noprofile --norc -c "while true; do crontab -e ; done"

Hold ^X.  Works fine with nano.

============

OK, after some more testing, this may be some strange interaction with
kernel 2.6.  The problem shows up on machine 1:
   bash 2.05b-12, emacs21 21.3+1-4, linux 2.6.0-test11-bk12
and machine 2:
   bash 2.05b-11, emacs21 21.3+1-4, linux 2.6.0-test9
but NOT machine 3:
   bash 2.05b-12, emacs21 21.3+1-4, linux 2.4.21
   bash 2.05b-8.3, emacs20 20.7-13.1, linux 2.4.21

But I still don't know where the problem lies -- it seems to be
related to bash's job control, somehow, since the problem goes away
when "monitor" is disabled.  Something that changed in 2.6 perhaps?

Not sure how to debug this further:
  strace crontab  causes the problem to not show up
  strace attaching to a hung emacs process shows nothing
  gdb hangs while attaching to the hung emacs process

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux neurosis 2.6.0-test11-bk12 #5 Wed Dec 17 23:11:04 EST 2003 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages bash depends on:
ii  base-files                3.0.12         Debian base system miscellaneous f
ii  libc6                     2.3.2.ds1-10   GNU C Library: Shared libraries an
ii  libncurses5               5.3.20030719-4 Shared libraries for terminal hand

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#224543; Package bash. (full text, mbox, link).


Acknowledgement sent to Jim Paris <jim@jtan.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #10 received at 224543@bugs.debian.org (full text, mbox, reply):

From: Jim Paris <jim@jtan.com>
To: 224543@bugs.debian.org
Subject: Found it, I think
Date: Fri, 19 Dec 2003 19:45:31 -0500
OK, sorry for not finding this _before_ I sent the mail :)

But it sounds like the problem is exactly as described by Linus here:

http://groups.google.com/groups?selm=KM6D.88S.3%40gated-at.bofh.it

I can't find Ernie Petrides' "proper fix" that he refers to, but this
bug bites pretty frequently on a 2.6 kernel and so I think it's worth
tracking down the patch and getting it into Debian.

-jim



Tags added: upstream Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. (full text, mbox, link).


Noted your statement that Bug has been forwarded to chet@po.cwru.edu. Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. (full text, mbox, link).


Tags added: upstream Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#224543; Package bash. (full text, mbox, link).


Acknowledgement sent to Jim Paris <jim@jtan.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #21 received at 224543@bugs.debian.org (full text, mbox, reply):

From: Jim Paris <jim@jtan.com>
To: 224543@bugs.debian.org
Subject: [chet.ramey@case.edu: Re: processes hanging in STOPPED state]
Date: Thu, 9 Jun 2005 22:25:44 -0400
Here is the solution recommended by the upstream author.  I have
verified that it does work, but don't know how to get the PGRP_PIPE
definition automatically included in config.h.

----------

> > And did changing the definition of PGRP_PIPE in config.h solve the problem?
> 
> Yes, defining PGRP_PIPE does appear to make the problem go away.  
> But the previously referenced post from Linus said that PGRP_PIPE may
> cause other problems, and that there exists a "proper fix" that you
> have not yet included in the bash sources?  As before, I cannot find
> that patch, do you have it?

That's not exactly true.  The only thing that PGRP_PIPE does is add an
infinitesimal slowdown.  The `proper fix' is somehow defining that by
default for the appropriate Linux versions.

Chet




Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#224543; Package bash. (full text, mbox, link).


Acknowledgement sent to Jim Paris <jim@jtan.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #26 received at 224543@bugs.debian.org (full text, mbox, reply):

From: Jim Paris <jim@jtan.com>
To: 224543@bugs.debian.org, control@bugs.debian.org
Subject: Patch to define PGRP_PIPE when building
Date: Fri, 16 Sep 2005 16:49:27 -0400
[Message part 1 (text/plain, inline)]
tags 224543 + patch
thanks

Upstream says this is a build issue.  It has been a known problem [1]
since at least 2001.  Because it is triggered by a race condition, the
compile-time check for "whether pgrps need synchronization" doesn't
correctly determine that PGRP_PIPE is actually necessary on Linux.

Both Fedora [2] and Gentoo [3] define PGRP_PIPE when building.  Please
apply the attached patch to also define PGRP_PIPE in Debian.  The
patch also corrects a known issue when defining PGRP_PIPE [4,5,6].

[1] http://www.ussg.iu.edu/hypermail/linux/kernel/0104.3/1211.html
[2] http://groups.yahoo.com/group/amanda-users/message/48141
[3] http://gentoo.cites.uiuc.edu/pub/gentoo-portage/app-shells/bash/bash-3.0-r12.ebuild
[4] http://lists.gnu.org/archive/html/bug-bash/2005-06/msg00028.html
[5] http://bugs.gentoo.org/show_bug.cgi?id=92349
[6] http://gentoo.cites.uiuc.edu/pub/gentoo-portage/app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch

-jim
[pgrp-pipe.dpatch (text/plain, attachment)]

Tags added: patch Request was from Jim Paris <jim@jtan.com> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#224543; Package bash. (full text, mbox, link).


Acknowledgement sent to Jim Paris <jim@jtan.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #33 received at 224543@bugs.debian.org (full text, mbox, reply):

From: Jim Paris <jim@jtan.com>
To: 224543@bugs.debian.org
Subject: please fix
Date: Mon, 12 Dec 2005 16:05:10 -0500
[Message part 1 (text/plain, inline)]
Upstream says this is a build issue, and other Linux distributions
agree, but Debian still isn't defining PGRP_PIPE.  Is there a reason?
This bug is now two years old; what will it take to get it fixed?  I
have attached an updated patch for 3.1.  My bash sessions hang daily
without it.  Please apply, or at least let me know why this can't be
fixed.

-jim
[pgrp-pipe.diff (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#224543; Package bash. (full text, mbox, link).


Acknowledgement sent to Jim Paris <jim@jtan.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #38 received at 224543@bugs.debian.org (full text, mbox, reply):

From: Jim Paris <jim@jtan.com>
To: 224543@bugs.debian.org, control@bugs.debian.org
Subject: Yet another update of the fix...
Date: Mon, 23 Jan 2006 16:29:09 -0500
[Message part 1 (text/plain, inline)]
tags 224543 - upstream
thanks

Yet another update of the patch, this time for 3.1-2.  Is there ANY
hope of getting this resolved?  Any sort of reply would be very much
appreciated...

-jim
[pgrp-pipe.diff (text/x-patch, attachment)]

Tags removed: upstream Request was from Jim Paris <jim@jtan.com> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#224543; Package bash. (full text, mbox, link).


Acknowledgement sent to Matthias Klose <doko@cs.tu-berlin.de>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #45 received at 224543@bugs.debian.org (full text, mbox, reply):

From: Matthias Klose <doko@cs.tu-berlin.de>
To: Jim Paris <jim@jtan.com>, 224543@bugs.debian.org
Cc: control@bugs.debian.org
Subject: Re: Bug#224543: Yet another update of the fix...
Date: Mon, 23 Jan 2006 22:59:33 +0100
tags 224543 + pending
thanks

yes, applied, will be there for the next upload. thanks for the updated
patch.

Jim Paris writes:
> tags 224543 - upstream
> thanks
> 
> Yet another update of the patch, this time for 3.1-2.  Is there ANY
> hope of getting this resolved?  Any sort of reply would be very much
> appreciated...
> 
> -jim
> diff -urN bash-3.1/debian/patches/pgrp-pipe.dpatch bash-3.1-jim/debian/patches/pgrp-pipe.dpatch
> --- bash-3.1/debian/patches/pgrp-pipe.dpatch	1969-12-31 19:00:00.000000000 -0500
> +++ bash-3.1-jim/debian/patches/pgrp-pipe.dpatch	2006-01-23 16:00:22.000000000 -0500
> @@ -0,0 +1,29 @@
> +#! /bin/sh -e
> +
> +if [ $# -eq 3 -a "$2" = '-d' ]; then
> +    pdir="-d $3"
> +elif [ $# -ne 1 ]; then
> +    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
> +    exit 1
> +fi
> +case "$1" in
> +    -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
> +    -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
> +    *)
> +	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
> +	exit 1
> +esac
> +exit 0
> +
> +# DP: Define PGRP_PIPE to avoid race condition.
> +
> +--- config-bot.h	2004-03-19 17:56:23.000000000 -0500
> ++++ config-bot.h	2005-09-16 14:32:33.000000000 -0400
> +@@ -179,3 +179,6 @@
> + 
> + /* If you don't want bash to provide a default mail file to check. */
> + #undef DEFAULT_MAIL_DIRECTORY
> ++
> ++/* Bug #224543 */
> ++#define PGRP_PIPE 1
> +
> diff -urN bash-3.1/debian/rules bash-3.1-jim/debian/rules
> --- bash-3.1/debian/rules	2006-01-23 16:00:13.000000000 -0500
> +++ bash-3.1-jim/debian/rules	2006-01-23 16:00:59.000000000 -0500
> @@ -498,6 +498,7 @@
>  	rbash-manpage \
>  	command-not-found \
>  	bash-default-editor \
> +	pgrp-pipe \
>  
>  # all debian_patches, without bash205b-*
>  # patches integrated in bashdb: builtins-shift, execute-cmd, man-arithmetic,



Tags added: pending Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#224543; Package bash. (full text, mbox, link).


Acknowledgement sent to Jim Paris <jim@jtan.com>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. (full text, mbox, link).


Message #52 received at 224543@bugs.debian.org (full text, mbox, reply):

From: Jim Paris <jim@jtan.com>
To: Matthias Klose <doko@cs.tu-berlin.de>
Cc: 224543@bugs.debian.org
Subject: Re: Bug#224543: Yet another update of the fix...
Date: Mon, 23 Jan 2006 17:02:08 -0500
> yes, applied, will be there for the next upload.

Great, thanks!

-jim



Reply sent to Matthias Klose <doko@debian.org>:
You have taken responsibility. (full text, mbox, link).


Notification sent to Jim Paris <jim@jim.sh>:
Bug acknowledged by developer. (full text, mbox, link).


Message #57 received at 224543-close@bugs.debian.org (full text, mbox, reply):

From: Matthias Klose <doko@debian.org>
To: 224543-close@bugs.debian.org
Subject: Bug#224543: fixed in bash 3.1-3
Date: Fri, 03 Mar 2006 17:32:13 -0800
Source: bash
Source-Version: 3.1-3

We believe that the bug you reported is fixed in the latest version of
bash, which is due to be installed in the Debian FTP archive:

bash-builtins_3.1-3_i386.deb
  to pool/main/b/bash/bash-builtins_3.1-3_i386.deb
bash-doc_3.1-3_all.deb
  to pool/main/b/bash/bash-doc_3.1-3_all.deb
bash-minimal_3.1-3_i386.deb
  to pool/main/b/bash/bash-minimal_3.1-3_i386.deb
bash-static_3.1-3_i386.deb
  to pool/main/b/bash/bash-static_3.1-3_i386.deb
bash_3.1-3.diff.gz
  to pool/main/b/bash/bash_3.1-3.diff.gz
bash_3.1-3.dsc
  to pool/main/b/bash/bash_3.1-3.dsc
bash_3.1-3_i386.deb
  to pool/main/b/bash/bash_3.1-3_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 224543@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated bash package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sat,  4 Mar 2006 01:54:25 +0100
Source: bash
Binary: bashdb bash-builtins bash bash-minimal bash-static bash-doc
Architecture: source i386 all
Version: 3.1-3
Distribution: unstable
Urgency: low
Maintainer: Matthias Klose <doko@debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Description: 
 bash       - The GNU Bourne Again SHell
 bash-builtins - Bash loadable builtins - headers & examples
 bash-doc   - Documentation and examples for the The GNU Bourne Again SHell
 bash-minimal - The GNU Bourne Again SHell (minimal version)
 bash-static - The GNU Bourne Again SHell (static version)
Closes: 224543 323824 324169 325056 327414 331504 340452 343312 345861 349677 351848
Changes: 
 bash (3.1-3) unstable; urgency=low
 .
   * Apply upstream patches 006, 007, 008, 009, 010 and 011.
   * Define PGRP_PIPE to avoid race condition; monitor mode causes emacs as
     $EDITOR to hang on kernel 2.6 (Jim Paris). Closes: #224543.
   * Fix read memleak when reading from non-blocking fd (Tim Waugh).
   * Recognize 'exec -l /bin/bash' as login shell (Tim Waugh).
   * Fix parameter expansion: Array member length expansion fails with nested
     index expression (Jan C. Nordholz). Closes: #345861.
   * Add swedish translation of message strings. Closes: #349677.
 .
   Merge from Ubuntu:
   * clear_console: New helper program to clear the console, including
     the scrollback buffer.
   * /etc/skel/.bash_logout: Install it again and use clear_console.
     Ubuntu #29405. Closes: #331504.
   * /etc/skel/.bashrc: Enable bash_completion.
     Ubuntu #11414, #25096.
   * bash_completion:
     - Fix ssh completion to match lines starting with `Hostname' as well.
       Closes: #343312.
   * Add ulimit options -e and -r.
 .
   * Update bash_completion to 20060301:
     - Completion for minicom(1), mtr(8), sysctl(8), smartctl(8), vncviewer(1),
       invoke-rc.d, update-rc.d and dpkg-source has been added.
       Closes: #323824, #327414.
     - gdb completion of second parameter was broken when first parameter
       contained white space.
     - gdb completion wasn't completing second parameter correctly when it was
       a file, rather than a PID.
     - Ruby ri completion has been broken for some time. This is now fixed.
     - Various fixes to work around change in how POSIX quoting is handled in
       bash 3.1.
     - subversion completion has been reimplemented from scratch and integrated
       into the main file.
     - iconv(1) completion has been improved.
     - yum(8) completion has been updated for current version of yum.
     - ant completion will now make use of complete-ant-cmd.pl, if available.
     - cvs(1) completion has been improved with 'update' and 'stat' completion.
     - 'aptitude show' now works in the same way as 'apt-cache show'.
     - make(1) now also completes on file names.
     - MPlayer will now also complete on .flac, .mpc and .3gp files.
       Closes: #340452.
     - wine will now also complete on .exe.so files.
     - unzip will now also complete on oowriter's .ott files.
     - xine et al will now complete on .mng files.
     - The list of programs completing on .dvi files has been expanded.
     - The range of files on which timidity and evince complete has been
       expanded. Closes: #351848.
     - mkisofs completion now defaults to treating results as file names.
     - $DEBUG has been renamed $BASH_COMPLETION_DEBUG to avoid namespace clashes
       with other software.
     - man(1) completion now works correctly on OpenBSD.
     - svk and Mercurial completion have been added to contribs. Closes: #324169.
     - Many other small optimisations and fixes. Closes: #325056.
Files: 
 4c1893a53b0ed2d60a725597d530e332 719 base required bash_3.1-3.dsc
 ec9a63ad7c96913914776db0b60feca9 217516 base required bash_3.1-3.diff.gz
 eecc83a256e9a70419224200070fd691 729746 doc optional bash-doc_3.1-3_all.deb
 48010fc93084f63e66e9142ca5dbc34f 870510 shells required bash_3.1-3_i386.deb
 b934656f2e9babd446dfca23b5c616c3 98984 utils optional bash-builtins_3.1-3_i386.deb
 6375d23abb17fd5d6f21c0eb085a60f4 704422 shells optional bash-static_3.1-3_i386.deb
 e35d8e327b709f9cf53cea8925a665f1 196192 shells optional bash-minimal_3.1-3_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFECOc3StlRaw+TLJwRAmvIAKCNIpG5soTtXZRyXUvxKlOAJ4iUFwCggBbQ
ye07SuxeLrXKDXz2H5L7T6A=
=HiNo
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 25 Jun 2007 09:30:18 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Dec 6 07:18:45 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.