From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.bugs Subject: bug#13485: wrong warning for format ~! Date: Sat, 19 Jan 2013 17:45:20 +0000 Message-ID: <87k3r9oymn.fsf@Kagami.home> References: <14036101-9158-4630-A94B-530B63338BB4@bluewin.ch> <87sj5yp404.fsf@Kagami.home> <87obglozlh.fsf@Kagami.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1358617573 23586 80.91.229.3 (19 Jan 2013 17:46:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Jan 2013 17:46:13 +0000 (UTC) Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 13485@debbugs.gnu.org To: Daniel Llorens Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Jan 19 18:46:31 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TwcUx-0002Fx-Cd for guile-bugs@m.gmane.org; Sat, 19 Jan 2013 18:46:31 +0100 Original-Received: from localhost ([::1]:46365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwcUg-0005Pl-Fk for guile-bugs@m.gmane.org; Sat, 19 Jan 2013 12:46:14 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwcUc-0005PU-ID for bug-guile@gnu.org; Sat, 19 Jan 2013 12:46:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwcUb-0006KS-95 for bug-guile@gnu.org; Sat, 19 Jan 2013 12:46:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwcUb-0006KO-4E for bug-guile@gnu.org; Sat, 19 Jan 2013 12:46:09 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TwcVS-0003gk-2M for bug-guile@gnu.org; Sat, 19 Jan 2013 12:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ian Price Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 19 Jan 2013 17:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13485 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 13485-submit@debbugs.gnu.org id=B13485.135861758414116 (code B ref 13485); Sat, 19 Jan 2013 17:47:02 +0000 Original-Received: (at 13485) by debbugs.gnu.org; 19 Jan 2013 17:46:24 +0000 Original-Received: from localhost ([127.0.0.1]:40523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TwcUp-0003fd-ET for submit@debbugs.gnu.org; Sat, 19 Jan 2013 12:46:23 -0500 Original-Received: from mail-wg0-f54.google.com ([74.125.82.54]:35254) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TwcUm-0003fU-DU for 13485@debbugs.gnu.org; Sat, 19 Jan 2013 12:46:21 -0500 Original-Received: by mail-wg0-f54.google.com with SMTP id fg15so2951420wgb.9 for <13485@debbugs.gnu.org>; Sat, 19 Jan 2013 09:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=axw4v0QXN8si9VWvrhCfoFDZHL7ckUXxfcnRHkk+yLg=; b=XznKjdwSFkzOZeXypOKPAoKLhmNrtWIEntvcJsFPUd5spdKk+toQmSuFSxoy1H4wfb AUpP6dqJ5tP0FRveLh+s7+XP4YJli9AAHAvAtJt0jzBCy5QgPeFFsc4MpG+L3Buhs1qp hLfj8lxyf/gq3Nd59boPOOKHVQC/orfLMs7OIsfHrWptEfr9f3Wn7VZO2ncrgmEqAQb9 eAkmqCgmVlwqVVUGODIxZLUudQIdgJTxl+cxSux2oF7w7K8eE7aylbLesz0Lu3W241nq gsKtUvUh/ulBsApxvJrgGAzPqGzqRtqeEKg/e9lHUkygK+Cd9q39BzRQYKQCwt8Oo9a6 FywQ== X-Received: by 10.181.13.75 with SMTP id ew11mr8840623wid.9.1358617525080; Sat, 19 Jan 2013 09:45:25 -0800 (PST) Original-Received: from Kagami.home (host86-161-100-250.range86-161.btcentralplus.com. [86.161.100.250]) by mx.google.com with ESMTPS id i2sm8861421wiw.3.2013.01.19.09.45.23 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 19 Jan 2013 09:45:24 -0800 (PST) In-Reply-To: <87obglozlh.fsf@Kagami.home> (Ian Price's message of "Sat, 19 Jan 2013 17:24:26 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6701 Archived-At: --=-=-= Ian Price writes: >> I'm currently looking through the format docs to see if any others are >> mishandled, and will post a patch later. > > So, having went through all of the docs for format, I think I've handled > all of the sequences correctly (except for the iteration ones, which > were already done, and I never double-checked). Okay, spoke too soon. I forgot about the ' # + - parts of parameters. I am less sure of these, but I have attached a patch. -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled" --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-escape-sequence-parameter-handling-in-format-str.patch Content-Description: parameter handling patch >From f479d801659708d04bf23d26bc81600d68282e18 Mon Sep 17 00:00:00 2001 From: Ian Price Date: Sat, 19 Jan 2013 17:40:24 +0000 Subject: [PATCH] Fix escape sequence parameter handling in format-string-argument-count * module/language/tree-il/analyze.scm (format-string-argument-count): + - # and ' should not increase the argument count. --- module/language/tree-il/analyze.scm | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/module/language/tree-il/analyze.scm b/module/language/tree-il/analyze.scm index 29dd876..badce9f 100644 --- a/module/language/tree-il/analyze.scm +++ b/module/language/tree-il/analyze.scm @@ -1263,7 +1263,7 @@ accurate information is missing from a given `tree-il' element." (loop (cdr chars) 'literal '() conditions end-group min-count max-count)) - ((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\, #\: #\@) + ((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\, #\: #\@ #\+ #\- #\#) (loop (cdr chars) 'tilde (cons (car chars) params) conditions end-group @@ -1342,6 +1342,11 @@ accurate information is missing from a given `tree-il' element." conditions end-group (+ argc min-count) (+ argc max-count)))) + ((#\') + (if (null? (cdr chars)) + (throw &syntax-error 'unexpected-termination) + (loop (cddr chars) 'tilde (cons (cadr chars) params) + conditions end-group min-count max-count))) (else (loop (cdr chars) 'literal '() conditions end-group (+ 1 min-count) (+ 1 max-count))))) -- 1.7.7.6 --=-=-=--