rust-lang / rust-lang/cargo

rerun-if-changed doesn't trigger if a symlink points to a different file with the same mtime

Open
#15,134 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-build-scripts A-rebuild-detection C-bug S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Problem

Last week I ran into crashes working on the Python bcrypt project, which uses Rust via PyO3. Ultimately I tracked the crash down to the Rust build cache not being invalidated correctly while switching Python interpreters. See this PyO3 issue for more context.

Steps

Clone this repository and run the steps in the README.

The repository sets up symlinks in a manner analogous to the problematic symlinks that caused issues on the bcrypt CI. In the real-world case the two python symlinks were pointing at interpreters with different filesystem paths but happened to have the same mtime.

Possible Solution(s)

No response

Notes

No response

Version
cargo 1.84.1 (66221abde 2024-11-19)
release: 1.84.1
commit-hash: 66221abdeca2002d318fde6efff516aab091df0e
commit-date: 2024-11-19
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 15.2.0 [64-bit]

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

Run the linked test-rerun-if-changed repository by following its README to reproduce the symlink behavior. Then trace Cargo's rerun-if-changed handling and filesystem metadata comparison. Done means switching a symlink to a different target triggers a rerun even when the targets have the same mtime, with regression coverage for the reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.