[^\s]+ won't match anything: perl 5.8.0 bug or screwed up machine?

  • Thread starter S P Arif Sahari Wibowo
  • Start date
S

S P Arif Sahari Wibowo

Hi!

I have this one machine that I help maintain remotely have its
perl 5.8.0 exhibit peculiar behaviour: the pattern [^\s]+ will
not match anything.

Observe this example:

$ cat bug.pl
#!/usr/bin/perl -w

while(<>) {
print "You type:".$_;
if(/([^\s]+)/) {
print "[$1] (".length($1).")\n";
}
else {
print "NONE\n";
}
}
$ echo foo bar | ./bug.pl
You type:foo bar
NONE
$

As comparison, I copied that small program to different systems,
one running newer (v5.8.5) and others run older (v5.6.1) perl.
The result in these systems are different with the first system:

$ echo foo bar | ./bug.pl
You type:foo bar
[foo] (3)
$

Any idea what happen?

Note that this example is a result of problem narrowing. I
obviously need the [^\s]+ for more complex regex, something like
[^\s\<\@]+

I tried reinstall linux from fresh rpm in the first system, but
the result stand. Then I updated to the one from Fedora Legacy
project, but it make no difference.

I have no comparable system either the distribution version nor
the perl version, so I cannot say for sure what is wrong here.

More info:

$ uname -a
Linux rinjani 2.6.10-rinjani #1 Thu Dec 30 11:22:45 CST 2004 i686 i686 i386 GNU/Linux
$ rpm -q perl
perl-5.8.0-90.0.13.legacy
$ cat /etc/*release*
Red Hat Linux release 9 (Shrike)
$ perl -v

This is perl, v5.8.0 built for i386-linux-thread-multi
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2002, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

$ perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.8-1.521smp, archname=i386-linux-thread-multi
uname='linux jan'
config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.0 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef'
useithreads=define usemultiplicity=
useperlio= d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=un uselongdouble=
usemymalloc=, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)', gccosandvers=''
gccversion='3.2.2 200302'
intsize=r, longsize=r, ptrsize=5, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long'
k', ivsize=4'
ivtype=, nvtype='double'
o_nonbl', nvsize=, Off_t='', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc'
l', ldflags =' -L/usr'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=
libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libper
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so', d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC'
ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5', lddlflags='s Unicode/Normalize XS/A'


Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Locally applied patches:
MAINT18379
SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962
Built under linux
Compiled at Jan 28 2006 08:04:14
@INC:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
 
J

Joe Smith

S said:
I have this one machine that I help maintain remotely have its perl
5.8.0 exhibit peculiar behaviour: the pattern [^\s]+ will not match
anything.

Version 5.8.0 has known bugs. Upgrade. The problem does not
show up in version 5.8.3 or later.
-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top