Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: Use josh for subtree syncs #17025

Merged
merged 1 commit into from
Apr 21, 2024
Merged

internal: Use josh for subtree syncs #17025

merged 1 commit into from
Apr 21, 2024

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Apr 7, 2024

No description provided.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 7, 2024
@lnicola
Copy link
Member Author

lnicola commented Apr 7, 2024

Untested, and still need to update docs/dev/README.md.

r? @RalfJung

@lnicola lnicola force-pushed the josh branch 3 times, most recently from 2310b52 to 4c54702 Compare April 7, 2024 09:03
@lnicola
Copy link
Member Author

lnicola commented Apr 7, 2024

@RalfJung do you know if Josh can use SSH remotes?

EDIT: somewhat, it looks like, https://josh-project.github.io/josh/reference/container.html and josh-project/josh#1323

@lnicola
Copy link
Member Author

lnicola commented Apr 7, 2024

Doesn't seem to work:

Preparing lnicola/rust (base: 688c30dc9f8434d63bddb65bd6a4d2258d19717c)...
$ git fetch https://github.com/rust-lang/rust 688c30dc9f8434d63bddb65bd6a4d2258d19717c
From https://github.com/rust-lang/rust
 * branch                    688c30dc9f8434d63bddb65bd6a4d2258d19717c -> FETCH_HEAD
$ git push https://github.com/lnicola/rust 688c30dc9f8434d63bddb65bd6a4d2258d19717c:refs/heads/sync-from-ra

Pushing rust-analyzer changes...
$ git push http://localhost:42042/lnicola/rust.git:rev(f5a9250147f6569d8d89334dc9cca79c0322729f:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git HEAD:sync-from-ra
To http://localhost:42042/lnicola/rust.git:rev(f5a9250147f6569d8d89334dc9cca79c0322729f:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git
 ! [rejected]              HEAD -> sync-from-ra (non-fast-forward)
error: failed to push some refs to 'http://localhost:42042/lnicola/rust.git:rev(f5a9250147f6569d8d89334dc9cca79c0322729f:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you want to integrate the remote changes, use 'git pull'
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Sounds like I didn't delete the branch on my fork, but I did.

@RalfJung
Copy link
Member

RalfJung commented Apr 7, 2024

I'm using josh via SSH, it's working fine for me. Also see the git config hint at the end of this section.

xtask/src/flags.rs Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member

RalfJung commented Apr 7, 2024

It's hard to review this. The code seems to be mostly exactly like in Miri. So you'll just have to try it. First try pulling, and see if it produces only a few new commits compared to RA master. Opening a PR is a good way to check that as github lists all new commits. Then try pushing and see that that also only produces a few new commits. Then try changing something in the "pulled" branch and try pushing that, and try changing something in the pushed branch and try pulling that.

