Skip to content

Conversation

@weihanglo
Copy link
Member

What does this PR try to resolve?

This is the unpacking half of #16237

Updating mtime for all files might not be worthy as crate published
after 1.54 should all have the deterministic mtime for non-generated
files, except those did manual upload.

This patch is aimed at
fixing the "regression" of vendor direct extraction,
rather than a complete fix of the non-deterministic mtime.
Also there are workarounds,
so the workflow is not completely blocked.

Fixes #16237

How to test and review this PR?

Since Cargo had a couple CVEs around tar and unpack,
I separate the mtime update logic from the main unpack logic,
so that each function's intent is clearer.
Hope it won't introduce new vulnerability

@rustbot rustbot added A-registries Area: registries A-testing-cargo-itself Area: cargo's tests S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 13, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2025

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

This is the unpacking half of rust-lang#16237

Updating mtime for all files might not be worthy as crate published
after 1.54 should all have the deterministic mtime for non-generated
files, except those did manual upload.

This patch is aimed at
fixing the "regression" of vendor direct extraction,
rather than a complete fix of the non-deterministic mtime.
Also there are workarounds,
so the workflow is not completely blocked.

Since Cargo had a couple CVEs around tar and unpack,
I separate the mtime update logic from the main unpack logic,
so that each function's intent is clearer.
Hope it won't introduce new vulnerability
@weihanglo
Copy link
Member Author

I love how the new typo= job show typos:

 Warning: "determinisitic" should be "deterministic".
error: `determinisitic` should be `deterministic`
     ╭▸ ./src/cargo/sources/registry/mod.rs:1127:44
     │
1127 │             tracing::trace!("failed to set determinisitic mtime for {path:?}: {e}");
     ╰╴                           

@epage epage enabled auto-merge November 13, 2025 03:33
@epage
Copy link
Contributor

epage commented Nov 13, 2025

I love how the new typo= job show typos:

 Warning: "determinisitic" should be "deterministic".
error: `determinisitic` should be `deterministic`
     ╭▸ ./src/cargo/sources/registry/mod.rs:1127:44
     │
1127 │             tracing::trace!("failed to set determinisitic mtime for {path:?}: {e}");
     ╰╴                           

Except why isn't that highlighting the typos span?

@epage epage added this pull request to the merge queue Nov 13, 2025
@weihanglo
Copy link
Member Author

I love how the new typo= job show typos:

 Warning: "determinisitic" should be "deterministic".
error: `determinisitic` should be `deterministic`
     ╭▸ ./src/cargo/sources/registry/mod.rs:1127:44
     │
1127 │             tracing::trace!("failed to set determinisitic mtime for {path:?}: {e}");
     ╰╴                           

Except why isn't that highlighting the typos span?

Because I failed to copy that 😆. Here is the right diagnostic:

 Warning: "determinisitic" should be "deterministic".
error: `determinisitic` should be `deterministic`
     ╭▸ ./src/cargo/sources/registry/mod.rs:1127:44
     │
1127 │             tracing::trace!("failed to set determinisitic mtime for {path:?}: {e}");
     ╰╴                                           ━━━━━━━━━━━━━━

Merged via the queue into rust-lang:master with commit 2dd0de2 Nov 13, 2025
26 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 13, 2025
bors added a commit to rust-lang/rust that referenced this pull request Nov 19, 2025
Update cargo submodule

13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c
2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000
- feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268)
- docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274)
- feat(generate-lockfile): Add unstable --publish-time flag  (rust-lang/cargo#16265)
- Do not lock the artifact-dir for check builds (rust-lang/cargo#16230)
- fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262)
- fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256)
- Use raw false during cfg test (rust-lang/cargo#16261)
- Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241)
- feat(tree): Support long forms for --format variables (rust-lang/cargo#16204)
- fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248)
- fix: update mtime for generated files after unpacking (rust-lang/cargo#16250)
- feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245)
- feat: Add a typos CI job (rust-lang/cargo#16122)
bors added a commit to rust-lang/rust that referenced this pull request Nov 19, 2025
Update cargo submodule

13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c
2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000
- feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268)
- docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274)
- feat(generate-lockfile): Add unstable --publish-time flag  (rust-lang/cargo#16265)
- Do not lock the artifact-dir for check builds (rust-lang/cargo#16230)
- fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262)
- fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256)
- Use raw false during cfg test (rust-lang/cargo#16261)
- Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241)
- feat(tree): Support long forms for --format variables (rust-lang/cargo#16204)
- fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248)
- fix: update mtime for generated files after unpacking (rust-lang/cargo#16250)
- feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245)
- feat: Add a typos CI job (rust-lang/cargo#16122)
bors added a commit to rust-lang/rust that referenced this pull request Nov 19, 2025
Update cargo submodule

13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c
2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000
- feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268)
- docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274)
- feat(generate-lockfile): Add unstable --publish-time flag  (rust-lang/cargo#16265)
- Do not lock the artifact-dir for check builds (rust-lang/cargo#16230)
- fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262)
- fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256)
- Use raw false during cfg test (rust-lang/cargo#16261)
- Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241)
- feat(tree): Support long forms for --format variables (rust-lang/cargo#16204)
- fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248)
- fix: update mtime for generated files after unpacking (rust-lang/cargo#16250)
- feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245)
- feat: Add a typos CI job (rust-lang/cargo#16122)
@rustbot rustbot added this to the 1.93.0 milestone Nov 20, 2025
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 20, 2025
Update cargo submodule

13 commits in 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f..5c0343317ce45d2ec17ecf41eaa473a02d73e29c
2025-11-12 15:56:06 +0000 to 2025-11-18 19:05:44 +0000
- feat: emit a warning when both `package.publish` and `--index` are specified (rust-lang/cargo#16268)
- docs(cargo-yank): clarify yank behavior with leaked credentials (rust-lang/cargo#16274)
- feat(generate-lockfile): Add unstable --publish-time flag  (rust-lang/cargo#16265)
- Do not lock the artifact-dir for check builds (rust-lang/cargo#16230)
- fix(fingerprint): force update mtime of cargo-check artifacts (rust-lang/cargo#16262)
- fix(manifest): Point out when a key belongs to config (rust-lang/cargo#16256)
- Use raw false during cfg test (rust-lang/cargo#16261)
- Suppress metadata warnings for non–crates.io publishable packages (rust-lang/cargo#16241)
- feat(tree): Support long forms for --format variables (rust-lang/cargo#16204)
- fix(config): Fallback to non-canonical path for workspace-path-hash (rust-lang/cargo#16248)
- fix: update mtime for generated files after unpacking (rust-lang/cargo#16250)
- feat(cli): Add support for completing `--config` values in Bash (rust-lang/cargo#16245)
- feat: Add a typos CI job (rust-lang/cargo#16122)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-registries Area: registries A-testing-cargo-itself Area: cargo's tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: cargo vendor creates files with `Modify:" date "1970-01-01 00:00:01.000000000 +0000"

3 participants