chef / chef/chef-cli

`chef export -a` truncates binary files when running from windows

Open
#110 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Aspect: Stability Triage: Confirmed Triage: Needs Information Type: Bug
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:

  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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.