Skip to content

Fix run_desktop.sh greedy sed regex eating other JSON keys#104

Merged
ThomasFarstrike merged 1 commit into
MicroPythonOS:mainfrom
bitcoin3us:fix/run-desktop-sed-regex
Mar 30, 2026
Merged

Fix run_desktop.sh greedy sed regex eating other JSON keys#104
ThomasFarstrike merged 1 commit into
MicroPythonOS:mainfrom
bitcoin3us:fix/run-desktop-sed-regex

Conversation

@bitcoin3us
Copy link
Copy Markdown
Contributor

Summary

  • run_desktop.sh uses sed to update auto_start_app in the JSON config file
  • The pattern "auto_start_app": ".*" uses greedy .* which matches to the last quote on the line, destroying any subsequent JSON keys (e.g. theme_light_dark, number_format)
  • Fix: change .* to [^"]* so it only matches within the value's quotes

Example

Before fix, running run_desktop.sh com.example.app on:

{"auto_start_app": "old.app", "theme_light_dark": "dark"}

produces:

{"auto_start_app": "com.example.app"}

(theme_light_dark is gone)

After fix, it correctly produces:

{"auto_start_app": "com.example.app", "theme_light_dark": "dark"}

Test plan

  • Set config with multiple keys including auto_start_app
  • Run run_desktop.sh <appname> and verify other keys are preserved

🤖 Generated with Claude Code

The sed pattern "auto_start_app": ".*" uses greedy matching,
which on a single-line JSON file matches from the first quote
after the key to the last quote on the line, destroying any
subsequent JSON keys (e.g. theme_light_dark).

Change .* to [^"]* so it only matches the value within quotes.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@ThomasFarstrike
Copy link
Copy Markdown
Contributor

You're sending pull requests faster than I can merge then! :-D

@ThomasFarstrike ThomasFarstrike merged commit e91e7f4 into MicroPythonOS:main Mar 30, 2026
4 checks passed
@bitcoin3us
Copy link
Copy Markdown
Contributor Author

Thank you Thomas. Excited for your next release candidate =D

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.

2 participants