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

fix: Cargo.lock generation matches LF/CRLF line endings #13339

Closed
wants to merge 1 commit into from
Closed

fix: Cargo.lock generation matches LF/CRLF line endings #13339

wants to merge 1 commit into from

Conversation

JarlEvanson
Copy link

What does this PR try to resolve?

This PR attempts to resolve issue #12897. If a Cargo.toml is present, it detects if a CRLF line ending ends the first line, and then outputs the corresponding line ending when generating the lockfile.

How should we test and review this PR?

The additional test should test for the CRLF adherence, just as the preserve_line_endings_issue_2076 test used to do before we started testing for equality based on lines.

Additional Notes

If this approach proves successful, the Emitter struct could be used to ensure compliance in other auto-generated files that contain line endings that should maintain the previous line ending style, such as the cargo add bug discussed in the issue #12897 thread.

@rustbot
Copy link
Collaborator

rustbot commented Jan 23, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-lockfile Area: Cargo.lock issues S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2024
Copy link
Contributor

@epage epage left a comment

Choose a reason for hiding this comment

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

Maybe I misunderstood but this goes in a different direction than what is discussed in #12897 and I would recommend proposing it there and for us to resolve that before moving forward with an implementation review.

@rustbot rustbot added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2024
@JarlEvanson JarlEvanson closed this Feb 2, 2024
@JarlEvanson JarlEvanson deleted the issue-#12897 branch February 2, 2024 21:13
epage added a commit to epage/cargo that referenced this pull request Mar 4, 2024
This is preparation for rust-lang#13339 and covers hot spots I found as well as
areas currently covered by `profile::start(...)`.

This is split out to avoid conflicts while working through the remaining
issues for rust-lang#13339.
Maybe it will also serve to help debugging...
bors added a commit that referenced this pull request Mar 4, 2024
fix(cli): Trace core cargo operations

### What does this PR try to resolve?

This is preparation for #13339 and covers hot spots I found as well as areas currently covered by `profile::start(...)`.

This is split out to avoid conflicts while working through the remaining issues for #13339.
Maybe it will also serve to help debugging...

### How should we test and review this PR?

### Additional information

```console
$ rg profile::start src/
src/cargo/ops/cargo_compile/mod.rs:    let _p = profile::start("compiling");
src/cargo/ops/resolve.rs:        let _p = profile::start("resolving with overrides...");
src/cargo/util/rustc.rs:        let _p = profile::start("Rustc::new");
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start("cleaning global cache files");
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start("global cache db sync");
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start(format!(
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start(format!("update db for removed {table_name}"));
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start(format!(
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start("populate untracked crate");
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start(format!("populate untracked {table_name}"));
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start(format!("update NULL sizes {table_name}"));
src/cargo/core/global_cache_tracker.rs:        let _p = crate::util::profile::start("saving last-use data");
src/cargo/core/resolver/features.rs:        let _p = profile::start("resolve features");
src/cargo/core/resolver/mod.rs:    let _p = profile::start("resolving");
src/cargo/core/compiler/fingerprint/mod.rs:    let _p = profile::start(format!(
src/cargo/core/compiler/mod.rs:    let p = profile::start(format!("preparing: {}/{}", unit.pkg, unit.target.name()));
src/cargo/core/compiler/build_runner/mod.rs:        let _p = profile::start("preparing layout");
src/cargo/core/compiler/custom_build.rs:    let _p = profile::start(format!(
src/cargo/core/compiler/job_queue/mod.rs:        let _p = profile::start("executing the job graph");

```
charmitro pushed a commit to charmitro/cargo that referenced this pull request Sep 13, 2024
This is preparation for rust-lang#13339 and covers hot spots I found as well as
areas currently covered by `profile::start(...)`.

This is split out to avoid conflicts while working through the remaining
issues for rust-lang#13339.
Maybe it will also serve to help debugging...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lockfile Area: Cargo.lock issues S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants