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 creating archives on windows with a CRLF #60

Merged
merged 1 commit into from
Feb 17, 2021
Merged

Conversation

lamont-granquist
Copy link
Contributor

@lamont-granquist lamont-granquist commented Feb 17, 2021

The problem on windows is that when we have a file with CRLF and read without binmode that it mangles that by converting to LF. In order to test that we need a file guaranteed to have a real CRLF on windows and read that with the code and ensure that the resulting file when extracted from the archive still has the CRLF in it and wasn't mangled by being converted into LF internal to ruby.

To do that we need a .gitattribute file that treats the fixtures as binaries (although I wasn't seeing crlf conversion by git, but we definitely need to assert that the fixtures in this repo are binaries).

Then we check that the filesizes that we're packaging look right, and then package and extract and check that the output filesize is the same. This correct fails when the binmode flag is removed from the File.read on windows systems.

It looks like this test now checks the thing it was designed to check? The binary file it was reading wasn't getting mangled by windows binmode since there was no CRLF in the file to get converted.

This fixes windows policyfile archive creation along with probably many
other windows bugs when used with ffi-libarchive.

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
@lamont-granquist lamont-granquist changed the title see if this blows up windows Fix windows binmode setting Feb 17, 2021
@tas50 tas50 changed the title Fix windows binmode setting Fix creating archives on windows with a CRLF Feb 17, 2021
@tas50 tas50 merged commit ef0535c into master Feb 17, 2021
@lamont-granquist lamont-granquist deleted the lcg/just-testin branch February 17, 2021 02:39
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.

2 participants