Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 275660 - when using #include with perl -P error messages get filename and line numbers wrong.
Summary: when using #include with perl -P error messages get filename and line numbers...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Perl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-28 03:46 UTC by David van Laatum
Modified: 2009-06-28 07:45 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
test script (testcode.pl,58 bytes, text/plain)
2009-06-28 03:47 UTC, David van Laatum
Details
test script include (testcode2.pl,10 bytes, text/plain)
2009-06-28 03:47 UTC, David van Laatum
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David van Laatum 2009-06-28 03:46:42 UTC
Not sure if this is a perl/gcc gentoo specific bug or not but from investigating I have found that (at least gcc 4.3.2) outputs line number info differently to what perl is expecting.
ie gcc outputs
# 1 "testcode2.pl" 1
insted of
#line 1 "testcode2.pl"

Reproducible: Always

Steps to Reproduce:
1. write a perl script that uses includes that has an error in a included file or after an include
2.
3.

Actual Results:  
[13:06:31 david@mouse tmp]# ./testcode.pl 
Global symbol "$bla" requires explicit package name at ./testcode.pl line 9.
Execution of ./testcode.pl aborted due to compilation errors.


Expected Results:  
[13:06:31 david@mouse tmp]# ./testcode.pl 
Global symbol "$bla" requires explicit package name at ./testcode2.pl line 1.
Execution of ./testcode.pl aborted due to compilation errors.


Portage 2.1.6.13 (default/linux/x86/2008.0, gcc-4.3.2, glibc-2.8_p20080602-r1, 2.6.28.9 i686)
=================================================================
System uname: Linux-2.6.28.9-i686-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4600+-with-glibc2.0
Timestamp of tree: Sat, 27 Jun 2009 14:30:17 +0000
app-shells/bash:     3.2_p39
dev-lang/python:     2.5.4-r2
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.internode.on.net/pub/gentoo"
LDFLAGS="-Wl,-O1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://mirror.daboyz.lan.com/gentoo-portage"
USE="3dnow Xaw3d a52 acl apache2 automount bash-completion berkdb bzip2 caps cli clvm cman cracklib crypt ctype curl doc dri dts dv dvb dvd dvdread examples fam fortran ftp gd gdbm gif gpgme gpm gulm hash iconv imap ipv6 isdnlog jpeg jpeg2k ldap ldapsam libclamav lirc lm_sensors logrotate mbox midi ming mmap mmx mudflap mysql mysqli ncurses network nls nntp nptl nptlonly offensive openmp overlays pam pcre perl pg-hier pg-intdatetime php png pop posix postgres pppd python quotas readline reflection resolvconf samba server session simplexml smime smux snmp soap spl sql sse sse2 ssl swat sysfs syslog tcpd threads tidy truetype unicode v4l v4l2 vda x86 xattr xinetd xml xmlreader xmlrpc xmlwriter xorg xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="access auth auth_dbm auth_anon auth_digest alias file-cache echo charset-lite cache disk-cache mem-cache ext-filter case_filter case-filter-in deflate mime-magic cern-meta expires headers usertrack unique-id proxy proxy-connect proxy-ftp proxy-http info include cgi cgid dav dav-fs vhost-alias speling rewrite log_config logio env setenvif mime status autoindex asis negotiation dir imap actions userdir so filter authz_host vhost_alias mime_magic dav_fs dav_lock auth_basic authn_alias authn_anon authn_default authn_file authz_default authz_user" APACHE2_MPMS="prefork" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="vesa vga radeon"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 David van Laatum 2009-06-28 03:47:32 UTC
Created attachment 195931 [details]
test script
Comment 2 David van Laatum 2009-06-28 03:47:52 UTC
Created attachment 195932 [details]
test script include
Comment 3 David van Laatum 2009-06-28 03:51:11 UTC
[13:19:55 david@mouse tmp]# cpp -E -C -fworking-directory testcode.pl | perl -npe 's|^# (\d+) "(.*)".*$|#line $1 "$2"|' - | perl -c -
testcode.pl:1:2: error: invalid preprocessing directive #!
Global symbol "$bla" requires explicit package name at testcode2.pl line 1.
- had compilation errors.
shows the correct info (plus the error caused by the #!/usr/bin/perl)
Comment 4 David van Laatum 2009-06-28 04:03:37 UTC
[ebuild   R   ] dev-lang/perl-5.8.8-r5  USE="berkdb doc gdbm -build -debug -ithreads -perlsuid" 9,887 kB
[ebuild   R   ] sys-devel/gcc-4.3.2-r3  USE="doc fortran gtk mudflap nls openmp (-altivec) -bootstrap -build (-fixed-point) -gcj (-hardened) -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -nopie -objc -objc++ -objc-gc -test -vanilla" 57,645 kB
Comment 5 Torsten Veller (RETIRED) gentoo-dev 2009-06-28 07:05:50 UTC
Have a look at the -P description in perlrun (<http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlrun.pod>). It is a known problem:

| -P
| 
| NOTE: Use of -P is strongly discouraged because of its inherent problems,
| including poor portability.
| ...
| The problems of -P include, but are not limited to:
| ...
| * Script line numbers are not preserved.

In 5.10 upstream adds: "It is deprecated and will be removed in a future version of Perl."


Should we really investigate if a workaround fixes it in general or at least with latest gcc versions?
Comment 6 David van Laatum 2009-06-28 07:45:05 UTC
No I suppose its pointless if its going to go.... unfortunately Filter::cpp dosn't seem to preserve the line numbers ether...