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

Aperta
#2,998 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
12.4k
Fork
358
Merge medio
17h 12m
PR unite (30g)
31

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jetify-com/devbox

Tutte le issue di jetify-com/devbox

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.