Skip to content

Some issues with mktemp coreutils command on Windows #2596

Done

Description

@fgimian

Description

I used the following Taskfile.yml:

version: "3"
tasks:
  example:
    cmd: mktemp -d

Upon running task example, I see the following on Windows 11:

🕙 [ 11:36:51 AM ] ❯ task example
task: [example] mktemp -d
task: Failed to run task "example": GetFileAttributesEx /tmp: The system cannot find the file specified.

Furthermore, when executing mktemp --help via the same task, I see:

Usage: mktemp [options] [template]
  -d    Make a directory (shorthand)
  -directory
        Make a directory
  -dry-run
        Do everything save the actual create
  -p string
        Tmp directory to use. If this is not set, TMPDIR is used, else /tmp (shorthand)
  -prefix string
        add a prefix
  -q    Quiet: show no errors (shorthand)
  -quiet
        Quiet: show no errors
  -s string
        add a prefix (shorthand, 's' is for compatibility with GNU mktemp
  -suffix string
        add a suffix to the prefix (rather than the end of the mktemp file)
  -tmpdir string
        Tmp directory to use. If this is not set, TMPDIR is used, else /tmp
  -u    Do everything save the actual create (shorthand)
task: Failed to run task "example": flag: help requested

I expected two differences:

  1. The appropriate temp directory on Windows should have been used by default (exposed via the $TEMP env var)
  2. The help should have shown -- before each option instead of a single - which doesn't work correctly

I worked around this as follows:

mktemp --tmpdir "$TEMP" -d

Version

3.46.3

Operating system

Windows 11 Pro

Experiments Enabled

No response

Example Taskfile

version: "3"
tasks:
  example:
    cmd: mktemp -d

Activity

  1. added
    state: needs triage
    on Dec 21, 2025
  2. added
    os: windows
    on Dec 21, 2025
  3. added theissue type on Dec 21, 2025
  4. removed
    state: needs triage
    on Dec 21, 2025
  5. added
    dep: charm/tutle
    and removed
    os: windows
    on Jan 7, 2026
  6. trulede commented on Jan 7, 2026

    @trulede
    Contributor

    Thanks @fgimian I think its an issue with the u-root library, so I opened an issue there.

  7. per1234 commented on Sep 22, 2026

    @per1234
    Contributor

    I opened an issue there.

    Here is the issue @trulede mentioned: u-root/u-root#3480. It seems clear that this is indeed a defect in u-boot, and the solution described is straightforward and trivial. Nonetheless, that report was closed by @binjip978 with the statement:

    not planned

    So it seems that this issue will not be resolved by the defect in the u-boot codebase being fixed.

  8. fgimian commented on Sep 23, 2026

    @fgimian
    Author

    I opened an issue there.

    Here is the issue @trulede mentioned: u-root/u-root#3480. It seems clear that this is indeed a defect in u-boot, and the solution described is straightforward and trivial. Nonetheless, that report was closed by @binjip978 with the statement:

    not planned

    So it seems that this issue will not be resolved by the defect in the u-boot codebase being fixed.

    Definitely a bit of a shame, especially as no reason was given. I do believe the way the flags are implemented is incorrect as it does not comply with POSIX standards.

    In saying all of this, the current implementation is functional, albeit not ideal.

    When I get a free moment, I may look at it myself and submit a PR in case that helps.

    Thanks so much for following this up!

    Cheers
    Fotis

  9. vmaerten commented on Nov 29, 2026

    @vmaerten
    Member

    It'll be fixed in the next release (by #3107)

  10. fgimian commented on Nov 29, 2026

    @fgimian
    Author

    It'll be fixed in the next release (by #3107)

    Thanks you so much!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    dep: charm/tutle

    Type

    Fields

    No fields configured for bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions