Skip to content

std::env::temp_dir should return env var XDG_RUNTIME_DIR under Linux if declared #39081

Closed
@sanmai-NL

Description

@sanmai-NL

Currently, Rust programs under Unix will use $TMPDIR as root temporary directory. This normally means /tmp/.

This is not optimally secure with most modern Linux distros. $TMPDIR is not guaranteed to be private.

Instead, I propose using the value of $XDG_RUNTIME_DIR first, since that is most likely set.

Meta

rustc --version --verbose:

rustc 1.16.0-nightly (1a2ed98d3 2017-01-13)
binary: rustc
commit-hash: 1a2ed98d344b6cbddc57db8841b42f935877e08d
commit-date: 2017-01-13
host: x86_64-unknown-linux-gnu
release: 1.16.0-nightly
LLVM version: 3.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions