mktemp dot-dot file prefix is silently dropped
Open
Beginner friendly
Nobody has claimed this yet.
U - mktemp
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Using a template with a .. prefix creates a file without the dots:
./target/debug/coreutils mktemp /tmp/..XXXXXX
/tmp/X7ANMW
Expected behavior (matching GNU mktemp):
mktemp /tmp/..XXXXXX
/tmp/..X7ANMW
Path::file_name() returns None for paths ending in .. since it is a special path component, causing the prefix to fall back to an empty string, dropping the dots entirely.
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 at the mktemp implementation and trace how the template prefix is derived when Path::file_name() returns None for a .. component. Reproduce the issue with /tmp/..XXXXXX, then verify that the generated path preserves both dots and matches GNU mktemp behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100