GNU bug report logs - #13485
wrong warning for format ~!

Previous Next

Package: guile;

Reported by: Daniel Llorens <daniel.llorens <at> bluewin.ch>

Date: Fri, 18 Jan 2013 12:10:01 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13485 in the body.
You can then email your comments to 13485 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#13485; Package guile. (Fri, 18 Jan 2013 12:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Llorens <daniel.llorens <at> bluewin.ch>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Fri, 18 Jan 2013 12:10:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Llorens <daniel.llorens <at> bluewin.ch>
To: bug-guile <at> gnu.org
Subject: wrong warning for format ~!
Date: Fri, 18 Jan 2013 13:09:00 +0100
In 2.0.7

scheme@(guile-user)> (import (ice-9 format))
scheme@(guile-user)> (format #t "~!")
;;; <stdin>:2:0: warning: "~!": wrong number of `format' arguments: expected 1, got 0
$1 = #t
scheme@(guile-user)> (format #t "~!" 3)
$2 = #t
scheme@(guile-user)> (format #t "~!~a" 3 9)  
3$3 = #t
scheme@(guile-user)> (format #t "~a~!" 3 9)  
3$4 = #t
scheme@(guile-user)> (version)
$5 = "2.0.7.28-581f4"

So it doesn't take an argument, it only affects the warning.

Regards,

	Daniel



Information forwarded to bug-guile <at> gnu.org:
bug#13485; Package guile. (Fri, 18 Jan 2013 21:38:02 GMT) Full text and rfc822 format available.

Message #8 received at 13485 <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: Daniel Llorens <daniel.llorens <at> bluewin.ch>
Cc: 13485 <at> debbugs.gnu.org
Subject: Re: bug#13485: wrong warning for format ~!
Date: Fri, 18 Jan 2013 21:36:59 +0000
Daniel Llorens <daniel.llorens <at> bluewin.ch> writes:

> In 2.0.7
>
> scheme@(guile-user)> (import (ice-9 format))
> scheme@(guile-user)> (format #t "~!")
> ;;; <stdin>:2:0: warning: "~!": wrong number of `format' arguments: expected 1, got 0
> $1 = #t
> scheme@(guile-user)> (format #t "~!" 3)
> $2 = #t
> scheme@(guile-user)> (format #t "~!~a" 3 9)  
> 3$3 = #t
> scheme@(guile-user)> (format #t "~a~!" 3 9)  
> 3$4 = #t
> scheme@(guile-user)> (version)
> $5 = "2.0.7.28-581f4"
>
> So it doesn't take an argument, it only affects the warning.
Okay, I've confirmed this, and as far as I've been able to determine you
are correct. The problem only seems to be with the warning, not format
itself.

In format-string-argument-count in the module
module/language/tree-il/analyze.scm the ~! option gets picked up by the
else case of the loop, which adds one to both the max and minimum number
of parameters. Clearly this is a mistake.

I'm currently looking through the format docs to see if any others are
mishandled, and will post a patch later.


PS. I'm really glad this wasn't a bug in format, since that is one scary
function. :)

-- 
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"




Information forwarded to bug-guile <at> gnu.org:
bug#13485; Package guile. (Sat, 19 Jan 2013 17:26:03 GMT) Full text and rfc822 format available.

Message #11 received at 13485 <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: Daniel Llorens <daniel.llorens <at> bluewin.ch>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 13485 <at> debbugs.gnu.org
Subject: Re: bug#13485: wrong warning for format ~!
Date: Sat, 19 Jan 2013 17:24:26 +0000
[Message part 1 (text/plain, inline)]
Ian Price <ianprice90 <at> googlemail.com> 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). The two main issues were
sequences that don't take an argument updating the count, and some
sequences were not treated insensitively.

~^ confused me a little, but I think I have the correct behaviour for it

Ludovic,
are there test cases for this? I'm not sure where to look

-- 
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"
[0001-Fix-argument-count-for-various-format-string-escape-.patch (text/x-patch, attachment)]

Information forwarded to bug-guile <at> gnu.org:
bug#13485; Package guile. (Sat, 19 Jan 2013 17:47:02 GMT) Full text and rfc822 format available.

Message #14 received at 13485 <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: Daniel Llorens <daniel.llorens <at> bluewin.ch>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 13485 <at> debbugs.gnu.org
Subject: Re: bug#13485: wrong warning for format ~!
Date: Sat, 19 Jan 2013 17:45:20 +0000
[Message part 1 (text/plain, inline)]
Ian Price <ianprice90 <at> googlemail.com> 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"
[0001-Fix-escape-sequence-parameter-handling-in-format-str.patch (text/x-patch, attachment)]

Information forwarded to bug-guile <at> gnu.org:
bug#13485; Package guile. (Sat, 19 Jan 2013 20:30:02 GMT) Full text and rfc822 format available.

Message #17 received at 13485 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Ian Price <ianprice90 <at> googlemail.com>
Cc: 13485 <at> debbugs.gnu.org, Daniel Llorens <daniel.llorens <at> bluewin.ch>
Subject: Re: bug#13485: wrong warning for format ~!
Date: Sat, 19 Jan 2013 21:28:46 +0100
Hi!

Ian Price <ianprice90 <at> googlemail.com> skribis:

> 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). The two main issues were
> sequences that don't take an argument updating the count, and some
> sequences were not treated insensitively.

Excellent.

> Ludovic,
> are there test cases for this? I'm not sure where to look

Yes, in tree-il.test.  Can you add them?

Thanks!

Ludo’.




Information forwarded to bug-guile <at> gnu.org:
bug#13485; Package guile. (Mon, 28 Jan 2013 14:38:02 GMT) Full text and rfc822 format available.

Message #20 received at 13485 <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 13485 <at> debbugs.gnu.org, Daniel Llorens <daniel.llorens <at> bluewin.ch>
Subject: Re: bug#13485: wrong warning for format ~!
Date: Mon, 28 Jan 2013 14:36:43 +0000
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:

>> Ludovic,
>> are there test cases for this? I'm not sure where to look
>
> Yes, in tree-il.test.  Can you add them?

Attached a patch that squashes the previous two and adds tests. I still
may want to add an additional patch to get some better errors for
sequence parameters.

-- 
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"

[0001-Fix-argument-count-for-various-format-string-escape-.patch (text/x-patch, attachment)]

Information forwarded to bug-guile <at> gnu.org:
bug#13485; Package guile. (Mon, 28 Jan 2013 16:25:02 GMT) Full text and rfc822 format available.

Message #23 received at 13485 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Ian Price <ianprice90 <at> googlemail.com>
Cc: 13485 <at> debbugs.gnu.org, Daniel Llorens <daniel.llorens <at> bluewin.ch>
Subject: Re: bug#13485: wrong warning for format ~!
Date: Mon, 28 Jan 2013 17:23:49 +0100
Ian Price <ianprice90 <at> googlemail.com> skribis:

> Attached a patch that squashes the previous two and adds tests.

Looks good to me, feel free to push.

> I still may want to add an additional patch to get some better errors
> for sequence parameters.

That can be done in a separate patch.

Thanks!

Ludo’.




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Thu, 07 Mar 2013 22:25:02 GMT) Full text and rfc822 format available.

Notification sent to Daniel Llorens <daniel.llorens <at> bluewin.ch>:
bug acknowledged by developer. (Thu, 07 Mar 2013 22:25:02 GMT) Full text and rfc822 format available.

Message #28 received at 13485-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: 13485-done <at> debbugs.gnu.org
Subject: Re: bug#13485: wrong warning for format ~!
Date: Thu, 07 Mar 2013 23:24:06 +0100
Fixed in 90baf8cdfe8ce356ee4720a012e0deb5a2cb5818 by ijp.  Thanks to
all!
-- 
http://wingolog.org/




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 05 Apr 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.