From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28829 invoked by alias); 29 Dec 2010 21:21:15 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28551 Received: (qmail 21789 invoked from network); 29 Dec 2010 21:21:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.stack.nl designates 131.155.140.107 as permitted sender) Date: Wed, 29 Dec 2010 22:11:55 +0100 From: Jilles Tjoelker To: Zsh Hackers' List Subject: printf \045 (or whatever the character code for % is) Message-ID: <20101229211155.GA22720@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) While trying to run the FreeBSD sh testsuite with zsh, various tests fail because the printf builtin interprets \045 (ASCII) as a percent sign introducing a format specification instead of a literal percent sign. The \045 arises because I create all 255 non-zero byte values via octal escapes. POSIX's description assumes that the backslash escapes and format specifications are processed in one pass and simply says that an octal escape sequence shall write the corresponding byte. If they are separate passes the backslash escape removal step needs to know about percent signs. The sequences \% and \x25 are not specified and there seems little reason to use them. Input: printf '\045\n' Expected result: Succeeds and prints "%". Actual result: Fails and prints error message "printf: %\n: invalid directive". Input: printf '\045d.%d\n' 4 5 Expected result: %d.4 %d.5 Actual result: 4.5 -- Jilles Tjoelker