tools: make git_argv.sh argv validation locale independent - #28028
Open
xRookieFight wants to merge 1 commit into
Open
tools: make git_argv.sh argv validation locale independent#28028xRookieFight wants to merge 1 commit into
xRookieFight wants to merge 1 commit into
Conversation
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.
makefails to bootstrap on a machine with a Turkish locale:git is installed and on PATH. The real cause is the argv validation in
cmd/tools/git_argv.sh:Bracket ranges inside a regex are matched by collation order, not by code point, so
[A-Za-z]means whatever the current locale says lies between A and z. Undertr_TR.UTF-8that does not include the letters in the default valuegit:So
git_argv.sh checkreturns 2 with "the Git command contains unsupported characters", the GNUmakefile reads that as git being unavailable, and the build stops before it ever gets tovc/v.c. Anyone on a locale whose collation puts ASCII letters outside that range hits it, and the error message points in completely the wrong direction.Fix is to pin the locale for that one comparison with
local LC_ALL=C. It is scoped to the function, so nothing else in the script or in the callers changes locale, and the accepted character set stays exactly what it was.Testing
bash cmd/tools/git_argv.sh checkundertr_TR.UTF-8- fails on master, passes with this patchmakeundertr_TR.UTF-8- stops at the git check on master, builds fine with this patchGIT='git;rm -rf /' bash cmd/tools/git_argv.sh checkexits 2GIT='git -c core.autocrlf=false' bash cmd/tools/git_argv.sh checkpassesv test vlib/v/tests/gnu_make_tcc_fallback_test.v- passes