From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3067 invoked by alias); 26 Sep 2014 20:12:42 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19168 Received: (qmail 2373 invoked from network); 26 Sep 2014 20:12:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:cc:subject:references :date:in-reply-to:message-id:mime-version:content-type; s= smtpout; bh=ankusGGcooxA5eQbu/KqGl0rvfs=; b=N9X0Zth936iPOOd84qR9 qB3qHzQCfUaTUR3BdJ3PbcCCD21IuBCk51OlHjrguPwefOS8piHfRWQkmXLzdjfl etPfp0l6Enlkp4lpIIUoK7Gpx1OZVpyCPRTaCDouDu57NOTbLrFWkisbJWO8nIA2 ZCXFasA6cC0yTYJ8FQhaod4= X-Sasl-enc: ISxWaUWNt/yttPT7MfBwnAbQjSZRPcF37cH5JAzXrx5b 1411761887 From: Tassilo Horn To: Kurtis Rader Cc: Zsh Users Subject: Re: ZSH history not saved anymore References: <87mw9qdp7s.fsf@thinkpad-t440p.tsdh.org> <20140924200710.2f764272@pws-pc.ntlworld.com> <8738bg2n1v.fsf@thinkpad-t440p.tsdh.org> <140926000448.ZM30835@torch.brasslantern.com> <878ul6lrw9.fsf@thinkpad-t440p.tsdh.org> Date: Fri, 26 Sep 2014 22:04:43 +0200 In-Reply-To: (Kurtis Rader's message of "Fri, 26 Sep 2014 07:58:27 -0700") Message-ID: <87y4t66td0.fsf@thinkpad-t440p.tsdh.org> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Kurtis Rader writes: Hi Kurtis, > In a different window execute one of the printed kill commands then > > cat /tmp/x Ok, I didn't rm /tmp/x in /tmp/z, so after executing the three printed commands one after the other, the file contains: exiting on HUP exiting on TERM > Notice that your traps for SIGHUP and SIGTERM are honored but the trap > for SIGKILL is not. Indeed. > That's because the OS kernel ignores any handler for SIGKILL. So if > your terminal emulator is sending SIGKILL there is nothing zsh can do. > If that is happening you should switch to a saner terminal emulator. I've written a bug report, so if they really send a SIGKILL that'll hopefully change anytime soon. > If you're running on a Linux based OS you should be able to trace the > shells interaction with the OS using the strace command. Similarly you > should be able to trace the terminal emulator to see what operating > system calls it is making. One or both of those outputs should make it > clear how the shell is being terminated. You may also find that it's > being terminated with SIGHUP or SIGTERM but the attempt to write the > history is failing (look for failed open() or write() calls). The last lines when closing the terminal emulator are: --8<---------------cut here---------------start------------->8--- close(7) = 0 munmap(0x7f9e899e6000, 2105616) = 0 select(6, [5], NULL, NULL, {0, 105000}) = 0 (Timeout) epoll_ctl(3, EPOLL_CTL_DEL, 5, 7fff4eb6e6b0) = 0 close(5) = 0 close(6) = 0 rt_sigaction(SIGPIPE, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 rt_sigaction(SIGALRM, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 rt_sigaction(SIGUSR1, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 rt_sigaction(SIGUSR2, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 rt_sigaction(SIGHUP, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f9e96e7e200}, NULL, 8) = 0 close(4) = 0 close(3) = 0 munmap(0x7f9e97d54000, 16384) = 0 munmap(0x7f9e97d44000, 65536) = 0 exit_group(0) = ? +++ exited with 0 +++ --8<---------------cut here---------------end--------------->8--- And when I do "strace -p" and then close the other term, those are the last lines. --8<---------------cut here---------------start------------->8--- getuid() = 1000 geteuid() = 1000 capget({_LINUX_CAPABILITY_VERSION_3, 0}, NULL) = 0 capget({_LINUX_CAPABILITY_VERSION_3, 0}, {0, 0, 0}) = 0 ioctl(10, FIONREAD, [0]) = 0 ioctl(10, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [4641]) = 0 ioctl(10, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B38400 opost isig -icanon -echo ...}) = 0 write(10, "\r\33[0m\33[27m\33[24m\33[J\33[34m\33[1m[\33[0m"..., 267) = 267 write(10, "\33[K", 3) = 3 rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0 read(10, 0x7fff7944683f, 1) = -1 EIO (Input/output error) --- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} --- --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=4637, si_uid=1000} --- +++ killed by SIGPIPE +++ --8<---------------cut here---------------end--------------->8--- Hm, so it seems ZSH does receive a SIGHUP and then a SIGPIPE which I think is the EOF Bart talked about. Bye, Tassilo