zsh-users
 help / color / Atom feed
* zsh hanging when exec'd from bash at login
@ 2019-10-21 20:47 Aaron Hall
  2019-10-22  2:33 ` dana
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Hall @ 2019-10-21 20:47 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]

I log in to zsh on a number of heterogenous machines served by the same
OpenLDAP. Because zsh may be installed in different places on those
machines (or might not be installed at all), I have my .profile find it,
determine how to invoke it, and exec it, thus acting more or less like
zsh was my login shell all along. This has worked across many OSes
(Linux, Solaris, Mac OS) for years.

I'm encountering an odd problem here on a Debian 10 box running zsh
5.7.1 that only manifests when trying to log in at a virtual terminal on
the console (i.e. not over ssh).

The .profile code (under bash), after figuring out what it's supposed to
do, is trying to run:

   exec /usr/bin/zsh -d -l -i

On this installation, zsh hangs. It never even gets to the point where
-x starts outputting information. I changed the .profile to strace exec
zsh, and it seems to be hanging very early in a loop, seemingly while
trying to set up signals. (Brief strace attached.)

If I take the 'exec' out, it works fine. If I log in over ssh, it works
fine. If I let it drop me at a bash command line and manually run "exec
zsh" it works fine.

I'm inclined to blame systemd here, not zsh, but I thought if I
understood what was going on from the zsh perspective I might get have a
better idea what else I might poke to fix this behavior.

Thanks,
Aaron

-- 
Aaron Hall             Improvement makes strait roads,
vitaphone.net          but the crooked roads without Improvement,
                       are roads of Genius.
                         -- Wm. Blake, The Marriage of Heaven & Hell

[-- Attachment #2: zsh.7096.strace --]
[-- Type: text/plain, Size: 9414 bytes --]

execve("/usr/bin/zsh", ["/usr/bin/zsh", "-d", "-l", "-i"], 0x7ffdbba0ace0 /* 19 vars */) = 0
brk(NULL)                               = 0x56400ad6d000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=23387, ...}) = 0
mmap(NULL, 23387, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5f75f26000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\"\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=26864, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5f75f24000
mmap(NULL, 29016, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5f75f1c000
mprotect(0x7f5f75f1e000, 16384, PROT_NONE) = 0
mmap(0x7f5f75f1e000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f5f75f1e000
mmap(0x7f5f75f20000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7f5f75f20000
mmap(0x7f5f75f22000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x7f5f75f22000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\21\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14592, ...}) = 0
mmap(NULL, 16656, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5f75f17000
mmap(0x7f5f75f18000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7f5f75f18000
mmap(0x7f5f75f19000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f5f75f19000
mmap(0x7f5f75f1a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f5f75f1a000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libtinfo.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\351\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=183528, ...}) = 0
mmap(NULL, 186752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5f75ee9000
mmap(0x7f5f75ef7000, 57344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe000) = 0x7f5f75ef7000
mmap(0x7f5f75f05000, 53248, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7f5f75f05000
mmap(0x7f5f75f12000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0x7f5f75f12000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260#\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=35808, ...}) = 0
mmap(NULL, 39904, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5f75edf000
mmap(0x7f5f75ee1000, 16384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f5f75ee1000
mmap(0x7f5f75ee5000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f5f75ee5000
mmap(0x7f5f75ee7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f5f75ee7000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\322\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1579448, ...}) = 0
mmap(NULL, 1581384, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5f75d5c000
mmap(0x7f5f75d69000, 651264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd000) = 0x7f5f75d69000
mmap(0x7f5f75e08000, 872448, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xac000) = 0x7f5f75e08000
mmap(0x7f5f75edd000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x180000) = 0x7f5f75edd000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260A\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1824496, ...}) = 0
mmap(NULL, 1837056, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5f75b9b000
mprotect(0x7f5f75bbd000, 1658880, PROT_NONE) = 0
mmap(0x7f5f75bbd000, 1343488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f5f75bbd000
mmap(0x7f5f75d05000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16a000) = 0x7f5f75d05000
mmap(0x7f5f75d52000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f5f75d52000
mmap(0x7f5f75d58000, 14336, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5f75d58000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@l\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=146968, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5f75b99000
mmap(NULL, 132288, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5f75b78000
mmap(0x7f5f75b7e000, 61440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f5f75b7e000
mmap(0x7f5f75b8d000, 24576, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f5f75b8d000
mmap(0x7f5f75b93000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a000) = 0x7f5f75b93000
mmap(0x7f5f75b95000, 13504, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5f75b95000
close(3)                                = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5f75b75000
arch_prctl(ARCH_SET_FS, 0x7f5f75b75740) = 0
mprotect(0x7f5f75d52000, 16384, PROT_READ) = 0
mprotect(0x7f5f75b93000, 4096, PROT_READ) = 0
mprotect(0x7f5f75edd000, 4096, PROT_READ) = 0
mprotect(0x7f5f75ee7000, 4096, PROT_READ) = 0
mprotect(0x7f5f75f12000, 16384, PROT_READ) = 0
mprotect(0x7f5f75f1a000, 4096, PROT_READ) = 0
mprotect(0x7f5f75f22000, 4096, PROT_READ) = 0
mprotect(0x56400a1ad000, 8192, PROT_READ) = 0
mprotect(0x7f5f75f53000, 4096, PROT_READ) = 0
munmap(0x7f5f75f26000, 23387)           = 0
set_tid_address(0x7f5f75b75a10)         = 7102
set_robust_list(0x7f5f75b75a20, 24)     = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7f5f75b7e6b0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f5f75b8a730}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7f5f75b7e740, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7f5f75b8a730}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
brk(NULL)                               = 0x56400ad6d000
brk(0x56400ad8e000)                     = 0x56400ad8e000
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=3031632, ...}) = 0
mmap(NULL, 3031632, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5f75890000
close(3)                                = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
getuid()                                = 59578
geteuid()                               = 59578
getgid()                                = 100
getegid()                               = 100
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
fstat(0, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x4, 0x2), ...}) = 0
readlink("/proc/self/fd/0", "/dev/tty2", 4095) = 9
stat("/dev/tty2", {st_mode=S_IFCHR|0600, st_rdev=makedev(0x4, 0x2), ...}) = 0
openat(AT_FDCWD, "/dev/tty2", O_RDWR|O_NOCTTY) = 3
fcntl(3, F_DUPFD, 10)                   = 10
close(3)                                = 0
fcntl(10, F_GETFD)                      = 0
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
fcntl(10, F_GETFL)                      = 0x8002 (flags O_RDWR|O_LARGEFILE)
ioctl(10, TCGETS, {B38400 opost isig icanon echo ...}) = 0
getpid()                                = 7102
getpgrp()                               = 6976
getpgrp()                               = 6976
rt_sigprocmask(SIG_BLOCK, [TSTP TTIN TTOU], [], 8) = 0
ioctl(10, TIOCGPGRP, [7096])            = 0
getpgrp()                               = 6976
ioctl(10, TIOCGPGRP, [7096])            = 0
rt_sigprocmask(SIG_SETMASK, [], [TSTP TTIN TTOU], 8) = 0
read(0, NULL, 0)                        = -1 EIO (Input/output error)
rt_sigprocmask(SIG_BLOCK, [TSTP TTIN TTOU], [], 8) = 0
getpgrp()                               = 6976
ioctl(10, TIOCGPGRP, [7096])            = 0
getpgrp()                               = 6976
ioctl(10, TIOCGPGRP, [7096])            = 0
rt_sigprocmask(SIG_SETMASK, [], [TSTP TTIN TTOU], 8) = 0
read(0, NULL, 0)                        = -1 EIO (Input/output error)
rt_sigprocmask(SIG_BLOCK, [TSTP TTIN TTOU], [], 8) = 0
getpgrp()                               = 6976
ioctl(10, TIOCGPGRP, [7096])            = 0
getpgrp()                               = 6976
ioctl(10, TIOCGPGRP, [7096])            = 0
rt_sigprocmask(SIG_SETMASK, [], [TSTP TTIN TTOU], 8) = 0
read(0, NULL, 0)                        = -1 EIO (Input/output error)

# and on and on forever...

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: zsh hanging when exec'd from bash at login
  2019-10-21 20:47 zsh hanging when exec'd from bash at login Aaron Hall
@ 2019-10-22  2:33 ` dana
  0 siblings, 0 replies; 2+ messages in thread
