Date: 8 Apr 1999 20:31:09 -0000 From: Jos Backus <jbackus@plex.nl> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/11032: perl's h2ph's processing of cpp #warning/#error directives is broken. Message-ID: <19990408203109.4641.qmail@jos.bugworks.com>
next in thread | raw e-mail | index | archive | help
>Number: 11032 >Category: bin >Synopsis: h2ph's cpp #warning/#error directive processing is broken >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Apr 8 13:40:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Jos Backus >Release: FreeBSD 4.0-CURRENT i386 >Organization: BugWorks >Environment: -current as of today. jos% perl -v This is perl, version 5.005_02 built for i386-freebsd >Description: perl barfs when using the debugger because of improper quoting. /usr/include/sys/ioctl.h contains: #warning "Don't #include ioctl.h in the kernel. Include xxxio.h instead." /usr/libdata/perl/5.00502/mach/sys/ioctl.ph contains: warn(""Don't #include ioctl.h in the kernel. Include xxxio.h instead."" Not Good. >How-To-Repeat: jos% cat prog exit 0; jos% perl -d prog Loading DB routines from perl5db.pl version 1.0401 Emacs support available. Enter h or `h h' for help. Bareword found where operator expected at /usr/libdata/perl/5.00502/mach/sys/ioctl.ph line 4, near """Don't" require sys/ioctl.ph called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/readline.pm line 328 eval {...} called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/readline.pm line 328 readline::preinit called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/readline.pm line 89 require Term/ReadLine/readline.pm called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/Perl.pm line 58 eval {...} called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/Perl.pm line 58 Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x806b27c)', 'GLOB(0x806b318)') called at /usr/libdata/perl/5.00502/perl5db.pl line 1460 DB::setterm called at /usr/libdata/perl/5.00502/perl5db.pl line 418 DB::DB called at prog line 1 (Missing operator before Don't?) require sys/ioctl.ph called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/readline.pm line 328 eval {...} called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/readline.pm line 328 readline::preinit called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/readline.pm line 89 require Term/ReadLine/readline.pm called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/Perl.pm line 58 eval {...} called at /usr/local/lib/perl5/site_perl/5.005/Term/ReadLine/Perl.pm line 58 Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x806b27c)', 'GLOB(0x806b318)') called at /usr/libdata/perl/5.00502/perl5db.pl line 1460 DB::setterm called at /usr/libdata/perl/5.00502/perl5db.pl line 418 DB::DB called at prog line 1 main::(prog:1): exit 0; DB<1> q jos% >Fix: Fix h2ph to properly deal with these directives by escaping single quotes and removing the outermost quotes, if present: --- /usr/bin/h2ph.orig Thu Apr 8 22:02:27 1999 +++ /usr/bin/h2ph Thu Apr 8 22:26:50 1999 @@ -196,10 +196,12 @@ 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+"?(.*)"?$/) { + (my $text = $1) =~ s,',\\',g; + print OUT $t, "die(\"$text\");\n"; + } elsif(/^warning\s+"?(.*?)"?$/) { + (my $text = $1) =~ s,',\\',g; + print OUT $t, "warn(\"$text\");\n"; } elsif(/^ident\s+(.*)/) { print OUT $t, "# $1\n"; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990408203109.4641.qmail>