Skip Menu |
 

This queue is for tickets about the Perl-Dist-Strawberry CPAN distribution.

Report information
The Basics
Id: 79974
Status: resolved
Priority: 0/
Queue: Perl-Dist-Strawberry

People
Owner: Nobody in particular
Requestors: daniel.lindgren [...] tullverket.se
Cc:
AdminCc:

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



Subject: Problem with working directory on Win2k8 R2
Date: Wed, 3 Oct 2012 13:03:12 +0200
To: <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: "Lindgren Daniel" <daniel.lindgren [...] tullverket.se>
Download (untitled) / with headers
text/plain 695b
Hi all. I have a problem running system calls in certain folders in Windows Server 2008 R2. Example: C:\Windows\System32>perl -e "system(\"IF EXIST c:\\temp ECHO YES\");" YES C:\Windows\System32>cd dns C:\Windows\System32\dns>perl -e "system(\"IF EXIST c:\\temp ECHO YES\");" C:\Windows\System32\dns>IF EXIST c:\temp ECHO YES YES C:\Windows\System32\dns>cd .. C:\Windows\System32>perl -e "system(\"IF EXIST c:\\temp ECHO YES\");" YES As you can see, the same identical code produces different results depending on what working directory I'm in. I have reproduced the problem on Strawberry Perl 5.12.3.0, 5.14.2.1 and 5.16.2.1, all 32-bit Portable versions. Any ideas? Cheers, Daniel
Subject: Re: [rt.cpan.org #79974] Problem with working directory on Win2k8 R2
Date: Fri, 05 Oct 2012 02:22:26 +0200
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Download (untitled) / with headers
text/plain 244b
I cannot reproduce your issue on my Win7 box. Perhaps something specific to your Windows installation. Maybe try: perl -e "system('cmd.exe /C if exist c:\temp echo YES')" or perl -e "system(qw{cmd.exe /C if exist c:\temp echo YES})" -- kmx
Subject: SV: [rt.cpan.org #79974] Problem with working directory on Win2k8 R2
Date: Fri, 5 Oct 2012 07:41:07 +0200
To: <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: "Lindgren Daniel" <daniel.lindgren [...] tullverket.se>
Download (untitled) / with headers
text/plain 2.6k
Show quoted text
> I cannot reproduce your issue on my Win7 box. > > Perhaps something specific to your Windows installation.
OK, I have only seen the issue on 64-bit Windows and only if some subdirectories to C:\Windows\System32 is involved, e.g. C:\Windows\System32\dns. Not all subdirectories produce the issue, which makes it difficult to understand and possibly hard to reproduce in other environments. I have however reproduced the issue on several different machines, I know that it isn't specific to one single installation. I also modified the test a little, since the current working directory wasn't the only problem. Example from 64-bit Windows 7, where I've manually created the dns subdirectory: C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\") { print \"Exists\n\"; } Exists C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\dns\") { print \"Exists\n\"; } C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\drivers\") { print \"Exists\n\"; } Exists Just to verify that there's no access problem to the directory, check with DOS command: C:\>if exist c:\Windows\System32\dns ECHO YES YES Show quoted text
> Maybe try: > > perl -e "system('cmd.exe /C if exist c:\temp echo YES')" > or > perl -e "system(qw{cmd.exe /C if exist c:\temp echo YES})"
These are the results, note the difference in working directory: C:\Windows\System32\dns>perl -e "system('cmd.exe /C if exist c:\temp echo YES')" C:\Windows\System32\dns>perl -e "system(qw{cmd.exe /C if exist c:\temp echo YES})" C:\Windows\System32\dns>cd .. C:\Windows\System32>perl -e "system(qw{cmd.exe /C if exist c:\temp echo YES})" YES I've done some further testing since I discovered the issue and I've found that: - ActiveState Perl (32-bit) has the same issue. - The 64-bit version of Strawberry Perl is not affected. Example with 32-bit Strawberry Perl Portable: C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\") { print \"Exists\n\"; } Exists C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\dns\") { print \"Exists\n\"; } C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\database\") { print \"Exists\n\"; } Example with 64-bit Strawberry Perl Portable: C:\>c:\Bin\SBperl64\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\") { print \"Exists\n\"; } Exists C:\>c:\Bin\SBperl64\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\dns\") { print \"Exists\n\"; } Exists C:\>c:\Bin\SBperl64\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\database\") { print \"Exists\n\"; } Exists Cheers, Daniel
Subject: Re: SV: [rt.cpan.org #79974] Problem with working directory on Win2k8 R2
Date: Fri, 05 Oct 2012 13:47:06 +0200
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Download (untitled) / with headers
text/plain 771b
Show quoted text
> OK, I have only seen the issue on 64-bit Windows and only if some subdirectories to C:\Windows\System32 is involved...
Show quoted text
> I've done some further testing since I discovered the issue and I've found that: > > - ActiveState Perl (32-bit) has the same issue. > - The 64-bit version of Strawberry Perl is not affected.
In that case it might be a magic with c:\windows\system32 & c:\windows\syswow64 on 64bit MS Windows In short: 32bit process sees under c:\windows\system32 different things as 64bit process My theory: - you start 64bit cmd.exe which sees 64bit variant of c:\windows\system32 - then you launch 32bit perl.exe which sees different c:\windows\system32 - and obviously all that ends up badly Anyway, there is not much to be done on perl side. -- kmx
Subject: SV: SV: [rt.cpan.org #79974] Problem with working directory on Win2k8 R2
Date: Fri, 5 Oct 2012 13:53:06 +0200
To: <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: "Lindgren Daniel" <daniel.lindgren [...] tullverket.se>
Download (untitled) / with headers
text/plain 648b
Show quoted text
> My theory: > - you start 64bit cmd.exe which sees 64bit variant of > c:\windows\system32 > - then you launch 32bit perl.exe which sees different > c:\windows\system32 > - and obviously all that ends up badly
Tried it and you're right: C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\dns\") { print \"Exists\n\"; } C:\>mkdir c:\Windows\SysWOW64\dns C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\dns\") { print \"Exists\n\"; } Exists Show quoted text
> Anyway, there is not much to be done on perl side.
Yep, the solution is to use the native version of Strawberry Perl. Cheers, Daniel
Subject: SV: SV: [rt.cpan.org #79974] Problem with working directory on Win2k8 R2
Date: Fri, 5 Oct 2012 14:08:06 +0200
To: <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: "Lindgren Daniel" <daniel.lindgren [...] tullverket.se>
You can close the bug report, thanks for helping me identify the root cause. Cheers, Daniel


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.