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: replace line endings on Windows to enforce deterministic metadata #108

Merged
merged 4 commits into from
Apr 20, 2024

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Apr 19, 2024

I'm writing tests for foundry-rs/foundry#7711 which are hardcoding CREATE2 library deployment addreses and they are currently failing on Windows probably because \r\n line endings which are causing metadata differences.

This PR tries to fix this by replacing such endings with \n

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

q about windows cfg.

let's also add a note for this

let content = fs::read_to_string(file).map_err(|err| SolcIoError::new(err, file))?;
let content = fs::read_to_string(file)
.map_err(|err| SolcIoError::new(err, file))?
.replace("\r\n", "\n");
Copy link
Member

Choose a reason for hiding this comment

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

should we only do this on windows?

this is probably not a big perf hit, but if we can limit this to windows only, it would be ideal

@mattsse mattsse merged commit e83f552 into main Apr 20, 2024
14 checks passed
@DaniPopes DaniPopes deleted the klkvr/unify-line-endings branch June 5, 2024 16:58
klkvr added a commit that referenced this pull request Jun 7, 2024
Follow-up to #108.

It seems that in certain cases files on WSL still have `\r\n` prefix,
thus this PR changes logic to always fix Windows line endings and not
only on Windows builds.
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.

None yet

2 participants