Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ZSH history not saved anymore

Kurtis Rader <krader@xxxxxxxxxxxxx> writes:

Hi Kurtis,

> The problem is the SIGPIPE. It's terminating the shell before it has a
> chance to handle the SIGHUP. Notice that the SIGPIPE was sent by the user
> process with pid 4637 running as uid 1000. I'll bet that you'll find that
> user ID is yours


> and the pid is the terminal emulator.


> If you look earlier in the strace output for the terminal emulator you
> should be able to find the kill syscall that sent the SIGPIPE. I have
> no idea why the emulator feels the need to send SIGPIPE -- that's a
> very peculiar thing to do.

Indeed.  ZSH has pid 2019 in here:

--8<---------------cut here---------------start------------->8---
munmap(0x7f1291b1c000, 7680000)         = 0
close(23)                               = 0
futex(0x25322d8, FUTEX_WAKE, 1)         = 1
close(22)                               = 0
kill(2029, SIGCONT)                     = 0
kill(2029, SIGPIPE)                     = 0
wait4(2029, 0x7fffb1676de4, WNOHANG, NULL) = 0
nanosleep({0, 1000000}, NULL)           = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=2029, si_uid=1000, si_status=SIGPIPE, si_utime=4, si_stime=0} ---
rt_sigreturn()                          = -1 EINTR (Interrupted system call)
wait4(2029, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGPIPE}], WNOHANG, NULL) = 2029
epoll_ctl(3, EPOLL_CTL_DEL, 22, 7fffb1676d80) = -1 EBADF (Bad file descriptor)
+++ exited with 0 +++
--8<---------------cut here---------------end--------------->8---

> Obviously you can work around the problem by telling zsh to trap that
> signal:
>     exit
> }

Yes, that works.  So I'll keep that in my ~/.zshrc for the time being.

Thanks for your help, Kurtis!


Messages sorted by: Reverse Date, Date, Thread, Author