about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonas Böttiger <jonasboettiger@icloud.com>2024-11-07 13:08:28 +0100
committerGitHub <noreply@github.com>2024-11-07 13:08:28 +0100
commit7044cc7447d9e98422f33e58910d3c8a71fa0b35 (patch)
treef585de8927e77bfc84f98f008914599e51c8ba68
parent49a58c87231926a80e68607283ed79b45be95616 (diff)
parente0b98c739a0728d34c74b60cb84c14efa56d9cd2 (diff)
downloadrust-7044cc7447d9e98422f33e58910d3c8a71fa0b35.tar.gz
rust-7044cc7447d9e98422f33e58910d3c8a71fa0b35.zip
Rollup merge of #132694 - ismailarilik:fix/x/fix-a-regex-used-to-find-python-executable, r=jieyouxu
fix(x): fix a regex used to find python executable

Isn't the regex `^python[2-3]\.[0-9]\+$` wrong? It doesn't match, for example, with `python2.8`. There should be a plus sign at the end for a match, like `python2.8+`. I think `[0-9]+` is meant here instead of `[0-9]\+`. In that case a string like `python2.8` would match. This wasn't noticed because the script probably find and run the Python executable before this line.
-rwxr-xr-xx2
1 files changed, 1 insertions, 1 deletions
diff --git a/x b/x
index 426b58d0d4e..e656d37c1e4 100755
--- a/x
+++ b/x
@@ -36,7 +36,7 @@ for SEARCH_PYTHON in py python3 python python2; do
     fi
 done
 
-python=$(bash -c "compgen -c python" | grep '^python[2-3]\.[0-9]\+$' | head -n1)
+python=$(bash -c "compgen -c python" | grep '^python[2-3]\.[0-9]+$' | head -n1)
 if ! [ "$python" = "" ]; then
     exec "$python" "$xpy" "$@"
 fi