Repository navigation
fix(rumprun): keep argument boundaries in the guest config - #1174
Open
rahul05ranjan wants to merge 1 commit into
Open
rahul05ranjan wants to merge 1 commit into
rahul05ranjan wants to merge 1 commit into
Conversation
The rumprun configuration carried the application command as a single 'cmdline' string, which the guest splits on whitespace (config.c: makeargv/rumprun_parseargs). An argument that contains a space therefore reached the application as two arguments and an empty argument vanished, so 'redis-server --requirepass "a b"' failed with a bare 'a b' split into 'a' and 'b', and '--logfile ""' lost its value entirely. The rumprun configuration format has a second form for exactly this: 'rc' takes bin plus an argv array, and the guest copies every array element as its own string (config.c: addbin), with no whitespace processing. Emit the command in the rc form, keeping argv[0] as bin and the rest as the argv array. The JSON encoder keeps HTML escaping off, because the guest's jsmn parser keeps string bytes as written and does not decode \uXXXX escapes; the same helper shape as the open urunc-dev#1101, which this change does not depend on but will textually overlap - happy to rebase once one lands. Fixes urunc-dev#1158 Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com> Signed-off-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
✅ Deploy Preview for urunc canceled.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
urunc hands the container's arguments to a rumprun guest by joining all of
argvinto onecmdlinestring (strings.Join(data.CmdLine, " ")inRumprun.Init). The guest cannot get that back intact: rumprun's config parser splitscmdlineon whitespace (lib/librumprun_base/config.c:makeargv→rumprun_parseargs), so an argument that contains a space arrives as two arguments and an empty argument vanishes entirely.redis-server --requirepass 'a b'dies with>>> 'requirepass "a" "b"' / Bad directive or wrong number of arguments, and--logfile ''degrades into a bare--logfile, exactly as reported in #1158.The rumprun configuration format has a second form made for this:
rctakes abinand anargvarray, and the guest copies every array element as its own string with no whitespace processing (config.c:addbin→rre_argv[i] = token2cstr(...), verified in the rumprun sources;doc/config.mdspecifies both forms). This change emits the command as a one-entryrclist —argv[0]asbin, the rest as theargvarray — so argument boundaries survive:Two notes on the shape:
\uXXXXescapes, so&,<and>must stay raw. This overlaps the open fix(rumprun): do not escape &, < and > in guest config #1101 (itsmarshalNoEscape); this PR does not depend on it but will conflict textually — happy to rebase once one of the two lands.rc, the guest no longer setsRUMPRUN_EXEC_CMDLINE, which only affects multibaked multi-program images (it asks the guest to run every remaining baked program after the command;rcentries list exactly the programs to run). urunc runs one container process per guest, so the container images this affects behave identically.CmdLine(not reachable from an OCI spec, which requires at leastargv[0]) keeps the old emptycmdline, which is what lets the guest run its first baked program without arguments.Related issues
How was this tested?
strings.Join+whitespace-split result (HEAD:['redis-server', '--requirepass', 'a', 'b']and a dropped empty) and the rc-array result (FIX: byte-exact) for all three cases in the issue plus multiple empties.pkg/unikontainers/unikernels/rumprun_test.go(the package had no rumprun tests): four tests asserting the exact rc serialization, argument-boundary preservation (spaced and empty values round-trip through the JSON), no\u003c-style HTML escaping, the empty-cmdline fallback and thatInitkeepsCmdLineunjoined.config.caddbin/token2cstr/handle_cmdline,app-tools/rumprunwhich still emitscmdline— this change is urunc-side fidelity the host tool does not have).make lintand the unit suite are left to CI; the runtime check is the repro in Rumprun arguments with a space are split, empty ones are dropped #1158 (redis with--requirepass 'a b'over nerdctl).LLM usage
GLM (Z.ai, model glm-5.3, via OpenRouter) assisted in analyzing the issue, reading the rumprun parser sources and preparing this change; the diff and the claims above were reviewed against the upstream rumprun code before opening.
Checklist
make lint). — no Go toolchain on this machine; the change followsgofmtlayout.make test_ctr,make test_nerdctl,make test_docker,make test_crictl). — needs a rumprun/solo5 VMM and image, not available here; CI will run the suite once labeled.