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: avoid max read size reached error when cmp imported files #618

Merged
merged 1 commit into from
May 9, 2024

Conversation

raharper
Copy link
Contributor

@raharper raharper commented May 8, 2024

What type of PR is this?

bug

Which issue does this PR fix:

#617

What does this PR do / Why do we need it:

when dealing with large files in imports (> 10**10 bytes) then equalfile fails.
this PR uses io.LimitedReader to avoid the error path.

If an issue # is not available please add repro steps and logs showing the issue:

Testing done on this change:

Automation added to e2e:

Will this break upgrades or downgrades?

No

Does this PR introduce any user-facing change?:

No


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The equalfile golang package defaults to max read size of 10**10
bytes unless both files use io.LimitedReader to set an upper bound
on the read.  In stacker import we already stat the two files being
compared and know the actual file size.  This PR constructs two
io.LimitedReader's for each file being compared.

Fixes: project-stacker#617

Signed-off-by: Ryan Harper <[email protected]>
Copy link
Contributor

@mikemccracken mikemccracken left a comment

Choose a reason for hiding this comment

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

nice catch, thanks!

@raharper raharper force-pushed the fix/large-file-size branch from 8a2904b to dfc4e8b Compare May 8, 2024 21:38
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

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

lgtm

@rchincha rchincha merged commit 25b859b into project-stacker:main May 9, 2024
9 checks passed
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.

Bug: max read sized reached when importing layer with very large files ss
3 participants