develooper Front page | perl.perl5.porters | Postings from February 2011

[perl #84680] POSIX::isdigit() returns 1 for the empty string

Thread Next
From:
Robert Lang
Date:
February 24, 2011 00:33
Subject:
[perl #84680] POSIX::isdigit() returns 1 for the empty string
Message ID:
rt-3.6.HEAD-24085-1298392064-770.84680-75-0@perl.org
# New Ticket Created by  Robert Lang 
# Please include the string:  [perl #84680]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=84680 >


This is a bug report for perl from perlbug@cg.cjb.net,
generated with the help of perlbug 1.39 running under perl 5.12.3.


-----------------------------------------------------------------
[Please describe your issue here]

POSIX::isdigit() returns 1 for the empty string which is
obviously wrong:

$ perl -MPOSIX -e 'print isdigit(""), "\n"'
1
$

That's probably because RETVAL is initialised to 1 in POSIX.xs
regardless of the string length (which is the case in all is*()
functions ...).

Verified with Perl 5.8.8, 5.10.1 and 5.12.3

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
     category=library
     severity=medium
     module=POSIX
---
Site configuration information for perl 5.12.3:

Configured by xx at Tue Feb 22 16:50:33 CET 2011.

Summary of my perl5 (revision 5 version 12 subversion 3) configuration:

   Platform:
     osname=linux, osvers=2.6.34.7-66.fc13.i686.pae, archname=i686-linux
     uname='linux xx 2.6.34.7-66.fc13.i686.pae #1 smp wed dec 15 
07:21:49 utc 2010 i686 i686 i386 gnulinux '
     config_args='-de -Dprefix=/tmp/perl-5.12.3'
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=undef, usemultiplicity=undef
     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
     use64bitint=undef, use64bitall=undef, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
     optimize='-O2',
     cppflags='-fno-strict-aliasing -pipe -fstack-protector 
-I/usr/local/include'
     ccversion='', gccversion='4.4.5 20101112 (Red Hat 4.4.5-2)', 
gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
     alignbytes=4, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib
     libs=-lnsl -ldl -lm -lcrypt -lutil -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
     libc=/lib/libc-2.12.2.so, so=so, useshrplib=false, libperl=libperl.a
     gnulibc_version='2.12.2'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
     cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib 
-fstack-protector'

Locally applied patches:


---
@INC for perl 5.12.3:
     /tmp/perl-5.12.3/lib/site_perl/5.12.3/i686-linux
     /tmp/perl-5.12.3/lib/site_perl/5.12.3
     /tmp/perl-5.12.3/lib/5.12.3/i686-linux
     /tmp/perl-5.12.3/lib/5.12.3
     .

---
Environment for perl 5.12.3:
     HOME=/home/xx
     LANG=en_US.UTF-8
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/xx/bin
     PERL_BADLANG (unset)
     SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About