Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl-5.005.02: glitch in h2ph #792

Closed
p5pRT opened this issue Oct 27, 1999 · 3 comments
Closed

Perl-5.005.02: glitch in h2ph #792

p5pRT opened this issue Oct 27, 1999 · 3 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Oct 27, 1999

Migrated from rt.perl.org#1719 (status was 'resolved')

Searchable as RT1719$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 27, 1999

From syl@alcor.concordia.ca

I think I may have found a bug in h2ph included in Perl-5.005. I
actually noticed this while working with Perl-5.005.01, but I checked
the h2ph in Perl-5.005.02 and it has this same problem. The only other
version I checked was Perl-5.004.03, and h2ph in that version doesn't
seem to have any of the affected code, so it likely doesn't have this
bug (or the feature that tickles the bug).

I'm working on a Solaris-2.7 system (uname -a​: SunOS monty 5.7
Generic_106541-05 sun4u sparc SUNW,Ultra-1), with a script that we use
successfully on a number of other systems (DEC Alpha/OSF, Intel/Linux,
and Intel/NetBSD).

The script uses Sys​::Syslog for logging, and it's that "use" statement
that seems to trigger the trouble, (the exact error messages are
appended below my signature -- I apologize for the long lines).

The lines in the .../feature_tests.ph file (again, I apologize for long
lines), with a bit of surrounding context are (note lines 22 and 29)​:

