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

cargo install eza eza installs eza twice #12866

Closed
pysan3 opened this issue Oct 22, 2023 · 8 comments · Fixed by #12868
Closed

cargo install eza eza installs eza twice #12866

pysan3 opened this issue Oct 22, 2023 · 8 comments · Fixed by #12868
Labels
C-bug Category: bug Command-install E-easy Experience: Easy S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@pysan3
Copy link

pysan3 commented Oct 22, 2023

Problem

I am new to the community so please kindly forgive me if I'm doing something wrong.

I don't think I had this behavior til last month or so, but when I specify the same package name to cargo install multiple times, that package gets compiled multiple times as well.
This happens not only with eza but with all packages.

I would like cargo to only compile the package once since compiling multiple times shouldn't change anything but take time.

I've put the output of the command in # Notes.

Steps

  1. cargo uninstall eza (optional)
  2. cargo install eza eza
  3. You will see eza installed two times.

TLDR;

    Updating crates.io index
  Installing eza v0.15.0
   Compiling libc v0.2.149
   ...
    Finished release [optimized] target(s) in 1m 06s
  Installing /home/xxx/.local/share/cargo/bin/eza
   Installed package `eza v0.15.0` (executable `eza`)
  Installing eza v0.15.0
   Compiling libc v0.2.149
   ...
    Finished release [optimized] target(s) in 2m 15s
   Replacing /home/xxx/.local/share/cargo/bin/eza
    Replaced package `eza v0.15.0` with `eza v0.15.0` (executable `eza`)
     Summary Successfully installed eza, eza!

Possible Solution(s)

No response

Notes

Command Output

$ cargo install eza eza
    Updating crates.io index
  Installing eza v0.15.0
   Compiling libc v0.2.149
   Compiling proc-macro2 v1.0.69
   Compiling autocfg v1.1.0
   Compiling unicode-ident v1.0.12
   Compiling pkg-config v0.3.27
   Compiling num-traits v0.2.17
   Compiling vcpkg v0.2.15
   Compiling jobserver v0.1.27
   Compiling quote v1.0.33
   Compiling tinyvec_macros v0.1.1
   Compiling cc v1.0.83
   Compiling syn v2.0.38
   Compiling tinyvec v1.6.0
   Compiling thiserror v1.0.50
   Compiling rand_core v0.6.4
   Compiling siphasher v0.3.11
   Compiling unicode-normalization v0.1.22
   Compiling phf_shared v0.11.2
   Compiling rand v0.8.5
   Compiling libz-sys v1.1.12
   Compiling libgit2-sys v0.16.1+1.7.1
   Compiling percent-encoding v2.3.0
   Compiling unicode-bidi v0.3.13
   Compiling iana-time-zone v0.1.58
   Compiling bitflags v2.4.1
   Compiling rustix v0.38.20
   Compiling chrono v0.4.31
   Compiling idna v0.4.0
   Compiling form_urlencoded v1.2.0
   Compiling phf_generator v0.11.2
   Compiling log v0.4.20
   Compiling linux-raw-sys v0.4.10
   Compiling eza v0.15.0
   Compiling thiserror-impl v1.0.50
   Compiling phf_macros v0.11.2
   Compiling url v2.4.1
   Compiling datetime v0.5.2
   Compiling byteorder v1.5.0
   Compiling unicode-width v0.1.11
   Compiling partition-identity v0.3.0
   Compiling proc-mounts v0.3.0
   Compiling uutils_term_grid v0.3.0
   Compiling zoneinfo_compiled v0.5.1
   Compiling phf v0.11.2
   Compiling terminal_size v0.3.0
   Compiling uzers v0.11.3
   Compiling num_cpus v1.16.0
   Compiling locale v0.2.2
   Compiling number_prefix v0.4.0
   Compiling scoped_threadpool v0.1.9
   Compiling ansiterm v0.12.2
   Compiling glob v0.3.1
   Compiling lazy_static v1.4.0
   Compiling natord v1.0.9
   Compiling timeago v0.4.2
   Compiling git2 v0.18.1
    Finished release [optimized] target(s) in 1m 06s
  Installing /home/xxx/.local/share/cargo/bin/eza
   Installed package `eza v0.15.0` (executable `eza`)
  Installing eza v0.15.0
   Compiling libc v0.2.149
   Compiling proc-macro2 v1.0.69
   Compiling unicode-ident v1.0.12
   Compiling autocfg v1.1.0
   Compiling pkg-config v0.3.27
   Compiling num-traits v0.2.17
   Compiling quote v1.0.33
   Compiling jobserver v0.1.27
   Compiling syn v2.0.38
   Compiling vcpkg v0.2.15
   Compiling cc v1.0.83
   Compiling tinyvec_macros v0.1.1
   Compiling tinyvec v1.6.0
   Compiling siphasher v0.3.11
   Compiling rand_core v0.6.4
   Compiling thiserror v1.0.50
   Compiling rand v0.8.5
   Compiling phf_shared v0.11.2
   Compiling libz-sys v1.1.12
   Compiling libgit2-sys v0.16.1+1.7.1
   Compiling unicode-normalization v0.1.22
   Compiling percent-encoding v2.3.0
   Compiling unicode-bidi v0.3.13
   Compiling iana-time-zone v0.1.58
   Compiling bitflags v2.4.1
   Compiling rustix v0.38.20
   Compiling chrono v0.4.31
   Compiling idna v0.4.0
   Compiling form_urlencoded v1.2.0
   Compiling phf_generator v0.11.2
   Compiling log v0.4.20
   Compiling linux-raw-sys v0.4.10
   Compiling thiserror-impl v1.0.50
   Compiling phf_macros v0.11.2
   Compiling eza v0.15.0
   Compiling url v2.4.1
   Compiling datetime v0.5.2
   Compiling partition-identity v0.3.0
   Compiling unicode-width v0.1.11
   Compiling byteorder v1.5.0
   Compiling uutils_term_grid v0.3.0
   Compiling zoneinfo_compiled v0.5.1
   Compiling proc-mounts v0.3.0
   Compiling terminal_size v0.3.0
   Compiling phf v0.11.2
   Compiling uzers v0.11.3
   Compiling locale v0.2.2
   Compiling num_cpus v1.16.0
   Compiling scoped_threadpool v0.1.9
   Compiling lazy_static v1.4.0
   Compiling number_prefix v0.4.0
   Compiling timeago v0.4.2
   Compiling glob v0.3.1
   Compiling natord v1.0.9
   Compiling ansiterm v0.12.2
   Compiling git2 v0.18.1
    Finished release [optimized] target(s) in 2m 15s
   Replacing /home/xxx/.local/share/cargo/bin/eza
    Replaced package `eza v0.15.0` with `eza v0.15.0` (executable `eza`)
     Summary Successfully installed eza, eza!

