develooper Front page | perl.perl5.porters | Postings from July 2008

[perl #56834] No test coverage for the DO_UTF8() branch of case FF_CHECKCHOP in pp_formline

Nicholas Clark
July 11, 2008 11:30
[perl #56834] No test coverage for the DO_UTF8() branch of case FF_CHECKCHOP in pp_formline
Message ID:
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #56834]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.39 running under perl 5.11.0.

[Please describe your issue here]

There's no test coverage of any part of the DO_UTF8 branch of the FF_CHECKCHOP
case of pp_formline. Specifically, based on code inspection, I think that

			if (itemsize <= fieldsize) {
			    const char *send = chophere = s + itemsize;
			    while (s < send) {
				if (*s == '\r') {
				    itemsize = s - item;
				    chophere = s;
				if (*s++ & ~31)
				    gotsome = TRUE;

is wrong - chophere should be s + len (or some value in octects, not
characters). I think that this bug should manifest as an inability to find a
\r if the string is long enough with sufficient characters that encode as
multiple bytes of UTF-8.

Also, I think that the subsequent

			    sv_pos_u2b(sv, &itembytes, 0);

is needlessly inefficient. I think that the return value of itembytes is just
len as determined earlier by

		const char *s = item = SvPV_const(sv, len);

But I am not comfortable making this change without regression tests first.

Nicholas Clark

[Please do not change anything below this line]
Site configuration information for perl 5.11.0:

Configured by nick at Mon Jun 30 09:41:19 BST 2008.

Summary of my perl5 (revision 5 version 11 subversion 0) configuration:
    osname=linux, osvers=, archname=x86_64-linux
    uname='linux zazen #1 smp tue jan 9 00:53:46 gmt 2007 x86_64 gnulinux '
    config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dinc_version_list=  -Dinc_version_list_init=0 -Doptimize=-g -Uusethreads=n -Uuse64bitint -Dusemymalloc -Duseperlio -Accflags=-DPERL_TRACK_MEMPOOL -Dprefix=~/Sandpit/snap5.11.x-34094 -Dinstallman1dir=none -Dinstallman3dir=none -de'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=y, bincompat5005=undef
    cc='ccache gcc', ccflags ='-DPERL_TRACK_MEMPOOL -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    cppflags='-DPERL_TRACK_MEMPOOL -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.1.2 20061115 (prerelease) (Debian 4.1.1-21)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -g -L/usr/local/lib -fstack-protector'

Locally applied patches:

@INC for perl 5.11.0:

Environment for perl 5.11.0:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/bash Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About