Skip to content

Repair foot.ini configs holding a literal \n[text-bindings] line - #6938

Merged
dhh merged 1 commit into
quattrofrom
fix-foot-text-bindings
Aug 15, 2026
Merged

dhh merged 1 commit into
quattrofrom
fix-foot-text-bindings

Conversation

@dhh

@dhh dhh commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

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:

err: config.c:3268: foot.ini:6: [key-bindings].\n[text-bindings]: syntax error: key/value pair has no value

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-config passes after the repair. The grep -qxF guard 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

Copilot AI balanced review requested due to automatic review settings August 15, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread migrations/1786782461.sh Outdated
Comment on lines +4 to +5
# 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot AI review requested due to automatic review settings August 15, 2026 14:12
@dhh
dhh force-pushed the fix-foot-text-bindings branch from 2f44181 to a4d87d8 Compare August 15, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 with bash -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 in test/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]>
Copilot AI review requested due to automatic review settings August 15, 2026 14:38
@dhh
dhh force-pushed the fix-foot-text-bindings branch from a4d87d8 to a9a30ab Compare August 15, 2026 14:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 under bash -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"

@dhh
dhh merged commit b5bb8da into quattro Aug 15, 2026
4 checks passed
@dhh
dhh deleted the fix-foot-text-bindings branch August 15, 2026 14:50
dhh added a commit that referenced this pull request Aug 23, 2026
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)
@dhh dhh mentioned this pull request Aug 23, 2026
nick1udwig pushed a commit to nick1udwig/omarchy that referenced this pull request Sep 9, 2026
…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]>
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Foot terminal shows syntax error in foot.ini on startup

3 participants