Skip to content

Commit 7b6d929

Browse files
committed
rustup-init.sh: Check for /proc early
Check for /proc being mounted as soon as we identify that we're running the installer on Linux. We need /proc for various reasons and it'd be better to error out cleanly than to report spurious messages and then error out later in a confusing way. This fixes #2654 Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
1 parent 3ac5076 commit 7b6d929

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rustup-init.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ main() {
140140
return "$_retval"
141141
}
142142

143+
check_proc() {
144+
# Check for /proc by looking for the /proc/self/exe link
145+
# This is only run on Linux
146+
if ! test -L /proc/self/exe ; then
147+
err "fatal: Unable to find /proc/self/exe. Is /proc mounted? Installation cannot proceed without /proc."
148+
fi
149+
}
150+
143151
get_bitness() {
144152
need_cmd head
145153
# Architecture detection without dependencies beyond coreutils.
@@ -237,6 +245,7 @@ get_architecture() {
237245
;;
238246

239247
Linux)
248+
check_proc
240249
_ostype=unknown-linux-$_clibtype
241250
_bitness=$(get_bitness)
242251
;;

0 commit comments

Comments
 (0)