Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dist/linux): handle the possible unavailability of /proc in rustup-init.sh #3800

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

rami3l
Copy link
Member

@rami3l rami3l commented May 1, 2024

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.

有備無患 yǒu bèi wú huàn

  • to be prepared against adverse events

Concerns

  • What about the grep '^Features' /proc/cpuinfo line which also relies on /proc? Fixed.
  • How to test this patch?
    • The podman instance I use seems to have /proc access. I've tested the patch with a modified /proc path (/fakeproc) and the logic seems to work.

@rami3l rami3l added this to the 1.28.0 milestone May 1, 2024
@rami3l rami3l force-pushed the fix/shell-proc-self branch from 7ee4c2a to 3043a95 Compare May 1, 2024 06:31
@rami3l rami3l changed the title fix(dist): add fallbacks to /proc/self/exe in rustup-init.sh fix(dist): handle the possible unavailability of /proc in rustup-init.sh May 1, 2024
@rami3l rami3l changed the title fix(dist): handle the possible unavailability of /proc in rustup-init.sh fix(dist/linux): handle the possible unavailability of /proc in rustup-init.sh May 1, 2024
@rami3l rami3l requested a review from djc May 1, 2024 07:19
@rami3l rami3l marked this pull request as ready for review May 1, 2024 07:19
@rami3l rami3l requested a review from rbtcollins May 7, 2024 07:15
rustup-init.sh Outdated Show resolved Hide resolved
@rbtcollins
Copy link
Contributor

I think this looks reasonable.

There are other probes we could use, such as uname and lsb_release and gcc but they all have edge cases and caveats. One question for you then GTG IMO.

rustup-init.sh Outdated Show resolved Hide resolved
@rami3l rami3l force-pushed the fix/shell-proc-self branch from 3043a95 to 85b760e Compare June 10, 2024 12:39
@rami3l rami3l requested a review from rbtcollins June 10, 2024 12:40
@rami3l rami3l removed this from the 1.28.0 milestone Jun 16, 2024
@rami3l rami3l added this pull request to the merge queue Jun 18, 2024
Merged via the queue into master with commit 02b148f Jun 18, 2024
26 checks passed
@rami3l rami3l deleted the fix/shell-proc-self branch June 18, 2024 04:34
@rami3l rami3l mentioned this pull request Oct 6, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustup-init.sh fails to detect platform correctly under docker buildx which lacks /proc
2 participants