From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Georges Ko Newsgroups: gmane.emacs.bugs Subject: bug#20555: Emacs 24.2 vs 24.4 on Solaris: M-x shell and "tty => not a tty" Date: Wed, 13 May 2015 15:12:32 +0800 Organization: gko.net Message-ID: References: <86twvjjj2c.fsf@gko.net> <555198E2.30809@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1431530602 20029 80.91.229.3 (13 May 2015 15:23:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 May 2015 15:23:22 +0000 (UTC) Cc: okshirai@gmail.com To: 20555@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 13 17:23:11 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YsYV3-00061D-Ko for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 May 2015 17:23:09 +0200 Original-Received: from localhost ([::1]:49578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsYV2-0002BS-Nd for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 May 2015 11:23:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsYUz-0002BJ-NS for bug-gnu-emacs@gnu.org; Wed, 13 May 2015 11:23:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsYUw-0000ga-Lv for bug-gnu-emacs@gnu.org; Wed, 13 May 2015 11:23:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsYUw-0000gS-JC for bug-gnu-emacs@gnu.org; Wed, 13 May 2015 11:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YsYUw-0001Hf-Ba for bug-gnu-emacs@gnu.org; Wed, 13 May 2015 11:23:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <555198E2.30809@cs.ucla.edu> Resent-From: Georges Ko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 May 2015 15:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20555 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14315305604858 (code B ref -1); Wed, 13 May 2015 15:23:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 May 2015 15:22:40 +0000 Original-Received: from localhost ([127.0.0.1]:43919 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YsYUX-0001G9-HN for submit@debbugs.gnu.org; Wed, 13 May 2015 11:22:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42071) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YsUwe-0003Qk-R2 for submit@debbugs.gnu.org; Wed, 13 May 2015 07:35:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsUwW-0000wX-7S for submit@debbugs.gnu.org; Wed, 13 May 2015 07:35:19 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsUwW-0000wP-4Y for submit@debbugs.gnu.org; Wed, 13 May 2015 07:35:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsUwQ-0005Je-CK for bug-gnu-emacs@gnu.org; Wed, 13 May 2015 07:35:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsUwN-0000qQ-1s for bug-gnu-emacs@gnu.org; Wed, 13 May 2015 07:35:10 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:40347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsUwM-0000iy-Q4 for bug-gnu-emacs@gnu.org; Wed, 13 May 2015 07:35:06 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YsUwI-0002at-Fk for bug-gnu-emacs@gnu.org; Wed, 13 May 2015 13:35:02 +0200 Original-Received: from 223-136-127-143.emome-ip.hinet.net ([223.136.127.143]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 May 2015 13:35:02 +0200 Original-Received: from gko by 223-136-127-143.emome-ip.hinet.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 May 2015 13:35:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 60 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 223-136-127-143.emome-ip.hinet.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) Hamster/2.0.0.1 Cancel-Lock: sha1:4VuxjvTxEu1ZYAsKxjigEtlwerc= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Wed, 13 May 2015 11:22:35 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:102743 Archived-At: Glenn Morris writes: > Paul Eggert wrote: > >> [moving this to bug-gnu-emacs, so that it gets a proper bug number] > > It already has one: http://debbugs.gnu.org/19191 I have been able to "fix" the problem by trial and error. On my system, the function allocate_pty (process.c) calls the macro PTY_TTY_NAME_SPRINTF, generated in config.h, which is: #define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); } It turned out that grantpt(fd) returns -1, with errno = 13 (EACCES), so -1 is returned by allocate_pty. After checking EACCES of grantpt(): The slave pseudoterminal was opened before grantpt(), or a grantpt() was already issued. In either case, slave pseudoterminal permissions and ownership have already been updated. If you use grantpt() to change slave pseudoterminal permissions, you must issue grantpt() between the master open and the first pseudoterminal open, and grantpt() can only be issued once. I changed the macro to: if ( /* grantpt_result == -1 || */ unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) and it "fixed" the problem. I'll let the experts figure out the root cause... The diff of configure (24.5): $ diff configure.24.5 configure.24.5.ttyfix 17105c17105 < $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, \"%s\", ptyname); }" >>confdefs.h --- > $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if ( /* grantpt_result == -1 || */ unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, \"%s\", ptyname); }" >>confdefs.h Georges -- Georges Ko gko@gko.net 2015-05-13