Repository navigation
Repair foot.ini configs holding a literal \n[text-bindings] line - #6938
Conversation
There was a problem hiding this comment.
Pull request overview
Repairs malformed Foot configuration produced by an earlier migration.
Changes:
- Detects and removes the literal
\n[text-bindings]line. - Safely no-ops for healthy or missing configurations.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # one backslash too many, so GNU sed wrote the literal three-character line | ||
| # "\n[text-bindings]" instead of a blank line plus a header. foot rejects it with |
There was a problem hiding this comment.
Right, that was inaccurate — the line is sixteen characters; the two literal characters are the backslash and the n. Reworded:
one backslash too many, so GNU sed wrote a backslash and an "n" as two ordinary characters ahead of the section name, leaving the single line \n[text-bindings] where a blank line and a [text-bindings] header belong.
— 🤖 Claude, posting on behalf of @dhh
2f44181 to
a4d87d8
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
migrations/1786782461.sh:19
- Add an automated shell regression test that creates the exact literal
\n[text-bindings]line, runs this migration withbash -euo pipefail, and verifies the malformed line is removed while a healthy config remains byte-for-byte unchanged on repeated runs. Escaping is the core failure mode here, and the related terminal migration already has coverage intest/shell.d/terminal-keybinding-migration-test.sh, so manual verification alone leaves this repair vulnerable to the same kind of regression.
grep -qxF '\n[text-bindings]' "$foot_config" || exit 0
sed -i '/^\\n\[text-bindings\]$/d' "$foot_config"
A 3.8.3 migration appended the section header with one backslash too many, so sed wrote the literal characters instead of a newline plus the header. foot rejects the line and stops reading the rest of the file. The later text-binding migration matches the header with grep -qxF, misses the broken line, and appends a second section, leaving the config broken across the Quattro upgrade. Closes #6903 Co-Authored-By: Claude Opus 5 <[email protected]>
a4d87d8 to
a9a30ab
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
migrations/1786782461.sh:17
- This escape-sensitive repair has no automated regression coverage, even though comparable migrations are exercised under
test/shell.d/(for example,terminal-keybinding-migration-test.sh). Add a focused shell test that verifies removal of the literal\n[text-bindings]line, preservation of healthy configs, missing-file behavior, and idempotence underbash -euo pipefail; a one-backslash difference is what caused the original corruption.
if [[ -f $foot_config ]] && grep -qxF '\n[text-bindings]' "$foot_config"; then
sed -i '/^\\n\[text-bindings\]$/d' "$foot_config"
A 3.8.3 migration appended the section header with one backslash too many, so sed wrote the literal characters instead of a newline plus the header. foot rejects the line and stops reading the rest of the file. The later text-binding migration matches the header with grep -qxF, misses the broken line, and appends a second section, leaving the config broken across the Quattro upgrade. Closes #6903 Co-authored-by: Claude Opus 5 <[email protected]> (cherry picked from commit b5bb8da)
…com#6938) A 3.8.3 migration appended the section header with one backslash too many, so sed wrote the literal characters instead of a newline plus the header. foot rejects the line and stops reading the rest of the file. The later text-binding migration matches the header with grep -qxF, misses the broken line, and appends a second section, leaving the config broken across the Quattro upgrade. Closes omacom#6903 Co-authored-by: Claude Opus 5 <[email protected]>
A 3.8.3 migration appended the section header with
sed -i '$a\\\n[text-bindings]'— one backslash too many — so GNU sed wrote the literal characters\n[text-bindings]as a line rather than a newline plus the header. foot rejects it and stops reading the rest of the file:Quattro makes it worse rather than repairing it. The later text-binding migration looks for the header with
grep -qxF '[text-bindings]', which the literal line does not match, so it falls through and appends a second, correct section while leaving the broken line in place. Every affected user stays broken across the upgrade.This migration deletes the literal line. The duplicate section the other migration added is valid and harmless, so it is left alone.
Reproduced the original 3.8.3 breakage byte-for-byte, confirmed Quattro's migration adds the duplicate without fixing it, and confirmed
foot --check-configpasses after the repair. Thegrep -qxFguard makes it a no-op on healthy configs, and it is idempotent and inert when no foot.ini exists.Closes #6903
— 🤖 Claude, posting on behalf of @dhh