Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > [^\s]+ won't match anything: perl 5.8.0 bug or screwed up machine?

Reply
Thread Tools

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

 
 
S P Arif Sahari Wibowo
Guest
Posts: n/a
 
      07-01-2006
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?

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
 
Reply With Quote
 
 
 
 
Dr.Ruud
Guest
Posts: n/a
 
      07-02-2006
S P Arif Sahari Wibowo schreef:

> perl 5.8.0 exhibit peculiar behaviour: the pattern [^\s]+ will
> not match anything.


Workaround: \S+

--
Affijn, Ruud

"Gewoon is een tijger."


 
Reply With Quote
 
 
 
 
S P Arif Sahari Wibowo
Guest
Posts: n/a
 
      07-02-2006
On Sun, 2 Jul 2006, Dr.Ruud wrote:
> S P Arif Sahari Wibowo schreef:
>> perl 5.8.0 exhibit peculiar behaviour: the pattern [^\s]+
>> will not match anything.

>
> Workaround: \S+


Actually I will need other character in that brackets, e.g.
[^\s\<\@]+ something like that. Can you tell me how your
workaround works in that case?

Thanks!

--
(Stephan Paul) Arif Sahari Wibowo
_____ _____ _____ _____
/____ /____/ /____/ /____
_____/ / / / _____/ http://www.arifsaha.com/
 
Reply With Quote
 
S P Arif Sahari Wibowo
Guest
Posts: n/a
 
      07-02-2006
On Sun, 2 Jul 2006, Todd W wrote:
> Give us some sample data please. Then we can help.


I did. I'll repost my original posting, then.

--
(Stephan Paul) Arif Sahari Wibowo
_____ _____ _____ _____
/____ /____/ /____/ /____
_____/ / / / _____/ http://www.arifsaha.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
re.sub(): replace longest match instead of leftmost match? John Gordon Python 13 12-20-2011 02:58 AM
pat-match.lisp or extend-match.lisp in Python? ekzept Python 0 08-10-2007 06:08 PM
[^\s]+ won't match anything: perl 5.8.0 bug or screwed up machine? S P Arif Sahari Wibowo Perl Misc 1 07-02-2006 09:49 PM
$match = true() for empty $match?? Victor XML 2 05-17-2004 10:43 AM
Java regex can't match lengthy match? hiwa Java 0 01-29-2004 10:09 AM



Advertisments