.read()?;
let head = cmd!(sh, "git rev-parse HEAD").read()?;
let fetch_head = cmd!(sh, "git rev-parse FETCH_HEAD").read()?;
if head != fetch_head {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW this is pretty crucial. If you continue and merge this into rustc despite this check failing, the RA repo may need a force-push to fix the situation. That's what happened in Miri.

I haven't seen this check fail in over a year.

Copy link
Member Author

@lnicola lnicola Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to do it:

$ git fetch https://github.com/rust-lang/rust 4e431fad67b46c480f1833119cd368fa33df95f7
remote: Enumerating objects: 161, done.
remote: Counting objects: 100% (120/120), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 161 (delta 107), reused 109 (delta 105), pack-reused 41
Receiving objects: 100% (161/161), 72.28 KiB | 7.23 MiB/s, done.
Resolving deltas: 100% (108/108), completed with 76 local objects.
From https://github.com/rust-lang/rust
 * branch                    4e431fad67b46c480f1833119cd368fa33df95f7 -> FETCH_HEAD
$ git push https://github.com/lnicola/rust 4e431fad67b46c480f1833119cd368fa33df95f7:refs/heads/sync-from-ra

Pushing rust-analyzer changes...
$ git push http://localhost:42042/lnicola/rust.git:rev(f5a9250147f6569d8d89334dc9cca79c0322729f:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git HEAD:sync-from-ra
Enumerating objects: 1335, done.
Counting objects: 100% (851/851), done.
Delta compression using up to 32 threads
Compressing objects: 100% (293/293), done.
Writing objects: 100% (500/500), 97.33 KiB | 48.67 MiB/s, done.
Total 500 (delta 332), reused 351 (delta 194), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (332/332), completed with 143 local objects.
remote: josh-proxy
remote: response from upstream:
remote: To https://github.com/lnicola/rust.git
remote:    4e431fad67b..cc7848da115  JOSH_PUSH -> sync-from-ra
remote: REWRITE(1455ee0766bcb6075e6fdf797d24953f0af52b20 -> bf5c131477627b5e6273d5338d6b3ea137db4d41)
remote: 
remote: 
To http://localhost:42042/lnicola/rust.git:rev(f5a9250147f6569d8d89334dc9cca79c0322729f:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git
   16b22118c3..1455ee0766  HEAD -> sync-from-ra

Error: Josh created a non-roundtrip push! Do NOT merge this into rustc!

$ git rev-parse HEAD
1455ee0766bcb6075e6fdf797d24953f0af52b20
$ git rev-parse FETCH_HEAD
56021a0d6123ced47c4db622f5b7f56a5f9ae97f
$ git log
commit 1455ee0766bcb6075e6fdf797d24953f0af52b20 (HEAD -> josh)
Merge: a2dfd9785f 16b22118c3
Author: Laurențiu Nicola
Date:   Sun Apr 7 19:23:56 2024 +0300

    Merge from downstream

commit a2dfd9785f167413355f98cc06e7cc7cb6b6a94b
Author: Laurențiu Nicola
Date:   Sun Apr 7 19:23:54 2024 +0300

    Preparing for merge from downstream

commit 56021a0d6123ced47c4db622f5b7f56a5f9ae97f (mine/josh)
Author: Laurențiu Nicola
Date:   Sun Apr 7 11:41:39 2024 +0300

    Use josh for subtree syncs

So it's exactly the two pull commits that are missing. (This time I tried a pull, then push on the same branch). Yet here they are: https://github.com/lnicola/rust/commits/sync-from-ra/.

Copy link
Member

@RalfJung RalfJung Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange. I don't know what to take from your git rev-parse, what do those show?

You marked the PR as "ready for review" -- did you make more progress here?
I can take a look eventually but probably not this week.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange. I don't know what to take from your git rev-parse, what do those show?

HEAD is the "Merge from downstream" commit, FETCH_HEAD is the josh change. Or maybe I misunderstood the question?

You marked the PR as "ready for review" -- did you make more progress here?

No, but I think it's a good start, and the FETCH_HEAD thing could conceivably be explained by my disk space problems. And it will be a while before I can try it again (since I have to reinstall and all that).

@lnicola
Copy link
Member Author

lnicola commented Apr 7, 2024

So you'll just have to try it.

Well, I did. Pulling doesn't produce any commits, which is normal. But pushing fails as above.

@RalfJung
Copy link
Member

RalfJung commented Apr 7, 2024

Hm, either the rust-version file needs to use a different commit then or the first push is magic and needs to be done by hand somehow... I forgot what exactly we did initially in Miri to get this started.

What if you put the current rustc HEAD into the rust-version file?

Are you sure pulling from the current rustc HEAD produces no new commits? There are usually some merge commits being added. It may be that you can only push after those have been integrated.

@lnicola
Copy link
Member Author

lnicola commented Apr 7, 2024

Yes, I also tried that. Maybe we should do a pull first?

@RalfJung
Copy link
Member

RalfJung commented Apr 7, 2024 via email

@lnicola
Copy link
Member Author

lnicola commented Apr 7, 2024

Hmm, interesting:

  • with the -git version of josh, pull is also broken:
$ git fetch http://localhost:42042/rust-lang/rust.git@fc1a4c5cc9308c4b5980c64a73fd344a59c10601:rev(f5a9250147f6569d8d89334dc9cca79c0322729f:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git
fatal: couldn't find remote ref HEAD
  • I tried to pull on this branch, but:
Your branch is ahead of 'mine/josh' by 1639 commits.
  (use "git push" to publish your local commits)

.context("FAILED to fetch new commits, something went wrong (committing the rust-version file has been undone)")?;

// Merge the fetched commit.
const MERGE_COMMIT_MESSAGE: &str = "Merge from downstream";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So "downstream" is rustc? I think I've seen clippy use "upstream" for rustc. This is going to be confusing.^^

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, for us rust-lang/rust is the downstream since most of the development happens in this repo. I think that's the standard usage of the terms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's standard if you know how the projects work, yeah. Not obvious to an outsider though. 🤷 In Miri I don't think of either one as being upstream or downstream, it's just two repos that sync back and forth.

Currently the two commits this adds are getting inconsistent messages, one says "merge from rustc" and the other "merge from downstream".

@RalfJung
Copy link
Member

RalfJung commented Apr 7, 2024

That's a lot of commits, but they seem to all be merge commits? Every merge commit in rustc that spans an RA change will show up here, this is needed for josh to be able to match the repo structures against each other.

However, that still seems like too many commits. I don't think we got 1600 commits in Miri when we did the initial josh sync.

@lnicola
Copy link
Member Author

lnicola commented Apr 7, 2024

Oh, I hate this:

$ git reset d28e67a35f
Unstaged changes after reset:
M	rust-version
fatal: sha1 file '.git/index.lock' write error. Out of diskspace

Besides the space needed for the rustc checkout for push (miri-script says 1 GB, but it's about 13 GB for me, including the submodules?), josh keeps another copy and a half of the repo in its cache:

9,8G	~/.cache/rust-analyzer-josh/

EDIT:

Cursed thing broke my file system:

rm: cannot remove '~/.cache/rust-analyzer-josh/overlay/objects/29/434f2b6183e9f6ddda0decf4496d2a75e2f9a0': Input/output error
rm: cannot remove '~/.cache/rust-analyzer-josh/overlay/objects/c5/eccb420df42f07eb3e0d2457380fc121374ab9': Input/output error
rm: cannot remove '~/.cache/rust-analyzer-josh/overlay/objects/34/6bacce6becd285a52fd330d1ce1dc99a48f2a6': Input/output error
rm: cannot remove '~/.cache/rust-analyzer-josh/overlay/objects/78/5eeae7a8ad66258f6492a8f8f02282fe94cd41': Input/output error
rm: cannot remove '~/.cache/rust-analyzer-josh/overlay/objects/d8/96b56409f3ce5a4133e828fc6dced31e1d4707': Input/output error

[ +18446744073717,000000] BTRFS error (device nvme0n1p5): parent transid verify failed on logical 858110574592 mirror 1 wanted 416470 found 416490
[ +18446744073721,000000] BTRFS error (device nvme0n1p5): tree first key mismatch detected, bytenr=1025978138624 parent_transid=416476 key expected=(37253649,24,3817753667) has=(38724145,1,0)
[  +2,000000] BTRFS error (device nvme0n1p5): tree first key mismatch detected, bytenr=1025978138624 parent_transid=416476 key expected=(37253649,24,3817753667) has=(38724145,1,0)
[ +18446744073710,000000] BTRFS error (device nvme0n1p5): tree first key mismatch detected, bytenr=1025978138624 parent_transid=416476 key expected=(37253649,24,3817753667) has=(38724145,1,0)
[apr 7 19:44] BTRFS error (device nvme0n1p5): tree first key mismatch detected, bytenr=1025978138624 parent_transid=416476 key expected=(37253649,24,3817753667) has=(38724145,1,0)

@lnicola lnicola marked this pull request as ready for review April 7, 2024 16:48
@RalfJung
Copy link
Member

RalfJung commented Apr 8, 2024

Besides the space needed for the rustc checkout for push (miri-script says 1 GB, but it's about 13 GB for me, including the submodules?),

Just give it a path to an existing rustc checkout you anyway use for rustc work. Then it takes 0 extra space.

Also submodules are not needed. It doesn't need a checkout, just the git objects to work on. 1GB is the size increase that occurs when git fetching the rustc repo into a Miri checkout, which will not fetch submodules. 13GB sounds like you made a full checkout with the branch contents on disk (not just in the git index). That's unnecessary.

But yes the cache takes a bunch of space. And it seems to have hit some bug in btrfs? That's unfortunate. :/

@RalfJung
Copy link
Member

I can reproduce the strange result for rustc-pull, where it generates an enormous amount of merge commits. This is not something we saw when switching Miri to Josh.

I wonder if it's related to the fact that the git subtree syncs here look different than what I remember from Miri, with these huge commits created by rustc pushes.

I spot-checked some of these commits and they all make sense, in a sense. For instance, Auto merge of #3145 - RalfJung:data-race-error, r=RalfJung shows up as 4279268; in rustc that's 2ef639d4fbf89dc584bfa1a2211b56123df4aa5f with the to parent commits 1b2e4a9c941, 278965a0c49. (This is in fact originally a Miri commit.) git diff 1b2e4a9c941 278965a0c49 src/tools/rust-analyzer shows that indeed there is a diff here, so for josh to preserve the history it has to include this merge commit in the repo. The diff is the same as that of the two parent commits of the corresponding commit on the RA side. When doing rustc-pull, josh will preserve all merge commits whose parents differ on the parts of the tree that josh is currently fetching.

@RalfJung
Copy link
Member

However, pushing in the other direction seems to work just right for me. I did a pull, and then I changed something in the readme and did a push, and the result is this branch which does round-trip properly and which only adds 4 commits to rustc.

I then tried changing something there and pulling that back into RA, which also worked fine.

Not sure what went wrong when your push ended up non-roundtripping. If you pushed on a branch that didn't previously get a rustc-pull then that is probably the reason; anything you try to push should be based on what josh produces when pulling so that josh has a chance of matching up the histories and reconstructing a suitable RA history on the rustc side.

@lnicola
Copy link
Member Author

lnicola commented Apr 20, 2024

I guess I must be doing something really wrong then. Here are my steps:

  • I'm on a clean checkout of this branch (lnicola:josh)
  • I do a cargo xtask rustc-pull, which only adds two commits:
commit 46b460d8c961508f580bd05e5d168e7bb66722bb (HEAD -> josh)
Merge: e8690219a0 ae00688f19
Author: Laurențiu Nicola
Date:   Sat Apr 20 09:51:41 2024 +0300

    Merge from downstream

commit e8690219a01df5451ff29e7853cf645ac3003f93
Author: Laurențiu Nicola
Date:   Sat Apr 20 09:51:32 2024 +0300

    Preparing for merge from downstream

diff --git a/rust-version b/rust-version
index e2a22b2395..e1d07306ff 100644
--- a/rust-version
+++ b/rust-version
@@ -1 +1 @@
-688c30dc9f8434d63bddb65bd6a4d2258d19717c
+9c7b1f4848263b7a39486a2cd482db0d632884e8
  • I have a clean rust-lang/rust checkout at ../rust-rust-analyzer, currently at 9c7b1f4848263b7a39486a2cd482db0d632884e8
  • I run RUSTC_GIT=../rust-rust-analyzer GITHUB_USER=lnicola cargo xtask rustc-push, which pushes to my branch at https://github.com/lnicola/rust/tree/sync-from-ra, but fails:
Preparing lnicola/rust (base: c8d19a92aa9022eb690899cf6d54fd23cb6877e5)...
$ git fetch https://github.com/rust-lang/rust c8d19a92aa9022eb690899cf6d54fd23cb6877e5
From https://github.com/rust-lang/rust
 * branch                    c8d19a92aa9022eb690899cf6d54fd23cb6877e5 -> FETCH_HEAD
$ git push https://github.com/lnicola/rust c8d19a92aa9022eb690899cf6d54fd23cb6877e5:refs/heads/sync-from-ra

Pushing rust-analyzer changes...
$ git push http://localhost:42042/lnicola/rust.git:rev(f5a9250147f6569d8d89334dc9cca79c0322729f:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git HEAD:sync-from-ra
Enumerating objects: 4271, done.
Counting objects: 100% (2468/2468), done.
Delta compression using up to 32 threads
Compressing objects: 100% (671/671), done.
Writing objects: 100% (1571/1571), 325.51 KiB | 46.50 MiB/s, done.
Total 1571 (delta 1036), reused 1368 (delta 856), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (1036/1036), completed with 285 local objects.
remote: josh-proxy
remote: response from upstream:
remote: To https://github.com/lnicola/rust.git
remote:    c8d19a92aa9..390772a056a  JOSH_PUSH -> sync-from-ra
remote: REWRITE(5c6a075f170ebcdaef5aadde3d29f80d6f4f6356 -> 7980fac7b164141a978f89fae3b7dd349787e02a)
remote: 
remote: 
To http://localhost:42042/lnicola/rust.git:rev(f5a9250147f6569d8d89334dc9cca79c0322729f:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git
   f56ffd45ed..5c6a075f17  HEAD -> sync-from-ra

Error: Josh created a non-roundtrip push! Do NOT merge this into rustc!
  • interestingly, GitHub says: This branch is 157 commits ahead of, 2 commits behind rust-lang/rust:master. I'm not sure what's up with those two commits.
  • last time, HEAD was two commits in front of FETCH_HEAD, now they seem to have diverged:
$ git log HEAD
commit a6d9fe1698fd4b80e2c41d33347f66f45fb82e47 (HEAD -> josh)
Merge: c54ca6e595 ae00688f19
Author: Laurențiu Nicola
Date:   Sat Apr 20 09:59:51 2024 +0300

    Merge from downstream

commit c54ca6e595845d591d9915e44a88d40539b1b12e
Author: Laurențiu Nicola
Date:   Sat Apr 20 09:59:48 2024 +0300

    Preparing for merge from downstream

commit 2228677b93b998d9e7ec9da5d8c09a1728670420 (mine/josh)
Author: Laurențiu Nicola
Date:   Sun Apr 7 11:41:39 2024 +0300

    Use josh for subtree syncs

commit ae00688f1960906fa0792017c8bf9fa79238e766
Merge: f56ffd45ed 93a578e30b
Author: bors <[email protected]>
Date:   Sat Apr 20 04:11:16 2024 +0000

    Auto merge of #124114 - scottmcm:better-checked, r=workingjubilee
    
    Make `checked` ops emit *unchecked* LLVM operations where feasible
    
    For things with easily pre-checked overflow conditions -- shifts and unsigned subtraction -- write the checked methods in such a way that we stop emitting wrapping versions of them.
    
    For example, today <https://rust.godbolt.org/z/qM9YK8Txb> neither
    ```rust
    a.checked_sub(b).unwrap()
    ```
    nor
    ```rust
    a.checked_sub(b).unwrap_unchecked()
    ```
    actually optimizes to `sub nuw`.  After this PR they do.
    
    cc #103299

$ git log FETCH_HEAD
commit c086c55b978eb66a5e4237be38f3e674c08fa3db
Merge: b15b1a5d11 ae00688f19
Author: Laurențiu Nicola
Date:   Sat Apr 20 09:59:51 2024 +0300

    Merge from downstream

commit b15b1a5d1174f67f70e582b3887895fce521e9ee
Author: Laurențiu Nicola
Date:   Sat Apr 20 09:59:48 2024 +0300

    Preparing for merge from downstream

commit 36d27694537addf9dd93b2fa472733302d19d54b
Author: Laurențiu Nicola
Date:   Sun Apr 7 11:41:39 2024 +0300

    Use josh for subtree syncs

commit ae00688f1960906fa0792017c8bf9fa79238e766
Merge: f56ffd45ed 93a578e30b
Author: bors <[email protected]>
Date:   Sat Apr 20 04:11:16 2024 +0000

    Auto merge of #124114 - scottmcm:better-checked, r=workingjubilee
    
    Make `checked` ops emit *unchecked* LLVM operations where feasible
    
    For things with easily pre-checked overflow conditions -- shifts and unsigned subtraction -- write the checked methods in such a way that we stop emitting wrapping versions of them.
    
    For example, today <https://rust.godbolt.org/z/qM9YK8Txb> neither
    ```rust
    a.checked_sub(b).unwrap()
    ```
    nor
    ```rust
    a.checked_sub(b).unwrap_unchecked()
    ```
    actually optimizes to `sub nuw`.  After this PR they do.
    
    cc #103299

@RalfJung
Copy link
Member

RalfJung commented Apr 20, 2024

I do a cargo xtask rustc-pull, which only adds two commits:

That is extremely strange. How did you determine that it only adds two commits? When I look at the history of my branch after doing this, I see a lot of new commits -- and you also saw these at least once, since at some point you pushed to this PR a branch that had all these commits.

FWIW my version of josh is

RUSTFLAGS="--cap-lints=warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r23.12.04

I have pushed the result of running cargo xtask rustc-pull on commit 2228677 to https://github.com/RalfJung/rust-analyzer/tree/josh. It's a ton of commits, but the diff is not very big:

$ git diff 2228677b93
diff --git a/crates/parser/src/lexed_str.rs b/crates/parser/src/lexed_str.rs
index 48e4c8a622..e5fec67de7 100644
--- a/crates/parser/src/lexed_str.rs
+++ b/crates/parser/src/lexed_str.rs
@@ -178,7 +178,7 @@ impl<'a> Converter<'a> {
                 rustc_lexer::TokenKind::Ident => {
                     SyntaxKind::from_keyword(token_text).unwrap_or(IDENT)
                 }
-                rustc_lexer::TokenKind::InvalidIdent => {
+                rustc_lexer::TokenKind::InvalidPrefix | rustc_lexer::TokenKind::InvalidIdent => {
                     err = "Ident contains invalid characters";
                     IDENT
                 }
diff --git a/rust-version b/rust-version
index e2a22b2395..e1d07306ff 100644
--- a/rust-version
+++ b/rust-version
@@ -1 +1 @@
-688c30dc9f8434d63bddb65bd6a4d2258d19717c
+9c7b1f4848263b7a39486a2cd482db0d632884e8

That's the same rustc commit as in your diff. But the change in rustc is missing. Something is seriously borked... maybe try clearing your josh cache?

@lnicola
Copy link
Member Author

lnicola commented Apr 20, 2024

That is extremely strange. How did you determine that it only adds two commits? When I look at the history of my branch after doing this, I see a lot of new commits -- and you also saw these at least once, since at some point you pushed to this PR a branch that had all these commits.

You're right, I didn't pay attention.

FWIW my version of josh is

I have the same one. When I tried -git, it failed on pulls.

Something is seriously borked... maybe try clearing your josh cache?

It was fresh, I just reinstalled my OS.

@lnicola
Copy link
Member Author

lnicola commented Apr 20, 2024

I have pushed the result of running cargo xtask rustc-pull on commit 2228677 to https://github.com/RalfJung/rust-analyzer/tree/josh. It's a ton of commits, but the diff is not very big

This is mine: https://github.com/lnicola/rust-analyzer/tree/josh-plus-rustc-pull

@RalfJung
Copy link
Member

Is there a way to tell what the last rustc commit is that got synced into RA? #16983 is the PR that did it but I can't see which rustc commits this includes (and which it does not include).

@RalfJung
Copy link
Member

RalfJung commented Apr 27, 2024

The main issue, I think, is that doing rustc-pull adds a new root commit (8a7cde4). Ideally we'd add a programmatic check to ensure there are no new root commits, but I haven't yet found a good way to do that. (EDIT: Ah, found it: git rev-list --max-parents=0.)

I don't quite understand why this happens. The root commit is the synced version of rust-lang/rust@43acb50 -- but then, for Miri there exists rust-lang/rust@f45b570 and somehow that does not show up in the josh-extracted history at all, and I don't understand why.

@lnicola
Copy link
Member Author

lnicola commented Apr 27, 2024

Is there a way to tell what the last rustc commit is that got synced into RA? #16983 is the PR that did it but I can't see which rustc commits this includes (and which it does not include).

We used to do this in pairs, and that sync was probably rust-lang/rust#123258, so it should be rust-lang/rust@688c30dc9f8.

@lnicola
Copy link
Member Author

lnicola commented Apr 27, 2024

Sigh, perhaps submodules aren't that bad after all...

@RalfJung
Copy link
Member

I think the issues we are having here are due to migrating from one subtree tool to another.

If we started fresh in src/tools/rust-analyzer-v2 with josh from the start, I think things would be much less problematic. I was hoping there's a way to use filters to achieve the same effect (basically just ignore all old history), but I haven't managed to get that to work.

bors added a commit to rust-lang/miri that referenced this pull request Apr 27, 2024
josh rustc-pull: check that no new root commits get created

A second root was a bad sign in Miri (judging from the description in #2583) and seems to be a [bad sign in RA](rust-lang/rust-analyzer#17025 (comment)). So let's add this to the sanity checks.
RalfJung pushed a commit to RalfJung/rust that referenced this pull request Apr 27, 2024
josh rustc-pull: check that no new root commits get created

A second root was a bad sign in Miri (judging from the description in rust-lang/miri#2583) and seems to be a [bad sign in RA](rust-lang/rust-analyzer#17025 (comment)). So let's add this to the sanity checks.
@RalfJung
Copy link
Member

Using a patched josh with josh-project/josh#1326, I have done a pull-and-push successfully

RalfJung pushed a commit to RalfJung/rust that referenced this pull request May 4, 2024
josh rustc-pull: check that no new root commits get created

A second root was a bad sign in Miri (judging from the description in rust-lang/miri#2583) and seems to be a [bad sign in RA](rust-lang/rust-analyzer#17025 (comment)). So let's add this to the sanity checks.
@RalfJung
Copy link
Member

josh-project/josh#1329 landed, so a josh patch shouldn't be required any more (but it'd be good to re-test this with the latest josh master to make sure that the final PR that landed still works as intended).

@lnicola
Copy link
Member Author

lnicola commented May 16, 2024

Oof, I wanted to give this another try today, but..

$ cargo xtask rustc-pull
    Finished `dev` profile [unoptimized] target(s) in 0.04s
     Running `target/debug/xtask rustc-pull`
$ git commit rust-version --no-verify -m "Preparing for merge from rust-lang/rust"
[sync-from-rust 58f07c8863] Preparing for merge from rust-lang/rust
 1 file changed, 1 insertion(+)
$ git fetch http://localhost:42042/rust-lang/rust.git@97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f:rev(55d9a533b309119c8acd13061581b43ae8840823:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git
fatal: couldn't find remote ref HEAD
$ git reset --hard HEAD^
HEAD is now at 83ba420431 Auto merge of #17243 - Veykril:static-lt-hir, r=Veykril
Error: FAILED to fetch new commits, something went wrong (committing the rust-version file has been undone)

Caused by:
    command exited with non-zero code `git fetch http://localhost:42042/rust-lang/rust.git@97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f:rev(55d9a533b309119c8acd13061581b43ae8840823:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git`: 128

@RalfJung
Copy link
Member

Is it a timeout issue? josh can take a bit to start so I sometimes had to increase the timeout in start_josh so git doesn't try to connect before josh is ready.

@lnicola
Copy link
Member Author

lnicola commented May 16, 2024

No, it actually shows up in the logs:

2024-05-16T17:45:04.641377Z ERROR handle_http_request:call_service:prepare_namespace:do_filter:do_filter worker:filter_commit: josh: item=Error { code: -3, klass: 9, message: "object not found - no match for id (97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f)" } error=true url.path="/rust-lang/rust.git@97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f:rev(55d9a533b309119c8acd13061581b43ae8840823:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git/info/refs" http.request.method="GET" req_auth=(Handle { value: "" }, Request { method: GET, uri: /rust-lang/rust.git@97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f:rev(55d9a533b309119c8acd13061581b43ae8840823:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git/info/refs?service=git-upload-pack, version: HTTP/1.1, headers: {"host": "localhost:42042", "user-agent": "git/2.45.0", "accept": "*/*", "accept-encoding": "deflate, gzip", "accept-language": "en-GB, *;q=0.9", "pragma": "no-cache", "git-protocol": "version=2"}, body: Body(Empty) }) meta=MetaConfig { config: RepoConfig { repo: "/rust-lang/rust.git", filter: Nop, lock_refs: false }, refs_lock: {} } filter=Chain(Rev({55d9a533b309119c8acd13061581b43ae8840823: Chain(Prefix("rust-analyzer"), Chain(Prefix("tools"), Prefix("src")))}), Chain(Subdir("src"), Chain(Subdir("tools"), Subdir("rust-analyzer")))) head_ref=Explicit("97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f") repo_path="/home/grayshade/.cache/rust-analyzer-josh/" meta=MetaConfig { config: RepoConfig { repo: "/rust-lang/rust.git", filter: Nop, lock_refs: false }, refs_lock: {} } temp_ns=JoshProxyService { repo_path: "/home/grayshade/.cache/rust-analyzer-josh/overlay", name: "request_1550d29c-3cc3-4178-9db7-59d1e7affd01" } filter=Chain(Rev({55d9a533b309119c8acd13061581b43ae8840823: Chain(Prefix("rust-analyzer"), Chain(Prefix("tools"), Prefix("src")))}), Chain(Subdir("src"), Chain(Subdir("tools"), Subdir("rust-analyzer")))) head_ref=Explicit("97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f") filterobj=Chain(Rev({55d9a533b309119c8acd13061581b43ae8840823: Chain(Prefix("rust-analyzer"), Chain(Prefix("tools"), Prefix("src")))}), Chain(Subdir("src"), Chain(Subdir("tools"), Subdir("rust-analyzer")))) oid=97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f permissions=Empty

object not found - no match for id (97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f)

This is the same error as in #17025 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants