fix(converter): bound comma splitting for env and exec bind args - #8
Merged
Conversation
added 2 commits
July 31, 2026 14:47
Hyprland parses these directives with a bounded CVarList, not a split on
every comma: `env` uses CVarList(value, 2) and the bind family
CVarList(value, 4) (5 when a `bindd` description is present). Everything
after the last bound separator is one field, commas included.
The converter split unconditionally, which produced two bugs:
- `env = LIST,a,b,c` was rejected as malformed and emitted a TODO,
though it legally sets LIST to "a,b,c".
- an exec bind's command was re-joined with ", ", silently rewriting
`sh -c "echo a,b,c"` to `sh -c "echo a, b, c"` — a different shell
command, with no flag raised.
Adds splitCommasN(s, n) and routes both paths through it. emitBind now
also keeps the unsplit remainder after the dispatcher and hands it to
buildDispatcherRaw, which exec/execr use verbatim; every other dispatcher
keeps the split form, so buildDispatcher stays a thin wrapper and no
other call site changes. env still flags a value with no comma at all or
an empty name, matching Hyprland's own "invalid env syntax".
The per-directive detail started at line 100, below the four install sections, so anything skimming the first screen saw packaging and no capabilities. Hoists a compact matrix — bind family, submaps, nested sections, rules, variables, exec/env, dispatchers, comments, and the --check behaviour — directly under the intro, and surfaces the zero-install browser converter alongside it. The detailed Phase 1 / Phase 2 lists stay where they are.
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.
Summary
envvalues containing commas were rejected. Hyprland reads env withCVarList(value, 2)— everything after the first comma is the value — soenv = LIST,a,b,clegally setsLISTto"a,b,c". The converter split on every comma and emitted-- TODO: manual review — malformed envinstead. Same forenvd.execbind commands were silently rewritten.emitBindsplit the value on every comma and re-joined the dispatcher args with", ", turningsh -c "echo a,b,c"intosh -c "echo a, b, c"— a different shell command, with nothing flagged. Hyprland usesCVarList(value, 4)here (5 with abindddescription), so the command keeps its commas and its original spacing.splitCommasN(s, n).emitBindkeeps the unsplit remainder after the dispatcher and passes it tobuildDispatcherRaw, whichexec/execrread verbatim; every other dispatcher keeps the split form, sobuildDispatcheris now a thin wrapper and no other call site or test changed.What it handlestable under the intro — the per-directive detail previously started below four install sections.Escaped commas (
env = FOO,a\,b) and semicolons keep working.envstill flags a value with no comma at all or an empty name, matching Hyprland's owninvalid env syntax.Test plan
go vet ./...go test ./...go test -race ./...go test ./internal/converter -fuzz FuzzConvert -fuzztime 15sgo build ./cmd/hyprlang2luatestdata/04_edge_cases.conf: unescaped commas inexec,bindd+ commas, the threeenv/envdcomma forms, and the no-comma flag case. Both.luaand.merged.luagoldens regenerated; theluac -psyntax gate passes.hyprctl dispatchbind rewriting still collapses to directhl.dsp.*calls.🤖 Generated with Claude Code