Skip to content

Bootstrap shows unexpected warning: unable to check if origin/master is old due to error #131296

Closed
@RalfJung

Description

@RalfJung
Member

I am getting this on each x.py invocation now, since very recently:

warning: unable to check if origin/master is old due to error: No such file or directory (os error 2)
warning: origin/master is used to determine if files have been modified
warning: if it is not updated, this may cause files to be needlessly reformatted

This is in my main checkout, not in a worktree, so I am not quite sure what could even be so unusual about my setup that causes an error here.

Cc @rust-lang/bootstrap

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 5, 2024
RalfJung

RalfJung commented on Oct 5, 2024

@RalfJung
MemberAuthor

A bisect points at

cea707d96033d5e14d3c2b287b0bedd2847db680 is the first bad commit
commit cea707d96033d5e14d3c2b287b0bedd2847db680
Author: binarycat <binarycat@envs.net>
Date:   Tue Aug 27 16:31:40 2024 -0400

    emit old upstream warning no matter the build step

 src/bootstrap/src/core/build_steps/format.rs | 4 +---
 src/bootstrap/src/core/sanity.rs             | 6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)

That's #129584. I am surprised about the date of this PR, I think I would have noticed this earlier if this happened for a month... so probably some other factor is also involved.

Cc @lolbinarycat

RalfJung

RalfJung commented on Oct 5, 2024

@RalfJung
MemberAuthor

It seems to try to read .git/refs/remotes/origin/master which indeed is not a file that exists here.

$ tree .git/refs/
.git/refs/
├── bisect
├── heads
│   ├── immediate-offset-sanity-check
│   ├── master
│   └── master.2
├── remotes
│   └── origin
│       └── HEAD
└── tags

I also noticed this line in .git/packed-refs

f559d6188828b738ce7e7c2e4d99bf03111336d6 refs/remotes/origin/master

So maybe checking these files is just futile since git doesn't always use a file to track these refs?

RalfJung

RalfJung commented on Oct 5, 2024

@RalfJung
MemberAuthor

I think what happened is that git gc has been run, and that indeed cleans up most of the files from .git/refs/remotes.

So the current approach in bootstrap of looking at these files is not reliable. IMO we should instead look at the commit date of the most recent commit in that branch. That also avoids having to directly mess with git's internal files.

lolbinarycat

lolbinarycat commented on Oct 5, 2024

@lolbinarycat
Contributor

yeah, i'm gonna accept defeat on this one. git log is kinda slow on my device, but only if the relevant files aren't in the i/o cache, and building rust takes a good while anyways.

added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
C-bugCategory: This is a bug.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 5, 2024
onur-ozkan

onur-ozkan commented on Oct 6, 2024

@onur-ozkan
Member

#129528 is not the case anymore since refactor merge base logic and fix x fmt PR. I am planning to revert #130121 and #129584 as they are not really required.

onur-ozkan

onur-ozkan commented on Oct 6, 2024

@onur-ozkan
Member

#129528 is not the case anymore since #130161.

Seems like it will still be the case if upstream was configured and too old. But that could be fixed in a much better way (e.g., we could ignore upstream commit and use merge commit in current branch) compare to #130121 and #129584.

added a commit that references this issue on Oct 7, 2024

Rollup merge of rust-lang#131331 - onur-ozkan:131296, r=Kobzol

3a5a816
added a commit that references this issue on Oct 7, 2024
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

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @RalfJung@saethlin@lolbinarycat@onur-ozkan@rustbot

      Issue actions

        Bootstrap shows unexpected warning: unable to check if origin/master is old due to error · Issue #131296 · rust-lang/rust