RFC: Fixing fallback tempdir location on Win32

[email protected] (David Golden)
Newsgroups perl.cpan.workers
Message-ID <CAOeq1c9od25nH9TBpEW+n3SEV6tRj=bpaZ0zf2r5_BawgXwjAg@mail.gmail.com>
We have various unsolved tickets (see end for links) about
File::Temp/File::Spec failing on Windows due to taint, where
File::Spec->tmpdir returns the root directory, which many Windows users
can't actually write to.  (Context: File::Spec checks -w on candidate temp
dirs, but that can be true on Windows, yet the ACLs can prevent files from
being written there. See perlport on -X operators.)

After discussions on #toolchain, I have two proposals:

(1)  That File::Temp fall back to the following if it can't create a
temporary directory in the directory that is the result of
File::Spec->tmpdir:


File::Spec->catdir(Win32::GetFolderPath(Win32::CSIDL_LOCAL_APPDATA),q{Temp})

(2) That File::Spec::Win32 put that same path after environment variables
paths but before all existing fallback paths (
https://metacpan.org/source/SMUELLER/PathTools-3.47/lib/File/Spec/Win32.pm#L74-78
)

Doing #1 will allow users to upgrade File::Temp and fix the problem on
older perls without needing to upgrade PathTools.  Doing #2 will fix both
and can go into perl v5.23 and be released to CPAN after the corresponding
v5.23 release.

Thoughts?

David

File::Temp tickets
* https://rt.cpan.org/Ticket/Display.html?id=60340 (two tickets merged)

PathTools tickets
* https://rt.cpan.org/Ticket/Display.html?id=76663
* https://rt.cpan.org/Ticket/Display.html?id=96863

-- 
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.