Skip to content

Commit 0c4da75

Browse files
Reassert /bin/sh validity
Reverts the shebang change in 6b4283f and adds a shellcheck directive to suppress warnings about POSIX validity and prevent further drift. The POSIX standard is not, despite its name, a reliable guide to what features are actually standard, even for POSIX shells. rustup-init.sh uses `local`, a non-POSIX extension supported by all POSIX shells known in common use. Thus, it is fine to run it with #!/bin/sh instead. The Debian Almquist shell is not the only POSIX shell but it is very common, so is a useful proxy for whether the script actually runs for non-bash shells.
1 parent 201e71f commit 0c4da75

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rustup-init.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
#!/bin/bash
1+
#!/bin/sh
2+
# shellcheck shell=dash
23

34
# This is just a little script that can be downloaded from the internet to
45
# install rustup. It just does platform detection, downloads the installer
56
# and runs it.
67

8+
# It runs on Unix shells like {a,ba,da,k,z}sh. It uses the common `local`
9+
# extension. Note: Most shells limit `local` to 1 var per line, contra bash.
10+
711
set -u
812

913
# If RUSTUP_UPDATE_ROOT is unset or empty, default it.

0 commit comments

Comments
 (0)