GNU bug report logs - #21866
How to stop children of pty subprocesses from receiving a SIGHUP when main subprocess exits?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Noam Postavsky <npostavs@HIDDEN>; Keywords: confirmed; merged with #15695, #16019, #21617; dated Mon, 9 Nov 2015 02:04:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 15695 16019 21617 21866. Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Forcibly Merged 16019 21617 21866. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.
Forcibly Merged 16019 21866. Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Nov 2015 02:03:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 08 21:03:47 2015
Received: from localhost ([127.0.0.1]:58002 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZvboA-0004Ot-QB
	for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 21:03:47 -0500
Received: from eggs.gnu.org ([208.118.235.92]:53043)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <npostavs@HIDDEN>) id 1Zvbo8-0004Ol-Mv
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 21:03:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <npostavs@HIDDEN>) id 1Zvbo7-0002M0-1w
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 21:03:44 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:37192)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <npostavs@HIDDEN>) id 1Zvbo6-0002Lu-VU
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 21:03:42 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34796)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <npostavs@HIDDEN>) id 1Zvbo5-00081x-P0
 for bug-gnu-emacs@HIDDEN; Sun, 08 Nov 2015 21:03:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <npostavs@HIDDEN>) id 1Zvbo4-0002Ji-Am
 for bug-gnu-emacs@HIDDEN; Sun, 08 Nov 2015 21:03:41 -0500
Received: from mail-io0-x22b.google.com ([2607:f8b0:4001:c06::22b]:36279)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <npostavs@HIDDEN>) id 1Zvbo4-0002Hz-5R
 for bug-gnu-emacs@HIDDEN; Sun, 08 Nov 2015 21:03:40 -0500
Received: by iofh3 with SMTP id h3so5147077iof.3
 for <bug-gnu-emacs@HIDDEN>; Sun, 08 Nov 2015 18:03:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:date:message-id:subject:from:to:content-type;
 bh=3LJz6QbxkL9xrPqBssz7ywIBZcE/zAoeJdW68ZNHIEY=;
 b=beK3O3WfMC0dvaaKWrG8hCwg+o2wQLpwy5G+QUIuBAz3Rr0opkvrGa2/5QUy2yRWPp
 Fjgh2vep4ZQP4KAgVFPlASz0O/oADF5PejC64y/1/Eu3qH8e1MxJ8BLZdyZFkkUG0SD3
 ejp3B+KCih0bu3R8eKcyU1sAM/4JfMGX3oH96+8m1F15dKr5ruw4YcOhfsI8L2YFhSmr
 4rLvQLlGXBku4BZrOSeaBZgUmcr6wU9gqobLtp+VMs4S6d92s+aom6VFMVkKF/s2+L5b
 9FevUPu3fcB832DH6w6V38pPD3LrFrf4d1M+85bfKTDxnM/VrW1SnAzlOzMVbDNlBJe9
 h13w==
MIME-Version: 1.0
X-Received: by 10.107.7.210 with SMTP id g79mr18146634ioi.81.1447034618929;
 Sun, 08 Nov 2015 18:03:38 -0800 (PST)
Received: by 10.79.119.2 with HTTP; Sun, 8 Nov 2015 18:03:38 -0800 (PST)
Date: Sun, 8 Nov 2015 21:03:38 -0500
X-Google-Sender-Auth: iOodNOU8txKWuKCMbiUGJgZrGOs
Message-ID: <CAM-tV-9Fx3CNFFQzPh7f75qFe6eRKYUrozrnpeuFO5hrrxwiWg@HIDDEN>
Subject: How to stop children of pty subprocesses from receiving a SIGHUP when
 main subprocess exits?
From: Noam Postavsky <npostavs@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

While investigating a magit bug[1], we found that when a subprocess
with process-connection-type = pty ends, any subprocesses it has
spawned will receive a SIGHUP.

A simple way to see the problem is doing

   git config --global credential.help='cache --timeout=3600'

And then doing a "git push" to a password protected https remote twice
from M-x eshell. You will be asked for your password both times. The
same from M-x shell only asks the first time (note that after a
successful push from a normal shell, you won't be asked for a password
in eshell either because it can pick up existing daemons, it's just
that it always kills its own daemons).

For a self contained example, using the attached files:

   emacs -Q -l start-process-note-sighup.el

And notice that sighup.log contains "got sigup". Doing the same in
bash, a sighup is not sent if job control is on (the default for
interactive shells).

  xterm -e 'bash -c "set -m ; ./call-note-sighup"' ; cat sighup.log #
no sigup, do pkill note-sighup after
  xterm -e 'bash -c "set +m ; ./call-note-sighup"' ; cat sighup.log # sigup sent

We have a workaround for the git daemon situation, and I'm also
looking into possibly adding an option to git to ignore the sighup[2],
but I think it would make sense for Emacs to be able to avoid sending
sighup in this situation too. I poked around process.c a bit, but I
couldn't figure out where this signal gets sent from.

[1]: https://github.com/magit/magit/issues/2309
[2]: http://www.mail-archive.com/git%40vger.kernel.org/msg79211.html




Acknowledgement sent to Noam Postavsky <npostavs@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#21866; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.