[Bug 530275] Review Request: rubygem-erubis - A fast and extensible eRuby implementation

bugzilla at redhat.com bugzilla at redhat.com
Wed Oct 28 19:02:23 UTC 2009


Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug.


https://bugzilla.redhat.com/show_bug.cgi?id=530275





--- Comment #4 from Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp>  2009-10-28 15:02:21 EDT ---
Well, finaly I reached the reason why test_syntax2 fails, which is
actually how ruby (especially parse.c) is rebuilt.

The failing test program is:
$ ruby -e 'require "rubygems" ; require "erubis" ; require "erubis/main" ;
Erubis::Main.new.execute(["-z", "tmp.test_syntax2"])'
where the file "tmp.test_syntax2" is as below:
------------------------------------------------------------
$ cat tmp.test_syntax2 
<ul>
<% for item in list %>
  <li><%= item[:name]] %></li>
<% end %>
</ul>
------------------------------------------------------------

The result expected by rubygem-erubis's test is:
------------------------------------------------------------
tmp.test_syntax2:3: syntax error, unexpected ']', expecting ')'
 _buf << '  <li>'; _buf << ( item[:name]] ).to_s; _buf << '</li>
                                         ^
-:4: syntax error, unexpected kEND, expecting ')'
'; end 
      ^
-:7: syntax error, unexpected $end, expecting ')'
------------------------------------------------------------
however Fedora's ruby returns:
------------------------------------------------------------
tmp.test_syntax2:3: syntax error
 _buf << '  <li>'; _buf << ( item[:name]] ).to_s; _buf << '</li>
                                         ^
-:4: syntax error
'; end 
      ^
-:7: syntax error
------------------------------------------------------------

This is because when regenerating parse.c (which is in ruby source code),
on Fedora "$ byacc parse.y" is used while the original source uses
"$ bison -y parse.y". This causes the following difference:
------------------------------------------------------------
$ rm -f parse.c ; make parse.c YACC="byacc "
byacc  parse.y
sed '/^#/s|y\.tab\.c|parse.c|' y.tab.c > parse.c
rm -f y.tab.c
$ grep "syntax error" parse.c
    yyerror("syntax error");
$ 
$ 
$ rm -f parse.c ; make parse.c YACC="bison -y "
bison -y  parse.y
sed '/^#/s|y\.tab\.c|parse.c|' y.tab.c > parse.c
rm -f y.tab.c
$ grep "syntax error" parse.c
   If YYTABLE_NINF, syntax error.  */
      yyerror (YY_("syntax error: cannot back up")); \
   copied.  As a special case, return 0 if an ordinary "syntax error"
      YY_("syntax error, unexpected %s");
      YY_("syntax error, unexpected %s, expecting %s");
      YY_("syntax error, unexpected %s, expecting %s or %s");
      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
      static char const yyunexpected[] = "syntax error, unexpected %s";
/* Number of syntax errors so far.  */
      yyerror (YY_("syntax error"));
     yyerror (YY_("syntax error"));
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
------------------------------------------------------------ 
So the error messages actually change.

What I don't know currently is that whether it is strictly expected
on usual or not that ruby returns error messages in this format.
Do you know some reason that rubygem-erubis strictly expectes this
format?

-- 
Configure bugmail: https://bugzilla.redhat.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.




More information about the Fedora-package-review mailing list