From d553ea7337913d187f5e21ed0f64c7c40ca395ae Mon Sep 17 00:00:00 2001 From: Cem Karan Date: Fri, 26 Aug 2022 10:32:38 -0400 Subject: [PATCH] fix: Temporary 'fix' for https://github.com/rust-lang/rust/issues/56650. The build system fails if there are spaces in the path leading to the rust repository. This is a quick fix that detects if there are any spaces in the path leading to the rust repository, and if there are, quits with a message warning the user about the problem. Signed-off-by: Cem Karan --- x.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/x.py b/x.py index 6df4033d55d72..c4560191c9b2e 100755 --- a/x.py +++ b/x.py @@ -6,6 +6,8 @@ import os import sys +import re +import logging # If this is python2, check if python3 is available and re-execute with that # interpreter. Only python3 allows downloading CI LLVM. @@ -22,7 +24,22 @@ pass rust_dir = os.path.dirname(os.path.abspath(__file__)) -sys.path.append(os.path.join(rust_dir, "src", "bootstrap")) -import bootstrap -bootstrap.main() +# Temporary 'fix' for https://github.com/rust-lang/rust/issues/56650. +# Various chunks of the build system can't correctly handle spaces in paths, and +# will break in unexpected ways if there are any. This tests to see if there +# are spaces in the path, quitting with an error if there are any +if re.search("\s", rust_dir): + logging.critical("There is a known bug in the build system " + "(https://github.com/rust-lang/rust/issues/56650) " + "that means that if there are spaces in your path then " + "the build system will fail. Your path ('%s') contains " + "at least one space in it. Either move your rust " + "repository to a path that has no spaces in it, or " + "change your path to remove all spaces. Now quitting.", + rust_dir) +else: + sys.path.append(os.path.join(rust_dir, "src", "bootstrap")) + + import bootstrap + bootstrap.main()