Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustup-init.sh: Check for kernel UAPI compatibility on LoongArch
And provide friendly diagnostics if a certain widely-deployed but incompatible UAPI flavor (a.k.a. the "old-world" UAPI that's used by several early and/or commercial LoongArch Linux distributions) is detected. The minimalistic probe was crafted by myself, checking for one of the most prominent incompatibilities between the two UAPI flavors: `sizeof(sigset_t)`. The probe binary is small enough to fit in 3 lines of Base64, which is decoded into a temp file and executed for result. The `base64(1)` command is ubiquitous (being provided by coreutils, busybox and probably many others), and only necessary on LoongArch, so we effectively don't lose portability. Other irrelevant errors (e.g. /tmp being noexec) are made non-fatal, because without the check the installer binary will instantly die anyway on an incompatible system. A warning message is printed in case such an error occurs. (The installer binary, being dynamically linked, will die on a system using the other incompatible UAPI, with a confusing error saying the program being executed itself is not found: the actual non-existent path is the ELF interpreter i.e. `ld.so`. Having some error messages in case of this would hopefully reduce the technical support burden for many.)
- Loading branch information