17 if(defined( &_LP64)) {
18 unless(defined(&_FILE_OFFSET_BITS)) {
19 eval 'sub _FILE_OFFSET_BITS () {64;}' unless defined(&_FILE_
ET_BITS);
20 }
21 if((defined(&_FILE_OFFSET_BITS) ? &_FILE_OFFSET_BITS : 0) - 0!=
{
22 die(""invalid _FILE_OFFSET_BITS value specified"");
23 }
24 } else {
25 unless(defined(&_FILE_OFFSET_BITS)) {
26 eval 'sub _FILE_OFFSET_BITS () {32;}' unless defined(&_FILE_
ET_BITS);
27 }
28 if((defined(&_FILE_OFFSET_BITS) ? &_FILE_OFFSET_BITS : 0) - 0!=
& (defined(&_FILE_OFFSET_BITS) ? &_FILE_OFFSET_BITS : 0) - 0!= 64) {
29 die(""invalid _FILE_OFFSET_BITS value specified"");
30 }
31 }

The original /usr/include/sys/feature_tests.h file from which that was
created has the following​:

87 #if defined(_LP64)
88 #ifndef _FILE_OFFSET_BITS
89 #define _FILE_OFFSET_BITS 64
90 #endif
91 #if _FILE_OFFSET_BITS - 0 != 64
92 #error "invalid _FILE_OFFSET_BITS value specified"
93 #endif
94 #else /* _LP64 */
95 #ifndef _FILE_OFFSET_BITS
96 #define _FILE_OFFSET_BITS 32
97 #endif
98 #if _FILE_OFFSET_BITS - 0 != 32 && _FILE_OFFSET_BITS - 0 != 64
99 #error "invalid _FILE_OFFSET_BITS value specified"
100 #endif
101 #endif /* _LP64 */

Note the #error messages are already surrounded by quotation marks. The
code in h2ph which I believe contains the bug is​:

199 } elsif(/^error\s+(.*)/) {
200 print OUT $t, "die(\"$1\");\n";
201 } elsif(/^warning\s+(.*)/) {
202 print OUT $t, "warn(\"$1\");\n";

I propose the following patch (created against 5.005.01, but it should
work equally well on 5.005.02), which I believe corrects this problem​:

Inline Patch
--- utils/h2ph.PL.original    Fri Jul 24 00:02:28 1998
+++ utils/h2ph.PL     Wed Oct 27 16:04:17 1999
@@ -230,10 +230,10 @@
                print OUT $t,"}\n";
            } elsif(/^undef\s+(\w+)/) {
                print OUT $t, "undef(&$1) if defined(&$1);\n";
-           } elsif(/^error\s+(.*)/) {
-               print OUT $t, "die(\"$1\");\n";
-           } elsif(/^warning\s+(.*)/) {
-               print OUT $t, "warn(\"$1\");\n";
+           } elsif(/^error\s+("?)(.*)\1/) {
+               print OUT $t, "die(\"$2\");\n";
+           } elsif(/^warning\s+("?)(.*)\1/) {
+               print OUT $t, "warn(\"$2\");\n";
            } elsif(/^ident\s+(.*)/) {
                print OUT $t, "# $1\n";
            }

I've tested the resulting h2ph script on the same Solaris-2.7 machine mentioned above\, and the \.\.\./sys/feature\_tests\.ph file appears correct\.

I hope you'll consider incorporating this patch in a future release of
Perl.

--


Sylvain Robitaille syl@​alcor.concordia.ca

Systems analyst Concordia University
Instructional & Information Technology Montreal, Quebec, Canada


: monty[syl] ~; perl -cwT /local/bin/newsyslog-2.1/newsyslog
Bareword found where operator expected at /local/lib/perl-5.005.01/sys/feature_tests.ph line 22, near """invalid"
  (Missing operator before invalid?)
Unquoted string "invalid" may clash with future reserved word at /local/lib/perl-5.005.01/sys/feature_tests.ph line 22.
Bareword found where operator expected at /local/lib/perl-5.005.01/sys/feature_tests.ph line 22, near "invalid _FILE_OFFSET_BITS"
  (Do you need to predeclare invalid?)
Unquoted string "specified" may clash with future reserved word at /local/lib/perl-5.005.01/sys/feature_tests.ph line 22.
String found where operator expected at /local/lib/perl-5.005.01/sys/feature_tests.ph line 22, near "specified"""
Bareword found where operator expected at /local/lib/perl-5.005.01/sys/feature_tests.ph line 29, near """invalid"
  (Missing operator before invalid?)
Unquoted string "invalid" may clash with future reserved word at /local/lib/perl-5.005.01/sys/feature_tests.ph line 29.
Bareword found where operator expected at /local/lib/perl-5.005.01/sys/feature_tests.ph line 29, near "invalid _FILE_OFFSET_BITS"
  (Do you need to predeclare invalid?)
Unquoted string "specified" may clash with future reserved word at /local/lib/perl-5.005.01/sys/feature_tests.ph line 29.
String found where operator expected at /local/lib/perl-5.005.01/sys/feature_tests.ph line 29, near "specified"""
syntax error at /local/lib/perl-5.005.01/sys/feature_tests.ph line 22, near """invalid "
syntax error at /local/lib/perl-5.005.01/sys/feature_tests.ph line 29, near """invalid "
BEGIN failed--compilation aborted at /local/bin/newsyslog-2.1/newsyslog line 192

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 27, 1999

From [Unknown Contact. See original ticket]

On Wed, Oct 27, 1999 at 05​:36​:26PM -0400, Sylvain Robitaille wrote​:

I think I may have found a bug in h2ph included in Perl-5.005. I
actually noticed this while working with Perl-5.005.01, but I checked
the h2ph in Perl-5.005.02 and it has this same problem. The only other
version I checked was Perl-5.004.03, and h2ph in that version doesn't
seem to have any of the affected code, so it likely doesn't have this
bug (or the feature that tickles the bug).

I'm working on a Solaris-2.7 system (uname -a​: SunOS monty 5.7
Generic_106541-05 sun4u sparc SUNW,Ultra-1), with a script that we use
successfully on a number of other systems (DEC Alpha/OSF, Intel/Linux,
and Intel/NetBSD).

The script uses Sys​::Syslog for logging, and it's that "use" statement
that seems to trigger the trouble, (the exact error messages are
appended below my signature -- I apologize for the long lines).

  Thanks for your bug report and patch. This has already been fixed
in the latest stable Perl (5.005_03) and the latest development Perl
(5.005_62).

  Peace,
* Kurt Starsinic (Kurt.Starsinic@​isinet.com) --------- Technical Specialist *
| `The future masters of technology will have to be lighthearted and |
| intelligent. The machine easily masters the grim and the dumb.' |
| -- Marshall McLuhan |
Institute for Scientific Information http​://www.isinet.com/

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 27, 1999

From [Unknown Contact. See original ticket]

On Wed, 27 Oct 1999, Kurt D. Starsinic wrote​:

Thanks for your bug report and patch. This has already been fixed
in the latest stable Perl (5.005_03) and the latest development Perl
(5.005_62).

I see. Sorry I didn't check to see if there was a newer stable version
(and if the bug in question had already been fixed in it).

mea culpa! Thanks for the response...

--


Sylvain Robitaille syl@​alcor.concordia.ca

Systems analyst Concordia University
Instructional & Information Technology Montreal, Quebec, Canada


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.