Skip Menu |
 

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 7885
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: rwjanes [...] primus.ca
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.25_03
Fixed in: 0.26

Attachments
Module-Build-Base.pm.patch



Subject: shell_split doesn't shell split
Download (untitled) / with headers
text/plain 434b
on HPUX the env LDOPTS setting has two words in it. that ends up being env LDOPTS="+s +b /usr/local/...." /usr/bin/ld ... shell_split splits on single whitespace, and this messes up xs builds. Specifically, Pod::Coverage doesn't fly. I haven't tried anything else, but I suspect any xs stuff using ld will die. anyways, I've submitted a patch takes care of it. shell_split does proper shell splitting after the patch is applied.
*** lib/Module/Build/Base.pm.orig 2004-10-05 16:00:50.000000000 -0400 --- lib/Module/Build/Base.pm 2004-10-05 16:45:06.000000000 -0400 *************** *** 2430,2437 **** return $self->shell_split($string); } ! sub shell_split { ! return split ' ', $_[1]; # XXX This is naive - needs a fix } sub stdout_to_file { --- 2430,2498 ---- return $self->shell_split($string); } ! #sub shell_split { ! #return split ' ', $_[1]; # XXX This is naive - needs a fix ! #} ! ! sub tbx_k_tokenize($) { ! my $line = shift; ! return () if !defined($line); ! ! my @words=(); ! ! while ($line =~ / \G (^|\s+) ( (?: ' # ' ## keep mmm happy (it doesn't seem to know about regexp)' ! (?: [^\\'] | \\. )* # ' ] ) ! ' # ') ! | ! " # " ! (?: [^\\"] | \\. )* # " ] ) ! " # ") ! | ! (?: [^"'\s\\] | \\ . )* # " ] ) ! )+ ) ! /gx ) { ! ! my ($punctuation, $token) = ($1, $2); ! push @words, $punctuation if $punctuation =~ /\S/; ! push @words, $token if $token ne ''; ! } ! ! return @words; ! } ! ! sub tbx_k_dequote($) { ! my $word = shift; ! return '' if !defined($word); ! ! my @pieces=(); ! ! while ($word =~ / \G ( ' # ' ## keep mmm happy (it doesn't seem to know about regexp)' ! (?: [^\\'] | \\. )* # ' ] ) ! ' # ') ! | ! " # " ! (?: [^\\"] | \\. )* # " ] ) ! " # ") ! | ! (?: [^"'\s\\] | \\ . )+ # " ] ) ! ) ! /gx ) { ! ! my $token = $1; ! ! $token = substr($token,0,1) eq substr($token,-1,1) ? substr($token,1,-1) : substr($token,1) ! if length($token)>1 && (substr($token,0,1) eq "'" || substr($token,0,1) eq '"'); ! $token =~ s/\\(.)/$1/g; ! ! push @pieces, $token if $token ne ''; ! } ! ! return join('', @pieces); ! } ! ! sub shell_split($$) { ! my @w = tbx_k_tokenize( $_[1] ); ! return map { tbx_k_dequote( $_ ) } @w; } sub stdout_to_file {
Download (untitled) / with headers
text/plain 396b
Thanks for reminding me about this issue. I decided to also look in the perl FAQ man pages, and eventually came upon the Text::ParseWords module, which has a shellwords() function. It does this same task. I think it would be better to use it (at least on Unixish platforms) than to include similar code in M::B. I don't suppose you have, or know of, a set of regression test cases? -Ken


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.