develooper Front page | perl.perl5.porters | Postings from January 2009

[perl #62696] pack/unpack error

From:
Anatoly Grishaev
Date:
January 25, 2009 06:02
Subject:
[perl #62696] pack/unpack error
Message ID:
rt-3.6.HEAD-28035-1232809226-591.62696-75-0@perl.org
# New Ticket Created by  Anatoly Grishaev 
# Please include the string:  [perl #62696]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=62696 >


This is a bug report for perl from gtoly@toh-dev.localdomain,
generated with the help of perlbug 1.36 running under perl 5.10.0.


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


Can't unpack packed before string

Here code:
my $str = pack "w/a(w/a)*", "Hello";
print unpack "w/a(w/a)*", $str;
>> '/' must follow a numeric type in unpack at ...

This also don't work
print join ":", 
   unpack "N/a(w/a)*", 
     pack "N/a(w/a)*", "Hello"

and this don't work 
   print join q[:],unpack q[n(w/a)*], pack q[n(w/a)*], 1

And this works

print join ":",
   unpack "(w/a)*",
     pack "(w/a)*";

And this also works


print join ":",
   unpack "w/a(w/a)*",
     pack "w/a(w/a)*", "Hello", 'World';

And this works strange:
   unpack "(nn)*", pack "n*", 1 
   produce (1), but here must warnings or error or empty list

All code in one-line:

perl -e "print join q[:],unpack q[n(w/a)*], pack q[n(w/a)*], 1"
perl -e "print join q[:],unpack q[n/a(w/a)*], pack q[n/a(w/a)*], q[a]"
perl -e "print join q[:],unpack q[w/a(w/a)*], pack q[w/a(w/a)*], q[a]"

perl -e "print join q[:],unpack q[(w/a)*], pack q[(w/a)*], "
perl -e "print join q[:],unpack q[(w/a)*], pack q[(w/a)*], q[]"
perl -e "print join q[:],unpack q[(nn)*], pack q[(n)*], 1"

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.10.0:

Configured by gtoly at Sat Nov  1 16:44:39 MSK 2008.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.6.24.4, archname=x86_64-linux-thread-multi
    uname='linux toh-dev 2.6.24.4 #2 smp mon oct 6 15:36:34 msd 2008 x86_64 amd opteron(tm) processor 852 authenticamd gnulinux '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O3',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='4.1.2 (Gentoo 4.1.2 p1.0.2)', 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 =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.6.1.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.6.1'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O3 -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.10.0:
    /home/gtoly/lib/XS/Data-AMF-XS/blib/arch
    /home/gtoly/lib/XS/Data-AMF-XS/blib/lib
    /home/gtoly/lib
    /usr/local/lib/perl5/5.10.0/x86_64-linux-thread-multi
    /usr/local/lib/perl5/5.10.0
    /usr/local/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.10.0
    .

---
Environment for perl 5.10.0:
    HOME=/home/gtoly
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/subversion/bin:/toh:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2:~/bin:/home/toh/toh.ru/bin
    PERL5LIB=/home/gtoly/lib
    PERL5OPT= -M5.010 -MData::Dumper -MExtUtils::testlib
    PERL_BADLANG (unset)
    SHELL=/bin/bash




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