From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22271 invoked from network); 23 Jun 2007 18:10:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Jun 2007 18:10:42 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 2793 invoked from network); 23 Jun 2007 18:10:36 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Jun 2007 18:10:36 -0000 Received: (qmail 22421 invoked by alias); 23 Jun 2007 18:10:29 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23585 Received: (qmail 22410 invoked from network); 23 Jun 2007 18:10:28 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 23 Jun 2007 18:10:28 -0000 Received: (qmail 1813 invoked from network); 23 Jun 2007 18:10:27 -0000 Received: from mtaout01-winn.ispmail.ntl.com (81.103.221.47) by a.mx.sunsite.dk with SMTP; 23 Jun 2007 18:10:24 -0000 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20070623181023.CROP12936.mtaout01-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Sat, 23 Jun 2007 19:10:23 +0100 Received: from pws-pc.ntlworld.com ([81.107.45.67]) by aamtaout01-winn.ispmail.ntl.com with SMTP id <20070623181023.ZOAJ219.aamtaout01-winn.ispmail.ntl.com@pws-pc.ntlworld.com> for ; Sat, 23 Jun 2007 19:10:23 +0100 Date: Sat, 23 Jun 2007 19:09:33 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: zsh history gets destroyed when running out of disk space Message-Id: <20070623190933.7af1d4b6.p.w.stephenson@ntlworld.com> In-Reply-To: <2007-06-23T00-31-50@devnull.michael-prokop.at> References: <2007-06-11T21-20-52@devnull.michael-prokop.at> <20070621080454.GA3303@fsst.voodoo.lan> <20070622212825.a8d29679.p.w.stephenson@ntlworld.com> <2007-06-23T00-31-50@devnull.michael-prokop.at> X-Mailer: Sylpheed 2.3.1 (GTK+ 2.10.8; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 23 Jun 2007 00:40:09 +0200 Michael Prokop wrote: > | zsh: failed to write history file /home/grml/.zsh_history.new: unknown error 1182546552 > > The error code might be improved though. ;) Thanks for trying it. I forgot that %e doesn't use errno directly, it expects an argument (that's because sometimes we save the number and do something else before reporting the error). I've also reset errno to 0 beforehand, on the off chance that one of the possible failures doesn't set errno. I don't think that should happen, but I don't want a stray ENOENT from a previous error confusing the matter. Index: Src/hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hist.c,v retrieving revision 1.67 diff -u -r1.67 hist.c --- Src/hist.c 22 Jun 2007 20:32:20 -0000 1.67 +++ Src/hist.c 23 Jun 2007 18:05:01 -0000 @@ -2190,6 +2190,7 @@ if (isset(SHAREHISTORY)) extended_history = 1; } + errno = 0; if (writeflags & HFILE_APPEND) { tmpfile = NULL; out = fdopen(open(unmeta(fn), @@ -2302,10 +2303,10 @@ if (ret < 0 && err) { if (tmpfile) { - zerr("failed to write history file %s.new: %e", fn); + zerr("failed to write history file %s.new: %e", fn, errno); free(tmpfile); } else - zerr("failed to write history file %s: %e", fn); + zerr("failed to write history file %s: %e", fn, errno); } unlockhistfile(fn); -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/