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

better handle the case of using busybox wget #2885

Merged
merged 1 commit into from
Nov 8, 2021

Conversation

crd477
Copy link
Contributor

@crd477 crd477 commented Oct 29, 2021

The command line options for the version of wget included with busybox are much different than those of standard version.

As a result, the rustup-init script generates a fair amount of noise on systems that use the busybox wget even though installation can still ultimately succeed on supported platforms, e.g., stable-x86_64-unknown-linux-musl on Alpine Linux x86_64.

This patch forces the most minimal invocation in the busybox wget case which eliminates the chatter sent to stderr otherwise.

Signed-off-by: Chad Dougherty [email protected]

@crd477
Copy link
Contributor Author

crd477 commented Oct 29, 2021

Example run without this patch:

alpine:~$ sh rustup.sh.old
info: downloading installer
wget: unrecognized option: V
BusyBox v1.33.1 () multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header 'HEADER: VALUE'] [-Y on/off]
        [-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -o LOGFILE      Log messages to FILE
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy
wget: unrecognized option: V
BusyBox v1.33.1 () multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header 'HEADER: VALUE'] [-Y on/off]
        [-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -o LOGFILE      Log messages to FILE
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy
Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure
BusyBox v1.33.1 () multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header 'HEADER: VALUE'] [-Y on/off]
        [-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -o LOGFILE      Log messages to FILE
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy
BusyBox v1.33.1 () multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header 'HEADER: VALUE'] [-Y on/off]
        [-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -o LOGFILE      Log messages to FILE
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy
Warning: Not enforcing TLS v1.2, this is potentially less secure
Connecting to static.rust-lang.org (52.85.135.59:443)
saving to '/tmp/tmp.EgphDm/rustup-init'
rustup-init          100% |********************************| 13.9M  0:00:00 ETA
'/tmp/tmp.EgphDm/rustup-init' saved

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /home/alpine/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory located at:

  /home/alpine/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /home/alpine/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile file located at:

  /home/alpine/.profile

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: x86_64-unknown-linux-musl
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-musl
info: syncing channel updates for 'stable-x86_64-unknown-linux-musl'
info: latest update on 2021-10-21, rust version 1.56.0 (09c42c458 2021-10-18)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 91.8 MiB /  91.8 MiB (100 %)  37.4 MiB/s in  3s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 17.3 MiB /  17.3 MiB (100 %)   2.6 MiB/s in  6s ETA:  0s
info: installing component 'rust-std'
 31.9 MiB /  31.9 MiB (100 %)   7.7 MiB/s in  4s ETA:  0s
info: installing component 'rustc'
 91.8 MiB /  91.8 MiB (100 %)   9.1 MiB/s in 10s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-musl'

  stable-x86_64-unknown-linux-musl installed - (error reading rustc version)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source $HOME/.cargo/env

Example run with this patch:

alpine:~$ sh rustup.sh
info: downloading installer
Warning: using the BusyBox version of wget.  Not enforcing strong cipher suites for TLS or TLS v1.2, this is potentially less secure
Connecting to static.rust-lang.org (52.85.135.59:80)
Connecting to static.rust-lang.org (52.85.135.97:443)
saving to '/tmp/tmp.lGkJlg/rustup-init'
rustup-init           23% |*******                         | 3423k  0:00:03 ETA
rustup-init          100% |********************************| 13.9M  0:00:00 ETA
'/tmp/tmp.lGkJlg/rustup-init' saved

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /home/alpine/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory located at:

  /home/alpine/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /home/alpine/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile file located at:

  /home/alpine/.profile

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: x86_64-unknown-linux-musl
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-musl
info: syncing channel updates for 'stable-x86_64-unknown-linux-musl'
info: latest update on 2021-10-21, rust version 1.56.0 (09c42c458 2021-10-18)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 91.8 MiB /  91.8 MiB (100 %)  38.8 MiB/s in  3s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 17.3 MiB /  17.3 MiB (100 %)   2.6 MiB/s in  6s ETA:  0s
info: installing component 'rust-std'
 31.9 MiB /  31.9 MiB (100 %)   6.9 MiB/s in  4s ETA:  0s
info: installing component 'rustc'
 91.8 MiB /  91.8 MiB (100 %)   9.7 MiB/s in  9s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-musl'

  stable-x86_64-unknown-linux-musl installed - (error reading rustc version)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source $HOME/.cargo/env

@crd477
Copy link
Contributor Author

crd477 commented Oct 29, 2021

It occurs to me that an alternative (and probably better) approach would be to simply silence all the cases where the busybox wget spews something to stderr. If this would be more desirable, let me know and I'll change this PR to do that.

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks plausible, thank you.

@kinnison kinnison merged commit 18b912a into rust-lang:master Nov 8, 2021
@crd477 crd477 deleted the busybox-wget branch July 11, 2022 23:40
AJ-Ianozi pushed a commit to AJ-Ianozi/getada-download that referenced this pull request Oct 12, 2023
better handle the case of using busybox wget
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.

2 participants