use-format-literals.patch breaks compilation of glr grammars

Bug #949732 reported by Roger Ferrer Ibanez
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bison (Ubuntu)
Fix Released
Undecided
Kees Cook

Bug Description

Description: Ubuntu precise (development branch)
Release: 12.04

bison:
  Installed: 1:2.5.dfsg-2ubuntu1
  Candidate: 1:2.5.dfsg-2ubuntu1
  Version table:
 *** 1:2.5.dfsg-2ubuntu1 0
        500 http://es.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

When compiling a C (not C++) GLR grammar, Ubuntu's patched Bison 2.5 generates an invalid file that cannot be compiled because yyerror is called with more arguments than parameters.

For instance, in my grammar the generated .c file contains two calls to yyerror like this one

    yyerror (parsed_tree, "%s", yymsg);

which is wrong since yyerror in my grammar only has two parameters: that extra "%s" is amiss.

Note that there are other calls to yyerror in the glr.c skeleton which do not suffer from this problem.

Upstream version 2.5 from GNU site works fine.

Kind regards,

Revision history for this message
Kees Cook (kees) wrote : Re: [Bug 949732] [NEW] use-format-literals.patch breaks compilation of glr grammars

On Thu, Mar 08, 2012 at 08:12:47AM -0000, Roger Ferrer Ibanez wrote:
> When compiling a C (not C++) GLR grammar, Ubuntu's patched Bison 2.5
> generates an invalid file that cannot be compiled because yyerror is
> called with more arguments than parameters.
>
> For instance, in my grammar the generated .c file contains two calls to
> yyerror like this one
>
> yyerror (parsed_tree, "%s", yymsg);
>
> which is wrong since yyerror in my grammar only has two parameters: that
> extra "%s" is amiss.
>
> Note that there are other calls to yyerror in the glr.c skeleton which
> do not suffer from this problem.
>
> Upstream version 2.5 from GNU site works fine.

Yeah, this seems to deviate from the upstream documentation:

http://www.gnu.org/software/bison/manual/html_node/Error-Reporting.html

It's the implementations of yyerror that need to make sure they don't
use a format literal.

-Kees

--
Kees Cook

Revision history for this message
Kees Cook (kees) wrote :

Yeah, this seems to deviate from the upstream documentation:

http://www.gnu.org/software/bison/manual/html_node/Error-Reporting.html

It's the implementations of yyerror that need to make sure they don't
use a format literal.

For more details, see https://bugs.launchpad.net/ubuntu/+source/bison/+bug/890434

Revision history for this message
Kees Cook (kees) wrote :

I've removed the Ubuntu change. We'll individually fix any users of yyerror that throw format warnings.

bison (1:2.5.dfsg-2.1) unstable; urgency=low

  * Non-maintainer upload.
  * Add "Conflicts: liby-dev (= 1:2.5.dfsg-1)" to libbison-dev to ensure
    that this version that should never have existed gets dropped from
    user's systems. Closes: #645038

Changed in bison (Ubuntu):
assignee: nobody → Kees Cook (kees)
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.