Version

cargo 1.73.0 (9c4383fb5 2023-08-26)
release: 1.73.0
commit-hash: 9c4383fb55986096b414d98125421ab87b5fd642
commit-date: 2023-08-26
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.2.1-DEV (sys:0.4.65+curl-8.2.1 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Manjaro 23.0.4 (Uranos) [64-bit]
@pysan3 pysan3 added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Oct 22, 2023
@weihanglo
Copy link
Member

Thanks for the report.

This might be something we can fix. install function is the entrance of the install operation, and krates argument is what user provides by cargo install <krates>. We can de-duplicate the list to avoid unnecessary installations.

It may be a breaking change if people already depends on the behavior. For instance, in build.rs people can detect if the binary exists and diverge the build logic. That said, I don't really think this kind of behavior is recommended and seems like an abuse of build.rs.

@weihanglo weihanglo added Command-install E-easy Experience: Easy S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review and removed S-triage Status: This issue is waiting on initial triage. labels Oct 22, 2023
@epage
Copy link
Contributor

epage commented Oct 23, 2023

@pysan3 could you expand on the use case for why you are doing this? Is this more to highlight the lack of build caching (which would be improved with #5931)? Is it always about cargo install foo foo or is that also to represent the case of cargo install foo && cargo install foo?

@epage epage added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review labels Oct 23, 2023
@pysan3
Copy link
Author

pysan3 commented Oct 23, 2023

Hi @epage, thanks for the update.

I only need a fix for cargo install foo foo which happens by a small shell script parsing a file that contains I guess duplicated lines.

I was not thinking of compile caching or some complicated stuffs but simply thought it was more intuitive to skip duplicated arguments.

For instance, in build.rs people can detect if the binary exists and diverge the build logic.

However as @weihanglo suggested above, IMO cargo install foo && cargo install foo should be treated differently (and compile it twice maybe?) than my case.

@epage
Copy link
Contributor

epage commented Oct 23, 2023

I only need a fix for cargo install foo foo which happens by a small shell script parsing a file that contains I guess duplicated lines.

Could you expand on why you are passing the package multiple times to cargo install?

@pysan3
Copy link
Author

pysan3 commented Oct 23, 2023

It's a very personal thing but I'm parsing this file where I define aliases to rust cli tools.

https://github.com/pysan3/dotfiles/blob/main/static/list_rust_packages.txt

As you can see, there are multiple lines that point to the same package but to a different alias which causes the duplication.

I know my specific case can be solved with uniq or something else but I wanted to bring up this issue because I thought this behavior was not intuitive and was happening unintentionally.

@epage
Copy link
Contributor

epage commented Oct 23, 2023

Whether we act on this issue or not, I would recommend addressing it within your workflow.

@epage epage closed this as completed Oct 23, 2023
@epage epage reopened this Oct 23, 2023
@epage
Copy link
Contributor

epage commented Oct 23, 2023

Oops, somehow hit close

@pysan3
Copy link
Author

pysan3 commented Oct 26, 2023

Whether we act on this issue or not, I would recommend addressing it within your workflow.

Thanks, actually have done already.

Anyways, hope #12868 goes well ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-install E-easy Experience: Easy S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants