From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17332 invoked from network); 10 Mar 2009 16:07:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 10 Mar 2009 16:07:15 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 40985 invoked from network); 10 Mar 2009 14:18:59 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Mar 2009 14:18:59 -0000 Received: (qmail 15002 invoked by alias); 10 Mar 2009 14:18:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26708 Received: (qmail 14989 invoked from network); 10 Mar 2009 14:18:54 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 10 Mar 2009 14:18:54 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [85.115.60.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 86C5580307F8 for ; Tue, 10 Mar 2009 15:18:48 +0100 (CET) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly23d.srv.mailcontrol.com (MailControl) with ESMTP id n2AEIhYw026007 for ; Tue, 10 Mar 2009 14:18:43 GMT Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Tue, 10 Mar 2009 14:18:43 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id n2AEIgjt002111 for ; Tue, 10 Mar 2009 14:18:43 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id n2AEIg9N002107 for ; Tue, 10 Mar 2009 14:18:42 GMT X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: warn on "hard" hard link failure X-Mailer: MH-E 8.0.3; nmh 1.3; GNU Emacs 22.1.1 Date: Tue, 10 Mar 2009 14:18:41 +0000 Message-ID: <2106.1236694721@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 10 Mar 2009 14:18:43.0269 (UTC) FILETIME=[1E012F50:01C9A18B] X-Scanned-By: MailControl A_08_51_00 (www.mailcontrol.com) on 10.68.0.133 X-Virus-Scanned: ClamAV 0.92.1/9084/Tue Mar 10 08:11:13 2009 on bifrost X-Virus-Status: Clean This is reponse to Sourceforge issue 1968395: failures to create hard links aren't gracefully handled. Failing to create a link because the file already exists is the normal condition being handled by the locking code; however, a failure for any other reason is presumably a hard failure worthy of reporting. The same goes if stat() fails with anything other than ENOENT: in both cases we give up and should say so. It's possible this can be improved further. Index: Src/hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hist.c,v retrieving revision 1.87 diff -u -r1.87 hist.c --- Src/hist.c 25 Feb 2009 10:30:15 -0000 1.87 +++ Src/hist.c 10 Mar 2009 14:15:07 -0000 @@ -2433,13 +2433,16 @@ } else close(fd); while (link(tmpfile, lockfile) < 0) { - if (errno != EEXIST || !keep_trying) + if (errno != EEXIST) + zerr("failed to create hard link as lock file %s: %e", + lockfile, errno); + else if (!keep_trying) ; else if (stat(lockfile, &sb) < 0) { if (errno == ENOENT) continue; - } - else { + zerr("failed to stat lock file %s: %e", lockfile, errno); + } else { if (time(NULL) - sb.st_mtime < 10) sleep(1); else -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070