Re: [PATCH v2] git svn: info: correctly handle absolute path args

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 07, 2014 at 10:57:43AM +0200, Johannes Sixt wrote:
> Am 07.09.2014 10:06, schrieb Eric Wong:
> >  sub cmd_info {
> > -	my $path = canonicalize_path(defined($_[0]) ? $_[0] : ".");
> > -	my $fullpath = canonicalize_path($cmd_dir_prefix . $path);
> > +	my $path_arg = defined($_[0]) ? $_[0] : '.';
> > +	my $path = $path_arg;
> > +	if ($path =~ m!\A/!) {
> 
> There must be a more portable way to check for an absolute path. Think
> of DOS-style paths...

You probably want File::Spec->file_name_is_absolute($path).  Either that
or always turn the path into absolute or relative form with
File::Spec->abs2rel or File::Spec->rel2abs, and then go from there.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]