Skip to content

devbox run -- cmd ARG: a newline in ARG becomes a literal \n, and a quoted $ is expanded #2998

Open

Description

@mrge-org

Devbox 0.18.4, Linux (Ubuntu 24.04).

devbox run -- cmd ARG... does not pass the arguments through unchanged. It looks like the arguments are joined into one shell string and parsed again.

1. A newline in an argument becomes a literal \n.

devbox run -q -- node -e 'console.log(JSON.stringify(process.argv.slice(1)))' -- $'a\nb' "c d"

Expected: ["a\nb","c d"] (a real newline in the first argument)
Actual: ["a\\nb","c d"] (a backslash and an n)

Spaces survive, newlines do not. So a multi-line node -e or bash -c script does not parse under devbox run.

2. A $ in an argument is expanded, also when the caller quoted it.

devbox run -q -- printf '%s\n' 'a$HOME'
# expected: a$HOME
# actual:   a/home/<user>

devbox run -q -- bash -c 'X=inner; echo "[$X]"'
# expected: [inner]
# actual:   []

Workaround: write the script to a file and pass its path.

Expected behaviour: the arguments after -- reach the command exactly as the caller's shell gave them (as with exec "$@").

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions