mktemp dot-dot file prefix is silently dropped

Open Beginner friendly
#12,312 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
cli

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.

Description

U - mktemp

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.

Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 4h
Merged PRs (30d)
371

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/coreutils

All issues in uutils/coreutils

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.