Skip Menu |
 

This queue is for tickets about the PAR-Packer CPAN distribution.

Report information
The Basics
Id: 75750
Status: resolved
Priority: 0/
Queue: PAR-Packer

People
Owner: Nobody in particular
Requestors: MOB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.969_01
  • 0.970
  • 0.973
  • 0.975
  • 0.976
  • 0.977
  • 0.978
  • 0.979
  • 0.980
  • 0.982
  • 0.989_01
  • 0.991
  • 0.992_01
  • 0.992_02
  • 0.992_03
  • 0.992_04
  • 0.992_05
  • 0.992_06
  • 1.000
  • 1.001
  • 1.002
  • 1.003
  • 1.004
  • 1.005
  • 1.006
  • 1.007
  • 1.008
  • 1.009
  • 1.010
  • 1.011
  • 1.012
  • 1.013
Fixed in: (no value)



Subject: PAR::Filter::Bleach is broken
Download (untitled) / with headers
text/plain 515b
The apply method PAR::Filter::Bleach is missing a step that makes the whole package useless (unless the purpose of the package is to make code unrunnable, in which case it is fine ;-) ). Before the "pack" statement in $_=<<'';y;\r\n;;d;$_=pack'b*',$_;$_=eval;$@&&die$@;$_ you need to convert the input string from whitespace back to binary digits: $_=<<'';y;\r\n;;d;y; \t;01;;$_=pack'b*',$_;$_=eval;$@&&die$@;$_ reference: http://stackoverflow.com/questions/9689108/how-to-unbleach- this-perl-file
Download (untitled) / with headers
text/plain 1.2k
On 2012-03-13 18:17:26, MOB wrote: Show quoted text
> The apply method PAR::Filter::Bleach is missing a step that makes the > whole package useless (unless the purpose of the package is to make code > unrunnable, in which case it is fine ;-) ).
Nope, it works (at least with Perl 5.8.8, 5.10.1, 5.12.3). Show quoted text
> Before the "pack" statement in > $_=<<'';y;\r\n;;d;$_=pack'b*',$_;$_=eval;$@&&die$@;$_ > you need to convert the input string from whitespace back to binary > digits: > $_=<<'';y;\r\n;;d;y; \t;01;;$_=pack'b*',$_;$_=eval;$@&&die$@;$_
This looks reasonable, but the original statement works :) It took me a couple minutes to figure out why e.g. pack "b*", "\t \t " returns "A". Here's a snippet from the perl source (Perl 5.12.3, file pp_pack.c, function S_pack_rec): while (l++ < len) { if (*str++ & 1) bits |= 0x80; if (l & 7) bits >>= 1; else { PUSH_BYTE(utf8, cur, bits); bits = 0; } } (str points to the string to pack). All that matters about the bytes to pack is their least significant bit: 0 for '0', 1 for '1), but also 0 for ' '=0x20, 1 for '\t'=0x09. So technically, there's nothing wrong with the code, but I'll apply the patch anyway, just for the fun moment I had while pondering it. Cheers, Roderich


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.