-
Notifications
You must be signed in to change notification settings - Fork 174
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
zarf tries to apply template replacements to large files that might be incorrectly assessed as text #2308
Labels
bug 🐞
Something isn't working
Comments
IMO we would want to add more detection logic to root out these kinds of files (rather than add a new key) - this could be done in two ways:
1 is probably best to explore first since theoretically it is more flexible if it can properly detect these files. |
5 tasks
Racer159
added a commit
that referenced
this issue
Feb 21, 2024
## Description Alters text detection logic to read the first and last 512 bytes. Tested with 5 files: - [NVIDIA installer](https://us.download.nvidia.com/XFree86/Linux-x86_64/535.154.05/NVIDIA-Linux-x86_64-535.154.05.run) Detected as application type when reading last 512. - 3 4k size files of junk text with a ZARF_CONST replacement, in straight text, yaml, and json All 3 detected as text/plain, ZARF_CONST was replaced. - 1 small 100 byte file with a ZARF_CONST replacement. Was still detected as text and ZARF_CONST was replaced. Existing unit tests succeeded. ## Related Issue Fixes #2308 <!-- or --> Relates to # ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) ## Checklist before merging - [x] Test, docs, adr added or updated as needed - [x] [Contributor Guide Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow) followed --------- Co-authored-by: Wayne Starr <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Device and OS: linux/amd64
App version: 0.32.3
Kubernetes distro being used: k3s (Not applicable for this problem)
Other:
Steps to reproduce
Expected result
FIle is simply copied to location
Actual Result
This particular type of file is technically a script with an archive concatenated with it and it is rather large. Zarf detects it as a text file since it has text up front and tries to apply templating (###ZARF_VAR_*) to it.
There should be a way perhaps in the zarf.yaml to force it to not take this behavior. Maybe something like this?
OR
Change the detection to also check the last couple of bytes at the end of the file too, should not be text for these type of installers.
If you opt for the latter, I can probably submit a PR myself. If you want to do the former, I would prefer your team discuss how you want to proceed. Happy to help where I can!
Visual Proof (screenshots, videos, text, etc)
Severity/Priority
I can work around this by using an action to tar.gz it up beforehand but would be nice if I didn't have to do that.
Additional Context
Looks like this is the area of concern:
https://github.com/defenseunicorns/zarf/blob/7e91d3b9823b52fe6d0f563d692c8af57faa6005/src/pkg/packager/deploy.go#L360
The text was updated successfully, but these errors were encountered: