dependabot / dependabot/dependabot-core

[cargo] error when Dependabot attempts to update wildcard dependency

Open
#7,568 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T: bug 🐞
Dominant language
Ruby
Stars
5.8k
Forks
1.5k
Avg merge
2d 18h
Merged PRs (30d)
149

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Package ecosystem

cargo

### Package manager version

1.73.0-nightly

### Language version

1.73.0-nightly

### Manifest location and content before the Dependabot update

- [Cargo.toml](https://github.com/pitaj/rust/blob/a99aad177cd9c6437ff7a8ca761a2989de72d23a/Cargo.toml)
- [Cargo.lock](https://github.com/pitaj/rust/blob/a99aad177cd9c6437ff7a8ca761a2989de72d23a/Cargo.lock)

### dependabot.yml content

https://github.com/pitaj/rust/blob/a99aad177cd9c6437ff7a8ca761a2989de72d23a/.github/dependabot.yml

### Updated dependency

_No response_

### What you expected to see, versus what you actually saw

Expected Dependabot run to complete without error.

Instead, it failed, resulting in the following error:
> Dependabot encountered an unknown error
>
> Dependabot failed to update your dependencies because an unexpected error occurred. See the logs for more details.

I looked through the logs and found only a single error:
```
updater | 2023/07/15 22:42:06 ERROR Error processing serde (Dependabot::SharedHelpers::HelperSubprocessFailed)
updater | 2023/07/15 22:42:06 ERROR info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
updater | info: latest update on 2023-07-15, rust version 1.73.0-nightly (ad963232d 2023-07-14)
updater | info: downloading component 'cargo'
updater | info: downloading component 'rust-std'
updater | info: downloading component 'rustc'
updater | info: installing component 'cargo'
updater | info: installing component 'rust-std'
updater | info: installing component 'rustc'
updater | error: failed to load manifest for workspace member `/home/dependabot/dependabot-updater/dependabot_tmp_dir/src/tools/miri/cargo-miri`
updater |
updater | Caused by:
updater | failed to parse manifest at `/home/dependabot/dependabot-updater/dependabot_tmp_dir/src/tools/miri/cargo-miri/Cargo.toml`
updater |
updater | Caused by:
updater | failed to parse the version requirement `*, <= 1.0.171` for dependency `serde`
updater |
updater | Caused by:
updater | wildcard req (*) must be the only comparator in the version req
```

That error points to the serde dependency in [`src/tools/miri/cargo-miri/Cargo.toml`](https://github.com/pitaj/rust/blob/d29220802b349f90c0b72ac3e9b34e0704f32747/src/tools/miri/cargo-miri/Cargo.toml), but that specifies version `*`, not the `*, <= 1.0.171` requirement that appears in the error:
```
serde = { version = "*", features = ["derive"] }
```

If I were to guess, it looks like the wildcard is being joined with the latest `serde` version available at the time, `v1.0.171`.

A pull request was still opened with updates for all of the other dependencies.

### Native package manager behavior

`cargo update` succeeds without error:
```
$ cargo update
Updating crates.io index
Updating allocator-api2 v0.2.15 -> v0.2.16
Updating anyhow v1.0.71 -> v1.0.72
Updating bstr v1.5.0 -> v1.6.0
Updating camino v1.1.4 -> v1.1.6
Updating cargo-platform v0.1.2 -> v0.1.3
Updating clap v4.3.10 -> v4.3.12
Updating clap_builder v4.3.10 -> v4.3.12
Updating clap_complete v4.3.1 -> v4.3.2
Updating clap_derive v4.3.2 -> v4.3.12
Updating colored v2.0.0 -> v2.0.4
Updating cpufeatures v0.2.8 -> v0.2.9
Updating cstr v0.2.8 -> v0.2.11
Updating dissimilar v1.0.6 -> v1.0.7
Updating equivalent v1.0.0 -> v1.0.1
Updating globset v0.4.10 -> v0.4.11
Updating h2 v0.3.19 -> v0.3.20
Updating hyper v0.14.22 -> v0.14.27
Updating ipnet v2.7.2 -> v2.8.0
Updating is-terminal v0.4.8 -> v0.4.9
Updating itoa v1.0.6 -> v1.0.9
Updating proc-macro2 v1.0.63 -> v1.0.66
Updating quote v1.0.29 -> v1.0.31
Updating regex v1.8.4 -> v1.9.1
Adding regex-automata v0.3.3
Adding regex-lite v0.1.0
Updating regex-syntax v0.7.2 -> v0.7.4
Removing rustix v0.37.22
Removing rustix v0.38.2
Adding rustix v0.37.23
Adding rustix v0.38.4
Updating rustversion v1.0.12 -> v1.0.14
Updating ryu v1.0.13 -> v1.0.15
Updating schannel v0.1.21 -> v0.1.22
Updating semver v1.0.17 -> v1.0.18
Updating smallvec v1.10.0 -> v1.11.0
Updating sysinfo v0.29.2 -> v0.29.5
Updating tar v0.4.38 -> v0.4.39
Updating tokio-util v0.7.2 -> v0.7.8
Updating toml v0.7.5 -> v0.7.6
Updating toml_edit v0.19.11 -> v0.19.14
Updating tracing-tree v0.2.3 -> v0.2.4
Updating ucd-parse v0.1.10 -> v0.1.12
Updating ucd-trie v0.1.5 -> v0.1.6
Updating unicode-ident v1.0.9 -> v1.0.11
Updating wasm-bindgen-futures v0.4.34 -> v0.4.37
Updating web-sys v0.3.61 -> v0.3.64
Updating winnow v0.4.7 -> v0.5.0
```

### Images of the diff or a link to the PR, issue, or logs

[dependabot.log](https://github.com/dependabot/dependabot-core/files/12065308/dependabot.log)

### Smallest manifest that reproduces the issue

I was able to reproduce this error at the following repository: https://github.com/pitaj/dependabot-cargo-wildcard

Which uses this `Cargo.toml`:
```
[package]
name = "dependabot-cargo-wildcard"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "*", features = ["derive"] }
```

And has serde 1.0.164 in `Cargo.lock`:
```
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "dependabot-cargo-wildcard"
version = "0.1.0"
dependencies = [
"serde",
]

[[package]]
name = "proc-macro2"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [
"unicode-ident",
]

[[package]]
name = "quote"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0"
dependencies = [
"proc-macro2",
]

[[package]]
name = "serde"
version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
dependencies = [
"serde_derive",
]

[[package]]
name = "serde_derive"
version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

[[package]]
name = "syn"
version = "2.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]

[[package]]
name = "unicode-ident"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the smallest reproduction repository and its Cargo.toml and Cargo.lock, then compare its behavior with the failing dependency in src/tools/miri/cargo-miri/Cargo.toml. Run cargo update and a Dependabot update against the reproduction, tracing how the wildcard serde requirement becomes `*, <= 1.0.171`; done means the Dependabot run completes without the malformed requirement error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.