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

Offen
#2,998 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
66/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
go
Bereich
cli

Rechercherichtung

Start at the implementation of devbox run and trace how arguments after -- are passed to the command; the report suggests they may be joined and parsed as a shell string. Look for existing tests covering devbox run argument forwarding and run them first. Done means newline and dollar sign arguments, including quoted values, arrive unchanged.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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 "$@").

Vorherrschende Sprache
Go
Sterne
12.4k
Forks
358
Ø Merge
17 Std. 12 Min.
Gemergte PRs (30 T.)
31

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus jetify-com/devbox

Alle Issues in jetify-com/devbox

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.