From: dana @ 2019-10-22  2:33 UTC (permalink / raw)
  To: Aaron Hall; +Cc: zsh-users

It seems to be hanging in acquire_pgrp() (see annotated strace below). I guess
it's trying to make itself the process group leader and take over the TTY? But
i don't understand what it's getting stuck on

(Maybe should move this to workers)

dana


jobs.c@2929: getpgrp()                               = 6976
jobs.c@2935: rt_sigprocmask(SIG_BLOCK, [TSTP TTIN TTOU], [], 8) = 0

jobs.c@2936: ioctl(10, TIOCGPGRP, [7096])            = 0
jobs.c@2937: getpgrp()                               = 6976
jobs.c@2945: ioctl(10, TIOCGPGRP, [7096])            = 0
jobs.c@2947: rt_sigprocmask(SIG_SETMASK, [], [TSTP TTIN TTOU], 8) = 0
jobs.c@2948: read(0, NULL, 0)                        = -1 EIO (Input/output error)
jobs.c@2949: rt_sigprocmask(SIG_BLOCK, [TSTP TTIN TTOU], [], 8) = 0
jobs.c@2950: getpgrp()                               = 6976

jobs.c@2936: ioctl(10, TIOCGPGRP, [7096])            = 0
jobs.c@2937: getpgrp()                               = 6976
jobs.c@2945: ioctl(10, TIOCGPGRP, [7096])            = 0
jobs.c@2947: rt_sigprocmask(SIG_SETMASK, [], [TSTP TTIN TTOU], 8) = 0
jobs.c@2948: read(0, NULL, 0)                        = -1 EIO (Input/output error)
jobs.c@2949: rt_sigprocmask(SIG_BLOCK, [TSTP TTIN TTOU], [], 8) = 0
jobs.c@2950: getpgrp()                               = 6976

jobs.c@2936: ioctl(10, TIOCGPGRP, [7096])            = 0
jobs.c@2937: getpgrp()                               = 6976
jobs.c@2945: ioctl(10, TIOCGPGRP, [7096])            = 0
jobs.c@2947: rt_sigprocmask(SIG_SETMASK, [], [TSTP TTIN TTOU], 8) = 0
jobs.c@2948: read(0, NULL, 0)                        = -1 EIO (Input/output error)
...


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 20:47 zsh hanging when exec'd from bash at login Aaron Hall
2019-10-22  2:33 ` dana

zsh-users

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git