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

[Experiment] set .cargo/registry/src as readonly #98370

Closed
wants to merge 1 commit into from

Conversation

weihanglo
Copy link
Member

Need a crater run on check mode to see how readonly registry sources break stuff.

This does not take into account the case which I mentioned earlier, so failure cases may be far less than expected. I will appreciate if anyone gives a hint about how to make crater run cargo c && rm -rf ~/.cargo/registry/src && cargo c :)

Still, changing the permission bits causes build.rs not able to run some executables1, or makes .cargo-ok not able to write2. So, let's see how far it goes.

r? @ghost

Footnotes

  1. https://github.com/rust-lang/cargo/pull/9131

  2. https://github.com/rust-lang/cargo/blob/c9d8c28cba959c347271eaf31c9abfbb74c690bd/src/cargo/sources/registry/mod.rs#L657-L664

@weihanglo weihanglo added the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Jun 22, 2022
@weihanglo
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Jun 22, 2022

⌛ Trying commit cd01cbd8c49aec8aca4ef6012727cb2d670de09e with merge 665f4256561629ddbc1123adf44c84e656ad9db0...

@bors
Copy link
Contributor

bors commented Jun 22, 2022

💔 Test failed - checks-actions

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 22, 2022
@rust-log-analyzer

This comment was marked as outdated.

@weihanglo weihanglo force-pushed the registry-src-readonly branch from cd01cbd to c012e6c Compare June 22, 2022 03:46
@rust-log-analyzer

This comment was marked as outdated.

@weihanglo
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Jun 22, 2022

⌛ Trying commit c012e6c26e60d903253621afabca19e1b1f5a87a with merge 56723e30e40b52b73b9722d31caeec71c84a0ed4...

@jyn514
Copy link
Member

jyn514 commented Jun 22, 2022

This does not take into account the case which I mentioned earlier, so failure cases may be far less than expected. I will appreciate if anyone gives a hint about how to make crater run cargo c && rm -rf ~/.cargo/registry/src && cargo c :)

I don't think there's an existing way to do this: https://github.com/rust-lang/crater/blob/master/docs/bot-usage.md#available-experiment-modes.
If you're ok just running cargo check, you can use mode=check-only. Otherwise you'll have to add a new mode to crater itself, here's an example: rust-lang/crater#543

@bors
Copy link
Contributor

bors commented Jun 22, 2022

☀️ Try build successful - checks-actions
Build commit: 56723e30e40b52b73b9722d31caeec71c84a0ed4 (56723e30e40b52b73b9722d31caeec71c84a0ed4)

@weihanglo
Copy link
Member Author

Thanks for the info! I am fine with check-only mode first. Let me check if I get the permission.

@craterbot run mode=check-only crates=top-100

@craterbot
Copy link
Collaborator

🔒 Error: you're not allowed to interact with this bot.

🔑 If you are a member of the Rust team and need access, add yourself to the whitelist.
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@weihanglo
Copy link
Member Author

Okay, no 😞
@jyn514 could you help run crater? Thanks!

@jyn514
Copy link
Member

jyn514 commented Jun 22, 2022

@craterbot run mode=check-only crates=top-100

@craterbot
Copy link
Collaborator

👌 Experiment pr-98370 created and queued.
🤖 Automatically detected try build 56723e30e40b52b73b9722d31caeec71c84a0ed4
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. labels Jun 22, 2022
@jyn514
Copy link
Member

jyn514 commented Jun 22, 2022

@craterbot cancel

@craterbot run mode=check-only crates=top-100 p=1 (this is fast to run, no need to wait a week)

@craterbot
Copy link
Collaborator

🚨 Error: failed to parse the command

🆘 If you have any trouble with Crater please ping @rust-lang/infra!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@jyn514
Copy link
Member

jyn514 commented Jun 22, 2022

@craterbot abort name=pr-98370

@craterbot run mode=check-only crates=top-100 p=1 (this is fast to run, no need to wait a week)

@craterbot
Copy link
Collaborator

🗑️ Experiment pr-98370 deleted!

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jun 22, 2022
@jyn514
Copy link
Member

jyn514 commented Jun 22, 2022

@craterbot run mode=check-only crates=top-100 p=1 (this is fast to run, no need to wait a week)

