Skip to content

mkdtemp doc issue? #26435

Closed
Closed
@vtjnash

Description

During test-writing / manual fuzzing, I noticed that the doc for mkdtemp added in #6800 states that "Generates six random characters to be appended behind a required prefix to create a unique temporary directory". This is true on Linux and Windows, but misses an edge case on BSDs (including Apple). As seen below, it actually "replaces trailing X's with random characters and then appends six additional random characters to the prefix to create a unique directory name".

// on macOS
> fs.mkdtempSync(path.join(os.tmpdir(), 'foox')) // does as documented
'/tmp/fooxz5Ve7r'

> fs.mkdtempSync(path.join(os.tmpdir(), 'fooX')) // also replaces the X from the prefix
'/tmp/foo1PqEasA'
         ^-- not an 'X'

I think this is just a doc issue, but opening this as an issue to hear what others think.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions