`mktemp`: inconsistency between Windows and Unix
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
mktemp uses env::temp_dir to get the default temporary directory. The behaviour of this function is different between platforms, which is confusing for writing cross-platforms scripts (which is supposed to be a strength of uutils!).
Here's what's different:
- On Windows,
TMPDIRis ignored. - On Unix
TMP,TEMPandUSERPROFILEare ignored. - On Unix, if
TMPDIRis a relative path, a relative path is printed.
So we have a couple of options.
- Make Windows behave like Unix, which means copying the code from
std::env::temp_dirfrom Unix. This makes it consistent, but a bit weird on Windows, because we ignore standard environment variables. - Add a manual check for
TMPDIRto the Windows implementation. This helps consistency, but then Unix does not behave like Windows. - Add all variables to both Unix and Windows (at least
TMPDIR,TMP&TEMP). This is consistent between platforms, but not consistent with GNU.
Any opinions on this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating mktemp's use of env::temp_dir and the platform-specific temporary-directory implementations. Compare the Windows and Unix environment-variable behavior described in the issue, then review the discussion to identify an agreed direction. Done requires a decided cross-platform behavior and tests covering the relevant variables and relative paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100