Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support Alpine's BusyBox version of mktemp #374

@xurizaemon

Description

@xurizaemon

In https://github.com/lando/core/blob/6e2b0a5bbae626fe4ce57a501d8cd02cad9e4403/scripts/exec-multiliner.sh there's a mktemp usage. During service reboots and installs, I observed that some services output "mktemp: Invalid argument".

It appears that BusyBox's mktemp (as used by some Alpine docker images, as of BusyBox v1.36.1) is more particular about the template string supplied; when using BusyBox's mktemp -

  1. Placeholder Xs must be the final component of the template
  2. A template string must have a minimum of 6 placeholder Xs
  3. A maximum of six placeholder Xs will be substituted
# 1. Placeholder X must be the final characters.
78c07b93ca33:~$ mktemp /tmp/lando.XXXXXX.sh
mktemp: Invalid argument

# 2. Five X are invalid.
78c07b93ca33:~$ mktemp -t lando.XXXXX
mktemp: Invalid argument

# 2. Six X are valid.
78c07b93ca33:~$ mktemp -t lando.XXXXXX
/tmp/lando.aAeCPF

# 3. More than six characters are permitted, but only six are used.
78c07b93ca33:~$ mktemp /tmp/lando.XXXXXXXX
/tmp/lando.XXaPHOPO
78c07b93ca33:~$ mktemp /tmp/lando.XXXXXXXX
/tmp/lando.XXhCKdcm
  • mktemp version tested: BusyBox v1.36.1 (2024-06-10 07:11:47 UTC) multi-call binary.

This bug is probably harmless; the multiline execs seem to function okay, outputting an error from the first mktemp with template, then calling mktemp without parameters.

I will propose a small change that permits this to work as intended (with a modified template string), and eliminates the error output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions