Skip to content

fetchCargoVendor fails for duplicate versions of same crate #359340

Closed

Description

@dasJ

Describe the bug

Wanted to switch the rustdesk-flutter build to the new cargo fetcher. Doesn't work.

Traceback (most recent call last):
  File "/nix/store/wadx2h6yard87zgvddshm3mx2nimagwc-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 293, in <module>
    main()
  File "/nix/store/wadx2h6yard87zgvddshm3mx2nimagwc-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 289, in main
    subcommand_func()
  File "/nix/store/wadx2h6yard87zgvddshm3mx2nimagwc-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 281, in <lambda>
    "create-vendor": lambda: create_vendor(vendor_staging_dir=Path(sys.argv[2]), out_dir=Path(sys.argv[3]))
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/wadx2h6yard87zgvddshm3mx2nimagwc-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 238, in create_vendor
    copy_and_patch_git_crate_subtree(git_tree, pkg["name"], crate_out_dir)
  File "/nix/store/wadx2h6yard87zgvddshm3mx2nimagwc-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 179, in copy_and_patch_git_crate_subtree
    shutil.copytree(crate_tree, crate_out_dir)
  File "/nix/store/px2nj16i5gc3d4mnw5l1nclfdxhry61p-python3-3.12.7/lib/python3.12/shutil.py", line 600, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/px2nj16i5gc3d4mnw5l1nclfdxhry61p-python3-3.12.7/lib/python3.12/shutil.py", line 498, in _copytree
    os.makedirs(dst, exist_ok=dirs_exist_ok)
  File "<frozen os>", line 225, in makedirs
FileExistsError: [Errno 17] File exists: '/nix/store/0zn7mrd3dld2dmj2fxgpjb8skx45dx1w-cargo-deps-vendor/core-foundation-sys-0.8.6'

Steps To Reproduce

Steps to reproduce the behavior:

  1. cargoDeps = rustPlatform.fetchCargoVendor {
      inherit src; # hash fits for 1.3.3 but the problem happens on every release
      hash = "sha256-K9E2x01Y2WU0DewwKWXtnE92Jw2+uJOBUopHLvNs8Ew=";
    };
  2. nix-build

Expected behavior

It works

Screenshots

Pretty much the text from above but rendered in my terminal

Additional context

Don't know how the clownish developers were able to misuse their cargo so much but they somehow created a lock file with duplicate entries:

They don't seem to be aware of that and cargo seems to be fine with it.

Metadata

Notify maintainers

@TomaSajt @Bot-wxt1221


Note for maintainers: Please tag this issue in your PR.


Add a 👍 reaction to issues you find important.

Activity

  1. added
    0.kind: bug
    6.topic: rust
    on Nov 26, 2024
  2. TomaSajt commented on Nov 26, 2024

    @TomaSajt
    Contributor

    What's funny is that not even cargo vendor (the official vendor implementation) can handle this:

    error: failed to sync
    
    Caused by:
      found duplicate version of package `core-foundation-sys v0.8.6` vendored from two sources:
    
      	source 1: registry `crates-io`
      	source 2: https://github.com/madsmtm/core-foundation-rs.git?rev=7d593d016175755e492a92ef89edca68ac3bd5cd#7d593d01
    
  3. TomaSajt commented on Nov 26, 2024

    @TomaSajt
    Contributor

    Doing something like #282798 should be possible

  4. changed the title [-]fetchCargoVendor not working for rustdesk-flutter[/-] [+]fetchCargoVendor fails for duplicate versions of same crate[/+] on Mar 23, 2025
  5. TomaSajt commented on Mar 23, 2025

    @TomaSajt
    Contributor
  6. TomaSajt commented on Mar 23, 2025

    @TomaSajt
    Contributor
  7. dotlambda commented on Mar 23, 2025

    @dotlambda
    Member

    ... and https://github.com/deltachat/deltachat-desktop

    Could you share which dependency is duplicated?

    tauri-utils 2.2.0 (git+https://github.com/Simon-Laux/tauri?branch=add-is-always-on-top)
    tauri-utils 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)
    
  8. TomaSajt commented on Mar 23, 2025

    @TomaSajt
    Contributor

    Ah, I see. It's both an electron app and a tauri app, but it is currently packaged as an electron app. I'm assuming building the tauri app would be better, but you aren't able to due to the duplication.

  9. dotlambda commented on Mar 23, 2025

    @dotlambda
    Member

    I'm assuming building the tauri app would be better, but you aren't able to due to the duplication.

    It's not better yet because the electron version is more stable. But I wanted to package the tauri version as a second option. I will try again on top of your PR.

  10. TomaSajt commented on Mar 24, 2025

    @TomaSajt
    Contributor

    Also affects oxide-rs
    (currently has a patch)
    (the latest version no longer has duplication)

  11. elzorrorebelde commented on Jun 11, 2025

    @elzorrorebelde
    Member

    I get this error when the source code of a dependency is used twice, i.e.:

    sui-graphql-client = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "7d485ababecf7282dc7d772316ccdb07b9b24753" }
    sui-graphql-client-build = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "7d485ababecf7282dc7d772316ccdb07b9b24753" }
    
  12. added
    2.status: stale
    on Dec 10, 2025
  13. TomaSajt commented on Feb 21, 2026

    @TomaSajt
    Contributor

    Closed via #387337 (merged into staging)
    See https://nixpk.gs/pr-tracker.html?pr=387337 for progress towards reaching master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug2.status: stale6.topic: rust

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions