Repository navigation
devenv: Escape spaces when relocating pkg-config prefixes - #10589
Merged
kovidgoyal merged 1 commit intoOct 2, 2026
Merged
Conversation
relocate_pkgconfig() substitutes the real, absolute dependency path into the downloaded .pc files by plain byte replacement. pkg-config tokenizes Cflags/Libs on unescaped whitespace, so when that path contains a space (for example a checkout under "Desktop/My Projects/kitty") the emitted -I/-L flags get truncated at the first space and the build fails with errors like "hb.h file not found", even though the dependency is right there on disk. Escape spaces (and literal backslashes) in the new prefix before writing it into a .pc file so pkg-config round-trips it correctly. The same function also relocates paths inside _sysconfigdata_*.py, which is a plain Python string rather than something pkg-config parses, so that case is left unescaped. Likely the cause of #8939: the reporter's checkout was under "3. Ressources" and the -I flags in that log are truncated at the space.
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.
What
relocate_pkgconfig()writes the real, absolute dependency path intothe downloaded
.pcfiles with a plain byte substitution. pkg-configtokenizes
Cflags/Libson unescaped whitespace, so when the checkoutlives under a path containing a space (e.g.
~/Desktop/My Projects/kitty)the
-I/-Lflags it emits get truncated at the first space and thebuild fails, typically with:
even though harfbuzz's headers are right there on disk.
Fix
Backslash-escape spaces (and literal backslashes) in the new prefix
before substituting it into a
.pcfile, so pkg-config round-trips thepath correctly. The same function is also used to relocate the prefix
baked into
_sysconfigdata_*.py, which is a plain Python string literalrather than something pkg-config tokenizes, so that case is deliberately
left unescaped.
Testing
Added
bypy/devenv_test.go, which fails on master and passes with thischange: it asserts a space in the new prefix is escaped for
.pcfilesand left untouched for
_sysconfigdata_*.py.I also reproduced this end to end: with a checkout path containing a
space,
./dev.sh buildfailed with thehb.herror above on master,and succeeded after this change (all 89 C files compiled and linked).
The new regression test (
bypy/devenv_test.go) passes;gofmtandgo vetare clean.Likely the cause of #8939: the reporter's checkout was under
"3. Ressources" and the
-Iflags in that log are truncated at thespace.