Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 71799
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: jeff [...] math.tntech.edu
Cc:
AdminCc:

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



Subject: find_tempdir() still has problems under ms-windows
Download (untitled) / with headers
text/plain 1.4k
Older CGI.pm versions had the following code in the find_tempdir sub: if( $CGI::OS eq 'WINDOWS' ){ unshift @TEMP, $ENV{TEMP}, $ENV{TMP}, $ENV{WINDIR} . $SL . 'TEMP'; } This was problematic because it could put 'undef' values onto the @TEMP array. This is fixed in 3.55 (and before) via the following: # PeterH: These vars may not exist if this is invoked... unshift(@TEMP,$ENV{TEMP}) if defined $ENV{TEMP}; unshift(@TEMP,$ENV{TMP}) if defined $ENV{TMP}; unshift(@TEMP,$ENV{WINDIR} . $SL . 'TEMP') if defined $ENV{WINDIR}; HOWEVER, this new code puts entries onto @TEMP in the opposite order of the original code. The result is that C:\WINDOWS\TEMP will be preferred over the settings from the environment variables, which is *not* what most people will want. The order of the above three lines should be reversed: unshift(@TEMP,$ENV{WINDIR} . $SL . 'TEMP') if defined $ENV{WINDIR}; unshift(@TEMP,$ENV{TMP}) if defined $ENV{TMP}; unshift(@TEMP,$ENV{TEMP}) if defined $ENV{TEMP}; ----- An alternative fix would be to restore the old code and remove the other 'if defined' check that appears, and then change the line inside the loop: for (@TEMP) { do {$TMPDIRECTORY = $_; last} if -d $_ && -w _; } to do {$TMPDIRECTORY = $_; last} if defined($_) && -d $_ && -w _; Thanks! -Jeff PS: Yes, I am kind of ashamed of myself for using Perl with ms-win, but I have no choice, I tellya, they've got my kids and won't release them unless I cooperate !-)
Subject: Re: [rt.cpan.org #71799] find_tempdir() still has problems under ms-windows
Date: Thu, 27 Oct 2011 09:42:12 -0400
To: bug-cgi.pm [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Download (untitled) / with headers
text/plain 253b
Thanks for the report, Jeff. Either option proposed seems fine. If you want to make this really easy for me, you could fork on github and submit a pull request. But, the change is simple enough. Someone will take a look and merge it. Thanks again.
Download (untitled) / with headers
text/plain 240b
This issue has been copied to: https://github.com/leejo/CGI.pm/issues/91 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.
Download (untitled) / with headers
text/plain 552b
commit cb434b3b27897e2a486c930f144bba60216caa22 Author: Lee Johnson <lee@givengain.ch> Date: Fri Jul 11 15:56:35 2014 +0200 resolve #91 [rt.cpan.org #71799] - WIN TEMP dir order returned to that before e24d04e9bc5fda7722444b02fec135d8cc2ff488, which fixed issues with undefined values being unshifted onto the array. However the change from a single unshift statement to three calls mean the order was changed. restore the original order by reversing the order of the unshift calls Changes | 4 ++++ lib/CGI.pm | 4 ++--


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.