Skip Menu |

This queue is for tickets about the Alien-wxWidgets CPAN distribution.

Report information
The Basics
Id: 43832
Status: resolved
Priority: 0/
Queue: Alien-wxWidgets

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

Bug Information
Severity: Important
Broken in: 0.42
Fixed in: (no value)



Subject: _patch_command() not safe under paths with spaces
If the current directory is under a path with a space in it (such as on OS X leopard "/Users/$user/Library/Application Support/.cpan/build/..."), the system($string) form will fail unless the filename is escaped in a shell-safe way. print "Applying patch: ", $i, "\n"; my $cmd = $self->_patch_command( $old_dir, $i ); print $cmd, "\n"; system $cmd and die 'Error: ', $?; I would rather see that done as system(@command), but of course that requires input to be handled other than with '<'. Perhaps inc/bin/patch could take the patchfile as an argument? --Eric
Subject: Re: [rt.cpan.org #43832] _patch_command() not safe under paths with spaces
Date: Sat, 07 Mar 2009 22:27:17 +0100
To: bug-Alien-wxWidgets [...] rt.cpan.org
From: Mattia Barbon <mattia.barbon [...] libero.it>
Hi, Show quoted text
> If the current directory is under a path with a space in it (such as > on OS X leopard "/Users/$user/Library/Application > Support/.cpan/build/..."), the system($string) form will fail unless > the filename is escaped in a shell-safe way. > > print "Applying patch: ", $i, "\n"; > my $cmd = $self->_patch_command( $old_dir, $i ); > print $cmd, "\n"; > system $cmd and die 'Error: ', $?; > > I would rather see that done as system(@command), but of course that > requires input to be handled other than with '<'. Perhaps > inc/bin/patch could take the patchfile as an argument?
I'd rether not modify inc/bin/patch; since the build directory is always going to be ../Alien-wxWidgets-x.xx/wxWIdgwts-x.x.x, I think just changing my $old_dir = Cwd::cwd(); to my $old_dir = File::Spec->updir; in patch_wxwidgets, is going to work and make the code slightly simpler. Thanks! Mattia
Subject: Re: [rt.cpan.org #43832] _patch_command() not safe under paths with spaces
Date: Sun, 15 Mar 2009 10:08:50 +0100
To: bug-Alien-wxWidgets [...] rt.cpan.org
From: Mattia Barbon <mattia.barbon [...] libero.it>
Mattia Barbon via RT wrote: Show quoted text
> Queue: Alien-wxWidgets > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=43832 > > > Hi, >
>> If the current directory is under a path with a space in it (such as >> on OS X leopard "/Users/$user/Library/Application >> Support/.cpan/build/..."), the system($string) form will fail unless >> the filename is escaped in a shell-safe way. >> >> print "Applying patch: ", $i, "\n"; >> my $cmd = $self->_patch_command( $old_dir, $i ); >> print $cmd, "\n"; >> system $cmd and die 'Error: ', $?; >> >> I would rather see that done as system(@command), but of course that >> requires input to be handled other than with '<'. Perhaps >> inc/bin/patch could take the patchfile as an argument?
> > I'd rether not modify inc/bin/patch; since the build directory is > always going to be ../Alien-wxWidgets-x.xx/wxWIdgwts-x.x.x, I think > just changing > > my $old_dir = Cwd::cwd(); > > to > > my $old_dir = File::Spec->updir; > > in patch_wxwidgets, is going to work and make the code slightly simpler.
In the end I chose a slightly different approach. Works on OS X, untested under WIndows. Regards, Mattia
Fixed in release 0.43.