@craterbot
Copy link
Collaborator

🚨 Error: failed to parse the command

🆘 If you have any trouble with Crater please ping @rust-lang/infra!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

👌 Experiment pr-98370 created and queued.
🤖 Automatically detected try build 56723e30e40b52b73b9722d31caeec71c84a0ed4
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2022
@craterbot
Copy link
Collaborator

🚧 Experiment pr-98370 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-98370 is completed!
📊 0 regressed and 0 fixed (100 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jun 22, 2022
@ehuss
Copy link
Contributor

ehuss commented Jun 23, 2022

I will appreciate if anyone gives a hint about how to make crater run cargo c && rm -rf ~/.cargo/registry/src && cargo c :)

I haven't had a chance to look at this, but I just wanted to quickly mention that you can implement whatever logic you want inside your cargo fork. Like in commands/check.rs you can call fs::remove_dir_all(…).

ehuss/cargo@e96bdb0...6901690 is an example of how I did something similar. It has an environment variable so that the "outer" cargo check would run the logic, and the "inner" cargo (with the environment variable set) would run like normal.

Also, I also wanted to mention that I think crater prefetches all dependencies, so this may not work as expected. Sorry, I forgot about that when we were discussing this earlier. I'm also not certain how CARGO_HOME gets mounted in the docker container, and whether or not you can actually modify CARGO_HOME. (Sorry, I have forgotten a lot of how rustwide works.)

Also, just looking at the diff, it looks like the src/tools/cargo submodule may not be at the correct hash. It looks like this has 85e457e158db216a2938d51bc3b617a5a7fe6015, but your branch is at 850d7ce755ad62d9db436ec2697b879d568ce16d. At least, I don't see your changes in this diff.

@weihanglo weihanglo force-pushed the registry-src-readonly branch from c012e6c to d0371b8 Compare June 23, 2022 10:24
@weihanglo
Copy link
Member Author

Oops. My fault. Thanks for the tip ehuss. Updated here weihanglo/cargo@fa889b3

@bors try

@bors
Copy link
Contributor

bors commented Jun 23, 2022

⌛ Trying commit d0371b8 with merge caa9a0ab7f12e74ec4868e297b789e6c6860d50a...

@bors
Copy link
Contributor

bors commented Jun 23, 2022

☀️ Try build successful - checks-actions
Build commit: caa9a0ab7f12e74ec4868e297b789e6c6860d50a (caa9a0ab7f12e74ec4868e297b789e6c6860d50a)

@weihanglo
Copy link
Member Author

Me again. @jyn514 could you help run the same crater command again please 🙏🏾
Thank you!

@jyn514
Copy link
Member

jyn514 commented Jun 23, 2022

@craterbot run mode=check-only crates=top-100 p=1

@craterbot
Copy link
Collaborator

👌 Experiment pr-98370-1 created and queued.
🤖 Automatically detected try build caa9a0ab7f12e74ec4868e297b789e6c6860d50a
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 23, 2022
@craterbot
Copy link
Collaborator

🚧 Experiment pr-98370-1 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-98370-1 is completed!
📊 82 regressed and 0 fixed (100 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jun 24, 2022
@jyn514
Copy link
Member

jyn514 commented Jun 24, 2022

Looks like @ehuss was right:


[INFO] [stderr] >> 1st remove `/opt/rustwide/cargo-home/registry/src`
[INFO] [stderr] error: Read-only file system (os error 30)

On the bright side I think this means that anything Crater is compiling isn't writing to the registry?

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 24, 2022
@Mark-Simulacrum Mark-Simulacrum removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 24, 2022
@Mark-Simulacrum
Copy link
Member

On the bright side I think this means that anything Crater is compiling isn't writing to the registry?

I would rephrase this to any successful compilation in Crater won't be writing to the registry. You can probably download a full-run's results e.g., https://crater-reports.s3.amazonaws.com/pr-99217/logs-archives/all.tar.gz and grep those logs for Read-only filesystem to try to get an idea of the percentage of crates we fail to run due to this issue (at least at cargo check time).

@weihanglo
Copy link
Member Author

Going to close this now. Will revisit if I have more time on it.

@weihanglo weihanglo closed this Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants