fix(dist/linux): handle the possible unavailability of /proc
in rustup-init.sh
#3800
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2700. I'm no shell expert, just trying to do my best...
This fix is based on @miigotu and @kerberjg's find in #2700 (comment) and #2700 (comment) respectively. It first refers to
/proc/self/exe
if it's accessible, then$SHELL
if it's set, and finally/bin/sh
. This executable is then explicitly passed to functions that previously relied on/proc/self/exe
.Concerns
What about theFixed.grep '^Features' /proc/cpuinfo
line which also relies on/proc
?grep
fails (because e.g./proc/cpuinfo
is unavailable or malformed), we still assumearmv7
. This doesn't work in the case described inrustup-init.sh
fails to detect platform correctly underdocker buildx
which lacks/proc
#2700, where we're using ARMv6. OTOH, falling back toarm
is much safer in this case and will resolve the aforementioned issue.TheI've tested the patch with a modifiedpodman
instance I use seems to have/proc
access./proc
path (/fakeproc
) and the logic seems to work.