[LEDE-DEV] Bug in ipkg?

Philip Prindeville philipp_subx at redfish-solutions.com
Mon Jan 2 21:08:27 PST 2017


> On Jan 2, 2017, at 9:59 PM, Philip Prindeville <philipp_subx at redfish-solutions.com> wrote:
> 
> 
>> On Jan 2, 2017, at 9:32 PM, Philip Prindeville <philipp_subx at redfish-solutions.com> wrote:
>> 
>> I just saw something bizarre.
>> 
>> I had a Perl module (CGI v4.35) which contained the following:
>> 
>> my $appease_cpants_kwalitee = q/
>> use strict;
>> use warnings;
>> #/;
>> 
>> which is just a quoted string containing the lines that some sanity checking code expects to see (albeit as actual code, and not embedded as a string constant).
>> 
>> That was in the original source.
>> 
>> Getting into build_dir/target-xxx/perl/CGI-4.35/ and looking at ipkg-install/usr/lib/perl5/5.22/CGI.pm it’s identical to what’s in the tarball.
>> 
>> However, looking at ipkg-x86_64/perl-cgi/usr/lib/perl5/5.22/CGI.pm I see that every line starting with /^#/ has been deleted.  WTH???
>> 
>> Interestingly, lines beginning with /^[ \t]+#/ are untouched.
>> 
>> Is ipkg doing something evil like stripping lines that it (apparently incorrectly) thinks are comments to save space?  And if so, why????
>> 
>> How do I disable this?
>> 
>> Thanks,
>> 
>> -Philip
>> 
> 
> 
> And here’s the offending code:
> 
> (cd /home/philip/bertram/bmu-philip/openwrt/build_dir/target-x86_64_core2_musl-1.1.15_powercode-bmu/perl/CGI-4.35/ipkg-install/usr/lib/perl5/5.22 && rsync --relative -rlHp --itemize-changes --exclude=\*.pod --exclude=.packlist  --prune-empty-dirs CGI CGI.pm auto/CGI /home/philip/bertram/bmu-philip/openwrt/build_dir/target-x86_64_core2_musl-1.1.15_powercode-bmu/perl/CGI-4.35/ipkg-x86_64/perl-cgi/usr/lib/perl5/5.22)
>> f+++++++++ CGI.pm
> cd+++++++++ CGI/
>> f+++++++++ CGI/Carp.pm
>> f+++++++++ CGI/Cookie.pm
>> f+++++++++ CGI/Pretty.pm
>> f+++++++++ CGI/Push.pm
>> f+++++++++ CGI/Util.pm
> cd+++++++++ CGI/File/
>> f+++++++++ CGI/File/Temp.pm
> cd+++++++++ CGI/HTML/
>> f+++++++++ CGI/HTML/Functions.pm
> chmod -R u+w /home/philip/bertram/bmu-philip/openwrt/build_dir/target-x86_64_core2_musl-1.1.15_powercode-bmu/perl/CGI-4.35/ipkg-x86_64/perl-cgi/usr/lib/perl5/5.22
> ---> Stripping modules in: /home/philip/bertram/bmu-philip/openwrt/build_dir/target-x86_64_core2_musl-1.1.15_powercode-bmu/perl/CGI-4.35/ipkg-x86_64/perl-cgi/usr/lib/perl5/5.22
> find /home/philip/bertram/bmu-philip/openwrt/build_dir/target-x86_64_core2_musl-1.1.15_powercode-bmu/perl/CGI-4.35/ipkg-x86_64/perl-cgi/usr/lib/perl5/5.22 -name \*.pm -or -name \*.pl | xargs -r sed -i -e '/^=\(head\|pod\|item\|over\|back\|encoding\|begin\|end\|for\)/,/^=cut/d' -e '/^=\(head\|pod\|item\|over\|back\|encoding\|begin\|end\|for\)/,$d' -e '/^#$/d' -e '/^#[^!"'"'"']/d’
> 
> 
> those last 2 expressions being passed to sed…
> 
> If I have something like:
> 
> my $hdr = <<__EOF__ ;
> #!/bin/bash -x
> 
> __EOF__
> 
> then it’s going to totally do the wrong thing…  It thinks that’s a comment but it’s not, it’s a literal in a here-document…
> 

Okay, resolved….  I needed to change the Package/perl-cgi/install macro in the Makefile to invoke perlmod/Install/NoStrip instead of perlmod/Install.  Sigh.

Would it be reasonable to add a global variable which disables the stripping in perlmod/Install?

If you’re on a box with a decent amount of cycles and adequate flash, then I don’t really see the point of stripping comments from the Perl anyway…

-Philip




More information about the Lede-dev mailing list