`chef export -a` truncates binary files when running from windows
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 18
- Forks
- 23
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 1
Description
Version:
Tested with Chef Workstation 0.18.3 and 20.7.81
Environment:
Tested on Windows Server 2016 and 2012R2 with
Scenario:
For reasons... We're trying to distribute a .exe binary file as part of one of our cookbooks. When we run:
chef update Policyfile.rb
chef export -a Policyfile.rb ..\
This .exe binary goes from 400Kb to 4Kb once you've unpacked the .tgz archive that was created.
This does not happen with all large files. I've only been able to reproduce it with .exe binaries. I haven't found other binary file types to test. It also happens if I ZIP those binaries. However, a large file of 0's zipped or unzipped will compress just fine, so it's only with binaries.
This also only happens on windows so far. I haven't tested on Linux, but CW 20.7.81 on my mac does not truncate the same binaries that windows 2012R2 and 2016 RTM do.
Steps to Reproduce:
On a fresh Windows Server 2016 RTM or 2012R2 system:
- Install Chef Workstation
- Create a new cookbook (I used test_cookbook) in your chef-repo cookbooks folder
- add a files directory in your cookbook
- copy a .exe file into the files directory (I tried with C:\opscode\chef-workstation\bin\chef.exe and C:\Program Files(x86)\Google\Chrome\Application\chrome.exe)
- run
chef install Policyfile.rb - run
chef export -a Policyfile.rb ..\to export the policy to your cookbooks folder - use 7-zip to unpack the .tgz file
- navigate into the cookbook_artifacts\test_cookbook\files directory
- look at the file sizes of the .exe files after extraction
Expected Result:
File sizes should match the original size (chef.exe = ~2,406KB and chrome.exe = ~1,757KB, and the app that originally started this - LGPO.exe is about 410KB)
Actual Result:
File sizes were truncated:
chef.exe = ~3KB
chrome.exe = ~1KB
LGPO.exe = ~5KB
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue on Windows using chef install Policyfile.rb followed by chef export -a Policyfile.rb ..\, then inspect the export path responsible for packaging cookbook files. Compare the extracted .exe size with the source file and verify that binary files retain their original contents and sizes in the generated .tgz archive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100