From: Andrej Borsenkow <arvidjaar@mail.ru>
To: cooker@linux-mandrake.com,
ZSH Workers Mailing List <zsh-workers@sunsite.dk>
Subject: Re: [Cooker] /bin/login from util-linux-2.11c-2mdk breaks zsh ctty hadling
Date: Sun, 27 May 2001 18:07:59 +0400 [thread overview]
Message-ID: <3B110A3F.4020802@mail.ru> (raw)
In-Reply-To: <m3n183su14.fsf@giants.mandrakesoft.com>
Chmouel Boudjnah wrote:
> Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> writes:
>
>
>>After I upgraded to the latest util-linux all login zsh's are running
>>without controlling tty. bash seems to run normally (attached to
>>tty). consoletype fails with EPERM that results in returning "serial"
>>instead "vt" and russian charset not activated. I had to copy
>>/bin/login from Mdk8 to be able to work.
>>
>>It is also 2.4.4-3mdk kernel
>>
>>Chmoul?
>>
>
> ????? really couldn't reproduce the problem, here...
>
>
O.K., I have found why it happens. Here goes.
Here is what happens around a fork in /bin/login for a "good" login
(1188 is login process):
1188 fork() = 1200
1188 wait4(-1, <unfinished ...>
1200 rt_sigaction(SIGINT, {SIG_DFL}, {SIG_IGN}, 8) = 0
1200 msgget(501, 0x2|02) = 0
1200 chdir("/home/bor") = 0
1200 execve("/bin/zsh", ["-zsh"], [/* 6 vars */]) = 0
Here is what happens at the same place for a "bad" login (1175 is
login). I marked offending call:
1175 fork() = 1178
1175 ioctl(0, TIOCNOTTY) = 0
1175 --- SIGHUP (Hangup) ---
1175 --- SIGCONT (Continued) ---
1175 rt_sigaction(SIGHUP, {SIG_DFL}, {SIG_IGN}, 8) = 0
1175 wait4(-1, <unfinished ...>
1178 --- SIGCONT (Continued) ---
>>> 1178 setsid() = 1178
1178 rt_sigaction(SIGHUP, {SIG_DFL}, {SIG_IGN}, 8) = 0
1178 rt_sigaction(SIGINT, {SIG_DFL}, {SIG_IGN}, 8) = 0
1178 msgget(501, 0x2|02) = 0
1178 chdir("/home/bor") = 0
1178 execve("/bin/zsh", ["-zsh"], [/* 6 vars */]) = 0
As you see, new login now does setsid(). Unfortunately, this call has a
side effect of resetting process' ctty, so anything exec'ed next runs
without controlling tty.
The reason bash still works is that it checks if /dev/tty is available,
and if not it reopens it:
2916 open("/dev/tty", O_RDWR|O_NONBLOCK|O_LARGEFILE) = -1 ENXIO (No
such device or address)
2916 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
2916 brk(0) = 0x80c008c
2916 brk(0x80c1000) = 0x80c1000
2916 brk(0x80c3000) = 0x80c3000
2916 readlink("/proc/self/fd/0", "/dev/tty3", 4095) = 9
2916 open("/dev/tty3", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
2916 close(3) = 0
the last two open/close pair makes current stdin to controlling tty. Zsh
does not do it - it inherits std{in,out,err} and opens its SHIN with
O_NOCTTY.
I still claim it is a /bin/login bug. It should make sure porgram is
exec'ed with correct environment that includes ctty.
-andrej
P.S. The problem is not limited to zsh - any program that expects
/dev/tty fails.
next parent reply other threads:[~2001-05-27 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3B0BF59E.6030408@mow.siemens.ru>
[not found] ` <m3n183su14.fsf@giants.mandrakesoft.com>
2001-05-27 14:07 ` Andrej Borsenkow [this message]
2001-06-06 17:12 ` Chmouel Boudjnah
2001-06-06 20:48 ` Andrej Borsenkow
2001-06-08 19:16 ` Chmouel Boudjnah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3B110A3F.4020802@mail.ru \
--to=arvidjaar@mail.ru \
--cc=Andrej.Borsenkow@mow.siemens.ru \
--cc=cooker@linux-mandrake.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).