Skip Menu |

This queue is for tickets about the Config-GitLike CPAN distribution.

Report information
The Basics
Id: 96670
Status: resolved
Priority: 0/
Queue: Config-GitLike

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

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



Subject: Home Dir Substitution Broken on Windows
Date: Mon, 23 Jun 2014 22:39:47 -0700
To: bug-config-gitlike [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
I see that there are always test failures on Windows right now: http://www.cpantesters.org/distro/C/Config-GitLike.html?oncpan=1&distmat=1&version=1.14 But working with 1.12, which is available on ActivePerl PPM, there is this bug, and it appears to also be present in the current repo: $filename =~ s/^~/$ENV{'HOME'}/g; That does not work on Windows for two reasons: 1. $ENV{HOME} is not set. $ENV{HOMEPATH} is, though. 2. ~ is used for DOS paths on Windows, not the home directory. So if I tell it the path is "C:\DOCUME~1\foo\bar", the above substitution changes it to "C:\DOCUME1\foo\bar", which of course is wrong. So in truth, I don't think you want to do that at all on Windows -- or on any other platform where "~" does not mean HOME. Best, David
Download signature.asc
application/pgp-signature 842b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #96670] Home Dir Substitution Broken on Windows
Date: Tue, 24 Jun 2014 10:50:37 -0400
To: bug-Config-GitLike [...] rt.cpan.org
From: Alex Vandiver <alex [...] chmrr.net>
On 06/24/2014 01:40 AM, David Wheeler via RT wrote: Show quoted text
> I see that there are always test failures on Windows right now: > > http://www.cpantesters.org/distro/C/Config-GitLike.html?oncpan=1&distmat=1&version=1.14
Hm -- I agree that 1.14 seems to be made of fail on Windows. But not for the reason you mention: Show quoted text
> But working with 1.12, which is available on ActivePerl PPM, there is this bug, and it appears to also be present in the current repo: > > $filename =~ s/^~/$ENV{'HOME'}/g; > > That does not work on Windows for two reasons: > > 1. $ENV{HOME} is not set. $ENV{HOMEPATH} is, though. > 2. ~ is used for DOS paths on Windows, not the home directory. > > So if I tell it the path is "C:\DOCUME~1\foo\bar", the above substitution changes it to "C:\DOCUME1\foo\bar", which of course is wrong.
The code in 1.12 did[1]: $filename =~ s/~/$ENV{'HOME'}/g; In 1.14, it changed[2] to: $filename =~ s/^~/$ENV{'HOME'}/g; ...precisely to deal with the Windows problems you mention. Contrary to your statement, "C:\DOCUME~1\foo\bar" does _not_ match the 1.14 regex, because the ~ is not the first character. The failures on Windows occur on line 199 of version 1.14, which is[3]: $filename = Cwd::abs_path( File::Spec->rel2abs($filename, $args{relative}) ) || $filename; The problem is thus actually with the abs_path calls[4], and I've pushed a fix[5] to work around it, and released 1.15. Thanks for the report! - Alex [1] https://github.com/bestpractical/config-gitlike/blob/1.12/lib/Config/GitLike.pm#L174 [2] https://github.com/bestpractical/config-gitlike/commit/1f8d7b84 [3] https://github.com/bestpractical/config-gitlike/blob/1.14/lib/Config/GitLike.pm#L199 [4] https://rt.perl.org/Public/Bug/Display.html?id=116332 [5] https://github.com/bestpractical/config-gitlike/commit/c9d95fbf