Subject: bug#19191: 24.4; su command in *shell* buffer does not work

From: 白井彰 <[email-masked]>
Date: Tue, 14 Apr 2015 01:43:30 +0900

"su: Sorry" also occurs on Emacs 24.5.

% gzcat emacs-24.3.tar.gz | tar xfp -
% (cd emacs-24.3; ./configure --with-jpeg=no --with-gif=no; make)

% gzcat emacs-24.5.tar.gz | tar xfp -
% (cd emacs-24.5; ./configure --with-jpeg=no --with-gif=no; make)

% grep '#.*PTY' emacs-24.3/src/config.h > /tmp/config.h_PTY_emacs-24.3
% grep '#.*PTY' emacs-24.5/src/config.h > /tmp/config.h_PTY_emacs-24.5

% diff /tmp/config.h_PTY_emacs-24.3 /tmp/config.h_PTY_emacs-24.5
9c9
< #define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); 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, sizeof pty_name, "%s", ptyname); }
---
> #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); }

% cat /tmp/config.h_PTY_emacs-24.3 | grep PTY_TTY_NAME_SPRINTF | sed 's/#define//' | indent -st > /tmp/config.h_PTY_emacs-24.3_indent-st
% cat /tmp/config.h_PTY_emacs-24.5 | grep PTY_TTY_NAME_SPRINTF | sed 's/#define//' | indent -st > /tmp/config.h_PTY_emacs-24.5_indent-st
% diff /tmp/config.h_PTY_emacs-24.3_indent-st /tmp/config.h_PTY_emacs-24.5_indent-st
6c6
<       sigaddset(&blocked, SIGCLD);
---
>       sigaddset(&blocked, SIGCHLD);
13c13
<       } snprintf(pty_name, sizeof pty_name, "%s", ptyname);
---
>       } snprintf(pty_name, PTY_NAME_SIZE, "%s", ptyname);

% (cd emacs-24.5/src; ./emacs -Q)
M-x shell
Warning: no access to tty; thus no job control in this shell...
% su
su: Sorry
%
=> su command in *shell* buffer does not work.
   su does not ask for the password and exits with "su: Sorry".