From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28281 invoked from network); 17 Jun 2005 08:15:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Jun 2005 08:15:32 -0000 Received: (qmail 34162 invoked from network); 17 Jun 2005 08:15:25 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Jun 2005 08:15:24 -0000 Received: (qmail 19856 invoked by alias); 17 Jun 2005 08:15:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21353 Received: (qmail 19846 invoked from network); 17 Jun 2005 08:15:21 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Jun 2005 08:15:21 -0000 Received: (qmail 33933 invoked from network); 17 Jun 2005 08:15:21 -0000 Received: from cluster-e.mailcontrol.com (HELO rly08e.srv.mailcontrol.com) (217.79.216.190) by a.mx.sunsite.dk with SMTP; 17 Jun 2005 08:15:14 -0000 Received: from iris.logica.co.uk (iris.logica.co.uk [158.234.9.163]) by rly08e.srv.mailcontrol.com (MailControl) with ESMTP id j5H8F8NZ018349; Fri, 17 Jun 2005 09:15:08 +0100 Received: from trentino.logica.co.uk ([158.234.142.59]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id j5H8F8KM016167; Fri, 17 Jun 2005 09:15:08 +0100 Received: from trentino.groupinfra.com (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id E1D947710F; Fri, 17 Jun 2005 10:15:07 +0200 (CEST) Cc: zsh-workers@sunsite.dk X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: <42B2203B.3060602@gentoo.org> From: Oliver Kiddle References: <42B2203B.3060602@gentoo.org> To: =?UTF-8?B?SGFyYWxkIHZhbiBExLNr?= Subject: Re: printf bug(s?) Date: Fri, 17 Jun 2005 10:15:07 +0200 Message-ID: <8037.1118996107@trentino.groupinfra.com> X-Scanned-By: MailControl A-04-00-00-235 (www.mailcontrol.com) X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.5 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.5 Harald van D?k wrote: > When I run the command printf '%', zsh 4.2.5 gives me a segfault. It I can't reproduce the segfault on any system I have access to so perhaps it is platform specific. Your fix looks right so I'll commit it to CVS. Thanks. > 2: > > That segfault I noticed when I tried to run printf '\045'. I expected > this to print a single character '%', the same as printf '%%' would. zsh > instead treats it exactly as an ordinary % character. Is this a bug, or It's not a bug as such. Note that it is entirely consistent with how printf works from C. I think there was a brief discussion about it when printf was first added. The current implementation makes it easier to share the \ handling code with echo. It just calls getkeystring() on the whole format specification first. I seem to remember that, at the time, a survey of how other printf implementations worked showed a complete mix so it seemed justifiable to take the lazy option. However, I would agree that your expected behaviour would probably be better. > " "\ddd", where ddd is a one, two, or three-digit octal number, shall > be written as a byte with the numeric value specified by the octal > number. " It's difficult to know whether it was intended by the wording or not. However, that wording also means that \7 should output a bell character (you need \07 at the moment). Annoyingly, the specification for how \ escapes work is subtly different for echo and printf. I think \c has a different definition too. So what we probably need to do is have the printf code handle \ escapes itself at the same time as it scans through the specification looking for format specifiers. Oliver This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.