Feature #16975

Warn when value from environment is being ignored by `Dir.tmpdir`

Added by deivid (David Rodríguez) 7 months ago. Updated 7 months ago.

Target version:


Currently, if you set ENV["TMPDIR"] to a value that doesn't meet Dir.tmpdir criteria to become the temporary folder, the environment variable is silently ignored and the next variable in the chain is checked.

This makes issues quite hard to debug, because the temporary folder can get silently set to a value you don't expect.

An example of this is:

And I believe some failures I run into in were caused by the same issue.

Would it be useful to replace the following "silent rescue" to introduce a warning when it's hit?

I'm happy to create a PR if this is accepted.

Updated by nobu (Nobuyoshi Nakada) 7 months ago

I think it would be acceptable.
That "silent rescue" is actually for File.stat only, that is an obvious case.
I guess you may want to split the following conditions.

Updated by deivid (David Rodríguez) 7 months ago

nobu (Nobuyoshi Nakada) You are totally right, I misread the code. What we would need is indeed to split the following conditions.

Also available in: Atom PDF