Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

fix: replace line endings on Windows to enforce deterministic metadata#108

Merged
mattsse merged 4 commits intomainfrom
klkvr/unify-line-endings
Apr 20, 2024
Merged

fix: replace line endings on Windows to enforce deterministic metadata#108
mattsse merged 4 commits intomainfrom
klkvr/unify-line-endings

Conversation

@klkvr
Copy link
Copy Markdown
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

@klkvr klkvr requested review from DaniPopes and Evalir as code owners April 19, 2024 22:55
Copy link
Copy Markdown
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

Comment thread src/artifacts/mod.rs Outdated
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
Copy Markdown
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
@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.
alexandergrey33 added a commit to alexandergrey33/compilers that referenced this pull request Sep 17, 2025
Follow-up to foundry-rs/compilers#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.
bug-knightxmiu70 added a commit to bug-knightxmiu70/compilers that referenced this pull request Sep 28, 2025
Follow-up to foundry-rs/compilers#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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants