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

[perl #38605] Storable 2.15 freeze/thaw silently corrupts qr// regexps on 5.8.8

Thread Next
From:
perlbug @ nissenhut . com
Date:
February 21, 2006 09:46
Subject:
[perl #38605] Storable 2.15 freeze/thaw silently corrupts qr// regexps on 5.8.8
Message ID:
rt-3.0.11-38605-130430.5.48058957461571@perl.org
# New Ticket Created by  perlbug@nissenhut.com 
# Please include the string:  [perl #38605]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38605 >


This is a bug report for perl from perlbug@nissenhut.com
generated with the help of perlbug 1.35 running under perl v5.8.8.


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

The Storable module silently corrupts regexps created with qr// during
freeze/thaw. The following code fragment shows the problem.

  use Storable qw(freeze thaw);
  use Data::Dumper;

  my $a = qr(this is a regexp);
  print Dumper($a);

  my $b = freeze($a);
  my $c = thaw($b);
  print Dumper($c);

Running it produces the following output:

  $VAR1 = qr/(?-xism:this is a regexp)/;
  $VAR1 = qr/Regexp=SCALAR(0x81f7b98)/;

The original and frozen/thawed regexps are not the same and do not
match the same strings.

While Regexp::Storable from CPAN provides a workaround, you typically
have to fall over the problem in Storable first before knowing you
need to get Regexp::Storable installed.

Can the functionality of Regexp::Storable be integrated into the core
Storable module?

David

david dot w dot james at nissenhut dot com

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=medium
---
Site configuration information for perl v5.8.8:

Configured by jamesdav at Tue Feb 21 14:22:15 GMT 2006.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=linux, osvers=2.4.21-32.0.1.el.msdwhugemem, archname=i686-linux
    uname='linux oyifd91 2.4.21-32.0.1.el.msdwhugemem #1 smp mon dec 5 21:32:44 est 2005 i686 i686 i386 gnulinux '
    config_args='-ds -e -Dprefix=/var/tmp/jamesdav/perl5'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef 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 -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-42)', 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 =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.8.8:
    /var/tmp/jamesdav/perl5/lib/5.8.8/i686-linux
    /var/tmp/jamesdav/perl5/lib/5.8.8
    /var/tmp/jamesdav/perl5/lib/site_perl/5.8.8/i686-linux
    /var/tmp/jamesdav/perl5/lib/site_perl/5.8.8
    /var/tmp/jamesdav/perl5/lib/site_perl
    .

---
Environment for perl v5.8.8:
    HOME=/ms/user/j/jamesdav
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LC_ALL=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/ms/dist/webinfra/bin://ms/dist/3rd/PROJ/perforce/2004.2.85665/exec://ms/dist/releng/PROJ/p4tools/prod/lib://ms/dist/releng/PROJ/p4tools/prod:/ms/user/j/jamesdav/bin:/ms/dist/aurora/bin:/usr/local/bin:/usr/bin:/bin:/usr/kerberos/bin:/ms/dist/perl5/bin:/ms/dist/fsf/bin:/ms/dist/afs/bin:/usr/X11R6/bin:/usr/bin/X11:.
    PERL_BADLANG (unset)
    SHELL=/bin/ksh


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