#464122 perl-byacc: byacc incorrectly escapes '%' in printf thus creating erroneous bless line in new() #464122
- Package:
- perl-byacc
- Source:
- perl-byacc
- Description:
- Berkeley LALR parser generator, Perl version
- Submitter:
- Bartek Kania
- Date:
- 2024-04-25 13:12:03 UTC
- Severity:
- important
On line 87 the following line is present: fprintf(code_file, " my %s $p = bless [\\%FIELDS], $_[0];\n", this does not escape the % correctly and as such fprintf() interprets it as the control sequence %F. The fix is to change % to %% resulting in the following line: fprintf(code_file, " my %s $p = bless [\\%%FIELDS], $_[0];\n",
Hi! Forgot to specify that the problem is in output.c /B
[Bartek Kania 2008-02-05]
I suspect the patch you propose is this one:
diff --git a/output.c b/output.c
index dbd85be..b0ab93b 100644
--- a/output.c
+++ b/output.c
@@ -84,7 +84,7 @@ void output()
if (language == PERL) {
fprintf(code_file, "sub new {\n");
if (perl5005flag) {
- fprintf(code_file, " my %s $p = bless [\\%FIELDS], $_[0];\n",
+ fprintf(code_file, " my %s $p = bless [\\%%FIELDS], $_[0];\n",
perl_package);
}
else {
Unfortunately I do not have any way to test if it work or not. Do you
have some test files that can be used to demonstrate the problem?