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

chef export -a truncates binary files when running from windows #110

Open
chef-davin opened this issue Jul 9, 2020 · 1 comment
Open
Labels
Aspect: Stability Consistent results. Triage: Confirmed Indicates and issue has been confirmed as described. Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Bug Does not work as expected.

Comments

@chef-davin
Copy link

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:

  1. Install Chef Workstation
  2. Create a new cookbook (I used test_cookbook) in your chef-repo cookbooks folder
  3. add a files directory in your cookbook
  4. 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)
  5. run chef install Policyfile.rb
  6. run chef export -a Policyfile.rb ..\ to export the policy to your cookbooks folder
  7. use 7-zip to unpack the .tgz file
  8. navigate into the cookbook_artifacts\test_cookbook\files directory
  9. 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

@chef-davin chef-davin added Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected. labels Jul 9, 2020
@tyler-ball
Copy link
Contributor

This is tingling some old memories in my brain, but I think it might be related to chef/chef-workstation#529

I know we have experienced an issue similar to this in the past. Triaging this issue for now and leaving myself a note for later: check in the Chef Infra Client repo for something similar to this. Some kind of issue with zipping/unzipping on Windows...

@tyler-ball tyler-ball added Aspect: Stability Consistent results. Triage: Needs Information Indicates an issue needs more information in order to work on it. Triage: Confirmed Indicates and issue has been confirmed as described. and removed Status: Untriaged An issue that has yet to be triaged. labels Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aspect: Stability Consistent results. Triage: Confirmed Indicates and issue has been confirmed as described. Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

2 participants