develooper Front page | perl.perl5.porters | Postings from March 2000

[ID 20000325.007] join blows away SvUTF8 on first argument

Thread Next
From:
Larry Wall
Date:
March 25, 2000 17:20
Subject:
[ID 20000325.007] join blows away SvUTF8 on first argument
Message ID:
200003252340.PAA11481@kiev.wall.org
This is a bug report for perl from larry@kiev.wall.org,
generated with the help of perlbug 1.26 running under perl 5.006.


-----------------------------------------------------------------
[Please enter your report here]

The following demonstrates the bug.

    #!./perl

    $x = v2001.2002.2003;

    @x = unpack 'U*', $x;
    print "@x\n";

    $x = join '', map { chr } @x;

    printf "%vd\n", $x;

This prints:

    2001 2002 2003
    223.145.2002.2003

With the fix, it prints:

    2001 2002 2003
    2001.2002.2003

Here's the fix:

*** doop.c.orig	Sat Mar 25 15:29:00 2000
--- doop.c	Sat Mar 25 15:31:17 2000
***************
*** 660,671 ****
      if (items-- > 0) {
  	char *s;
  
! 	if (*mark) {
! 	    s = SvPV(*mark, tmplen);
! 	    sv_setpvn(sv, s, tmplen);
! 	}
! 	else
! 	    sv_setpv(sv, "");
  	mark++;
      }
      else
--- 660,668 ----
      if (items-- > 0) {
  	char *s;
  
! 	sv_setpv(sv, "");
! 	if (*mark)
! 	    sv_catsv(sv, *mark);
  	mark++;
      }
      else


[Please do not change anything below this line]
-----------------------------------------------------------------

---
This perlbug was built using Perl 5.00502 - Tue Jan 26 23:37:16 PST 1999
It is being executed now by  Perl 5.006 - Fri Mar 24 09:37:57 PST 2000.

Site configuration information for perl 5.006:

Configured by larry at Fri Mar 24 09:37:57 PST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos kiev 5.5.1 generic sun4u sparc sunw,ultra-1 '
    config_args='-de -Dcc=gcc -Doptimize=-g'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-g', gccversion=2.8.1
    cppflags='-DDEBUGGING -I/usr/local/include'
    ccflags ='-DDEBUGGING -I/usr/local/include '
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib '
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Locally applied patches:
    REPLACE_PREFIX - allows editing binary to change PREFIX

---
@INC for perl 5.006:
    /usr/local/lib/perl5/5.6.0/sun4-solaris
    /usr/local/lib/perl5/5.6.0
    /usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl/5.00552/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.00552
    /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.005
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl 5.006:
    HOME=/home/larry
    LANG (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/larry/bin:/home/larry/pl:/usr/sbin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/usr/local/bin:/home/scripts:/usr/bin/X11:/usr/etc:/work/bin:/work/src/jdk1.1.1/bin:/usr/local/frame/bin:/usr/local/pbmplus:/usr/openwin/bin:/usr/openwin/bin/xview:/usr/openwin/demo:.
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/tcsh

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