#990986 zsh dies in case of EIO with echo in .zlogout / ENOTTY

Package:
zsh
Source:
zsh
Description:
shell with lots of features
Submitter:
Vincent Lefevre
Date:
2021-07-12 10:27:03 UTC
Severity:
normal
#990986#5
Date:
2021-07-12 10:25:20 UTC
From:
To:
In my .zlogout, I have an "echo" command. However, if the terminal
is no longer there, the "echo" yields EIO errors and the remaining
of the .zlogout is not executed, e.g. with "echo foo" in .zlogout
and

  xterm -e strace -f -o str.out zsh -l

I get

17099 write(1, "foo\n", 4)              = -1 EIO (Input/output error)
17099 ioctl(2, TCGETS, 0x7ffc67792c80)  = -1 EIO (Input/output error)
17099 write(2, "/home/vlefevre/.zlogout:echo:7: "..., 64) = -1 EIO (Input/output error)
17099 ioctl(2, TCGETS, 0x7ffc67793030)  = -1 EIO (Input/output error)
17099 write(2, "/home/vlefevre/.zlogout:7: write"..., 59) = -1 EIO (Input/output error)
17099 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
17099 rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
17099 ioctl(2, TCGETS, 0x7ffc67794790)  = -1 EIO (Input/output error)
17099 write(2, "/home/vlefevre/.zlogout:8: write"..., 39) = -1 EIO (Input/output error)
17099 close(11)                         = 0
17099 ioctl(10, TIOCSPGRP, [17096])     = -1 ENOTTY (Inappropriate ioctl for device)
17099 setpgid(0, 17096)                 = 0
17099 getpid()                          = 17099
17099 exit_group(1)                     = ?
17099 +++ exited with 1 +++

For instance, this happens when zsh is started from ssh and for
some reason, the connection is closed.