Re: RFC: Fixing fallback tempdir location on Win32

[email protected] (David Golden)
Newsgroups perl.cpan.workers
Message-ID <CAOeq1c9xY9XVuaPf2SKk0VH9he2rTADZESq8yhgNVZnQs7vqvQ@mail.gmail.com>
On Thu, May 21, 2015 at 3:37 PM, Jan Dubois <[email protected]> wrote:

> I'm curious *why* tmpdir() would return the root directory. Normally
> %TMP% should be setup to point to the Temp directory inside the local
> APPDATA directory for regular users, or to %windir%/Temp when running
> as a service.
>
>
Under taint mode, all sources from %ENV are rejected, so we can't rely on
those. See this link for the filtering function:

https://metacpan.org/source/SMUELLER/PathTools-3.47/lib/File/Spec/Unix.pm#L176-205

The other "problem" is that the -w check always reports true, even if the
user doesn't have ACLs to create files/directories.  Longer-term,
File::Spec::Win32 could have its own _tmpdir method that checks to see if
Win32::API is installed (as I think it is with AS/Strawberry) and then use
some Win32 API function to check ACLs on proposed directories.

I just noticed the the GetTempPath() API will fall back to
> %USERPROFILE% if neither %TMP% nor %TEMP% are set. Maybe that variable
> should be checked as well, for consistency with other apps?
>
>
> https://msdn.microsoft.com/en-us/library/windows/desktop/aa364992%28v=vs.85%29.aspx
>

First, I'd want someone to check if it returns %USERPROFILE% exactly or
some path under it.

David

-- 
David Golden <[email protected]> Twitter/IRC: @xdg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.