rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.63k stars 12.74k forks source link

`python3 x.py install` attempts to install some files multiple times and leaves ".old" files #115213

Closed xry111 closed 9 months ago

xry111 commented 1 year ago

In a fresh install of 1.72.0 there are some .old files:

/opt/rustc-1.72.0/share/doc/rustc-1.72.0/README.md.old
/opt/rustc-1.72.0/share/doc/rustc-1.72.0/LICENSE-MIT.old
/opt/rustc-1.72.0/share/doc/rustc-1.72.0/LICENSE-APACHE.old
/opt/rustc-1.72.0/bin/cargo-fmt.old
/opt/rustc-1.72.0/bin/cargo-clippy.old
/opt/rustc-1.72.0/bin/rustfmt.old
/opt/rustc-1.72.0/bin/clippy-driver.old
/etc/bash_completion.d/cargo.old

The same thing happens with 1.71.1.

onur-ozkan commented 1 year ago

Performed a test on 1.72.0 and was able to reproduce the problem. With HEAD: 959b2c703d45f06962da3afa086bdda70d42efcf, it is no longer present(most probably fixed on the cargo side since it doesn't have anything to do with bootstrapping).

If you encounter the problem again, please feel free to re-open the issue.

xry111 commented 1 year ago

I'm still hitting this with 1.73.0.

xry111 commented 1 year ago

Perhaps it's related to my config.toml setting. I'll do more experiments tomorrow and report back...

xry111 commented 1 year ago

Still happens with 1.74.0. The terminal output of python3 x.py install (I've removed the Compiling ... lines):

Building bootstrap
    Finished dev [unoptimized] target(s) in 0.18s
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.19s
Building compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.33s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 library artifacts (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.20s
Building compiler artifacts (stage1 -> stage2, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.30s
Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`)
Uplifting library (stage1 -> stage2)
Building stage0 tool rust-installer (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.65s
Dist rust-std-1.74.0-x86_64-unknown-linux-gnu
    finished in 1.630 seconds
Installing stage2 std (x86_64-unknown-linux-gnu)
install: creating uninstall script at /opt/rustc-1.74.0/lib/rustlib/uninstall.sh
install: installing component 'rust-std-x86_64-unknown-linux-gnu'

    rust std installed.

Uplifting rustc (stage1 -> stage3)
Building tool cargo (stage2 -> stage3, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 2m 58s
Dist cargo-1.74.0-x86_64-unknown-linux-gnu
    finished in 0.577 seconds
Installing stage2 cargo (x86_64-unknown-linux-gnu)
install: creating uninstall script at /opt/rustc-1.74.0/lib/rustlib/uninstall.sh
install: installing component 'cargo'
install: backing up existing file at /etc/bash_completion.d/cargo

    cargo installed.

Building tool rustfmt (stage2 -> stage3, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 43.10s
Building tool cargo-fmt (stage2 -> stage3, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.18s
Dist rustfmt-1.74.0-x86_64-unknown-linux-gnu
    finished in 0.258 seconds
Installing stage2 rustfmt (x86_64-unknown-linux-gnu)
install: creating uninstall script at /opt/rustc-1.74.0/lib/rustlib/uninstall.sh
install: installing component 'rustfmt-preview'
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/LICENSE-APACHE
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/LICENSE-MIT
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/README.md

    rustfmt installed.

Building tool clippy-driver (stage2 -> stage3, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 1m 06s
Building tool cargo-clippy (stage2 -> stage3, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.18s
Dist clippy-1.74.0-x86_64-unknown-linux-gnu
    finished in 0.317 seconds
Installing stage2 clippy (x86_64-unknown-linux-gnu)
install: creating uninstall script at /opt/rustc-1.74.0/lib/rustlib/uninstall.sh
install: installing component 'clippy-preview'
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/LICENSE-APACHE
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/LICENSE-MIT
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/README.md

    clippy installed.

Building tool rustdoc (stage1 -> stage2, x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.89s
Dist rustc-1.74.0-x86_64-unknown-linux-gnu
    finished in 2.611 seconds
Installing stage2 rustc (x86_64-unknown-linux-gnu)
install: creating uninstall script at /opt/rustc-1.74.0/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: backing up existing file at /opt/rustc-1.74.0/bin/cargo-clippy
install: backing up existing file at /opt/rustc-1.74.0/bin/cargo-fmt
install: backing up existing file at /opt/rustc-1.74.0/bin/clippy-driver
install: backing up existing file at /opt/rustc-1.74.0/bin/rustfmt
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/LICENSE-APACHE
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/LICENSE-MIT
install: backing up existing file at /opt/rustc-1.74.0/share/doc/rustc-1.74.0/README.md

    rustc installed.

Build completed successfully in 0:05:07
onur-ozkan commented 1 year ago

Would be nice if you can share your config.toml. Last time I tried I couldn't reproduce it.

xry111 commented 1 year ago

Would be nice if you can share your config.toml. Last time I tried I couldn't reproduce it.

# tell x.py to not keep printing an annoying warning
changelog-seen = 2

[llvm]
# by default, rust will build for a myriad of architectures
targets = "X86"

# When using system llvm prefer shared libraries
link-shared = true

[build]
# omit docs to save time and space (default is to build them)
docs = false

# install extended tools: cargo, clippy, etc
extended = true

# Do not query new versions of dependencies online.
locked-deps = true

# Specify which extended tools (those from the default install).
tools = ["cargo", "clippy", "rustdoc", "rustfmt"]

# Use the source code shipped in the tarball for the dependencies.
# The combination of this and the "locked-deps" entry avoids downloading
# many crates from Internet, and makes the Rustc build more stable.
vendor = true

cargo = "/opt/rustc-1.73.0/bin/cargo"
rustc = "/opt/rustc-1.73.0/bin/rustc"

[install]
prefix = "/opt/rustc-1.74.0"
docdir = "share/doc/rustc-1.74.0"

[rust]
channel = "stable"
description = "for BLFS r12.0-681"

# BLFS used to not install the FileCheck executable from llvm,
# so disabled codegen tests.  The assembly tests rely on FileCheck
# and cannot easily be disabled, so those will anyway fail if
# FileCheck has not been installed.
#codegen-tests = false

[target.x86_64-unknown-linux-gnu]
# NB the output of llvm-config (i.e. help options) may be
# dumped to the screen when config.toml is parsed.
llvm-config = "/usr/bin/llvm-config"

[target.i686-unknown-linux-gnu]
# NB the output of llvm-config (i.e. help options) may be
# dumped to the screen when config.toml is parsed.
llvm-config = "/usr/bin/llvm-config"
psumbera commented 9 months ago

I think I see the same with Rust 1.76:

ls -l rustc-1.76.0/bin/*.old
-rwxr-xr-x   1 psumbera staff    4254472 Feb 12 19:56 rustc-1.76.0/bin/cargo-fmt.old
-rwxr-xr-x   1 psumbera staff    13791032 Feb 12 19:56 rustc-1.76.0/bin/rustfmt.old
onur-ozkan commented 9 months ago

I think I see the same with Rust 1.76:

ls -l rustc-1.76.0/bin/*.old
-rwxr-xr-x   1 psumbera staff    4254472 Feb 12 19:56 rustc-1.76.0/bin/cargo-fmt.old
-rwxr-xr-x   1 psumbera staff    13791032 Feb 12 19:56 rustc-1.76.0/bin/rustfmt.old

Are you building multiple targets?

psumbera commented 9 months ago

Are you building multiple targets?

No. I just set following in config.toml: extended = true and tools = ["cargo", "rustfmt"].

onur-ozkan commented 9 months ago

121079 should handle this problem.