develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #62696] pack/unpack error

From:
James E Keenan via RT
Date:
May 27, 2013 01:09
Subject:
[perl #62696] pack/unpack error
Message ID:
rt-3.6.HEAD-2650-1369616948-1624.62696-15-0@perl.org
On Sat Jan 24 07:00:26 2009, grian wrote:
> 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"
> 

Can anyone hazard an opinion as to whether the erroneous cases described
in this older ticket are indeed erroneous?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=62696



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