GNU bug report logs - #10846
warning: non-literal format string

Previous Next

Package: guile;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Sun, 19 Feb 2012 12:55:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

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 10846 in the body.
You can then email your comments to 10846 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#10846; Package guile. (Sun, 19 Feb 2012 12:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bruno Haible <bruno <at> clisp.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 19 Feb 2012 12:55:02 GMT) Full text and rfc822 format available.

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

From: Bruno Haible <bruno <at> clisp.org>
To: bug-guile <at> gnu.org
Subject: warning: non-literal format string
Date: Sun, 19 Feb 2012 13:52:33 +0100
Hi,

With the default settings, guile's compiler warns about a format string
that is returned by the gettext function.

How to reproduce:
================================= prog.scm =================================
(use-modules (ice-9 format))

(setlocale LC_ALL "")
(textdomain "prog")
(bindtextdomain "prog" ".")

(define n (string->number (list-ref (command-line) 1)))

(format #t "~A~%" (gettext "'Your command, please?', asked the waiter."))

(format #t "~@?~%" (ngettext "a piece of cake" "~D pieces of cake" n) n)

(format #t "~A~%" (format #f (gettext "~A is replaced by ~A.") "FF" "EUR"))
============================================================================

$ uname -srm
SunOS 5.11 i86pc
$ guile --version
guile (GNU Guile) 2.0.3.152-c5f6c2
...
$ guile -s prog.scm 2
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/bruno/gettext-0.18.2-32-static/gettext-tools/tests/prog.scm
;;; /home/bruno/gettext-0.18.2-32-static/gettext-tools/tests/prog.scm:13:18: warning: non-literal format string
;;; compiled /home/bruno/.cache/guile/ccache/2.0-LE-4-2.0/home/bruno/gettext-0.18.2-32-static/gettext-tools/tests/prog.scm.go
'Your command, please?', asked the waiter.
2 pieces of cake
FF is replaced by EUR.

Given that
  - It is normal for a program to be internationalized,
  - It is normal for an internationalized program to have its format strings
    passed through the gettext function.
such situations should not produce warnings with the default settings.

It's OK in my opinion to have this warning enabled through special options
or settings, though.

Bruno





Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Sun, 19 Feb 2012 23:01:02 GMT) Full text and rfc822 format available.

Notification sent to Bruno Haible <bruno <at> clisp.org>:
bug acknowledged by developer. (Sun, 19 Feb 2012 23:01:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Bruno Haible <bruno <at> clisp.org>
Cc: 10846-done <at> debbugs.gnu.org
Subject: Re: bug#10846: warning: non-literal format string
Date: Sun, 19 Feb 2012 23:57:49 +0100
Hi Bruno,

Bruno Haible <bruno <at> clisp.org> skribis:

> Given that
>   - It is normal for a program to be internationalized,
>   - It is normal for an internationalized program to have its format strings
>     passed through the gettext function.
> such situations should not produce warnings with the default settings.

Thanks, fixed here:

  http://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=afc9803113de660a761f476b7957e92cc60bad19
  http://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=98385ed20abdc191a67daef8a00b1df0290a074a

> It's OK in my opinion to have this warning enabled through special options
> or settings, though.

The ‘format’ warning is in ‘%auto-compilation-options’, but it can be
turned off at the user’s option.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 19 Mar 2012 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 40 days ago.

Previous Next


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