-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cargo.lock trailing newline removal in 1.38.0 #7254
Comments
This bug wouldn't be so bad if a simple |
cc @pietroalbini from release team as this is a beta regression. |
Not sure if I would consider this a beta regression at the same level as the other ones: an old project still works, there is just a bit of churn in the lockfile. However, your suggestion of touching the lockfile only when needed is a good one, and could make this issue less of a problem. Bringing in the loop the whole release team anyway, just to be sure. cc @rust-lang/release |
This is a regression, not everyone can fix everything in 19 hours since this was reported. All Cargo contributors are very busy, we'll make sure this is fixed before the next release. |
@alexcrichton I don't think that any of my statements can be interpreted as expectation of such a quick fix. Despite that, for the case you got such an impression, I'm deeply sorry for causing such an impression. Of course I don't expect that! I just wasn't sure whom to ping as you seemed busy (you still seem to be) and I tend to forget about bugs like this one myself so it's always best if it's in other people's trackers. Great respect for your work including that PR. Thanks for your statement that the bug will be fixed until the next release. |
Fix old lockfile encoding wrt newlines This commit fixes "old lockfile" encodings back to what they were prior to #7070 with respect to newlines. The changes in #7070 accidentally introduced a change where old lockfiles might have some extraneous newlines removed unintentionally. In #7070 it was attempted to clean up how newlines are emitted to ensure a trailing blank newline never shows up at the end of the file, but this acccidentally regressed cases where today we actually do have blank newlines at the end of lock files. This commit instead restores all the previous newline handling, and then scopes the "remove trailing newlines" fix to specifically just the new encoding. Closes #7254
This commit fixes "old lockfile" encodings back to what they were prior to rust-lang#7070 with respect to newlines. The changes in rust-lang#7070 accidentally introduced a change where old lockfiles might have some extraneous newlines removed unintentionally. In rust-lang#7070 it was attempted to clean up how newlines are emitted to ensure a trailing blank newline never shows up at the end of the file, but this acccidentally regressed cases where today we actually do have blank newlines at the end of lock files. This commit instead restores all the previous newline handling, and then scopes the "remove trailing newlines" fix to specifically just the new encoding. Closes rust-lang#7254
Consider this:
It will show you a difference! One line has been removed at the end of the file. Edit: Note that this only affects simple examples without dependencies. If there is a dependency, the newline behaviour is the same.
As time of writing, Rust beta is 1.38 and Rust stable is 1.37.
This bug may seem insignificant but it's the same "class" of change that #6180 was. In any environment where people use multiple versions of rustc to commit to the same codebase with a checked in Cargo.lock, you might run into situations where unrelated commits change Cargo.lock back and forth because the people just did
cargo add
. Environment with different versions of rustc can just mean that they haven't ran rustup in a while. #6180 at least had a phase in period.I think the most likely culprit for this regression is #7070. I see some newline related changes there. cc @alexcrichton
I think that the old behaviour should be retained or at least the files with the trailing newline be kept so that there isn't jitter.
The text was updated successfully, but these errors were encountered: