chef / chef/chef-cli

The same version of a cookbook generates different identifier and dotted_decimal_identifier depending on Operating System

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

Nobody has claimed this yet.

Status: Untriaged Type: Bug
Dominant language
Ruby
Stars
18
Forks
23
Avg merge
5d 17h
Merged PRs (30d)
1

Description

Version:

Chef Workstation version: 24.8.1068
Chef Infra Client version: 18.5.0
Chef InSpec version: 5.22.55
Chef CLI version: 5.6.14
Chef Habitat version: 1.6.1041
Test Kitchen version: 3.6.0
Cookstyle version: 7.32.8

Environment:

macOS & Ubuntu Linux

Scenario:

When a cookbook artifact has resource fork files (start with ._) the policies generated using these cookbooks differ based on the OS of the system generating them.

e.g. When a mac decompresses these files they are integrated into the filesystem, but when a Linux or Windows system decompresses them, they are left in the repo, and read for the sha

Steps to Reproduce:

  1. Create a policyfile that pulls https://supermarket.chef.io/cookbooks/dnsimple version 4.5.0
  2. chef install and chef update the on a Mac
  3. chef install and chef update on a Linux machine

Expected Result:

Expected the two policies to match exactly

Actual Result:

on a mac the policyfile.lock.json contains

    "dnsimple": {
      "version": "4.5.0",
      "identifier": "5ceaa29f4901161970750f5f71c83b5a239a4951",
      "dotted_decimal_identifier": "26153682035343638.7160522489164232.65258330409297",
      "cache_key": "dnsimple-4.5.0-supermarket.chef.io",
      "origin": "https://supermarket.chef.io:443/api/v1/cookbooks/dnsimple/versions/4.5.0/download",
      "source_options": {
        "artifactserver": "https://supermarket.chef.io:443/api/v1/cookbooks/dnsimple/versions/4.5.0/download",
        "version": "4.5.0"
      }
    },

on that system the cached cookbook looks like this

> cd ~/.chef-workstation/cache/cookbooks/dnsimple-4.5.0-supermarket.chef.io && find . | xargs shasum -a 1 | sort -k2
shasum: .: Is a directory
shasum: ./recipes: Is a directory
shasum: ./libraries: Is a directory
28ca784b82210f97d7bab4be123fc4ec86fd34f5  ./CHANGELOG.md
17d954e8a17b9105a9c48073ab19086e1dedf16b  ./chefignore
c387b3c83b36c75e2968ffa37a167c1791f5e8f6  ./.github_changelog_generator
ae43286ed356fb6e24080e2a80317bee4389f449  ./libraries/dnsimple_provider.rb
e426baa7640db42d51559242687c8beb60018cc7  ./libraries/dnsimple_resource.rb
263d74b08ca00e26e49bc7d15ee74dcc7b7f451b  ./libraries/provider_dnsimple_certificate.rb
3cb1637aa04bdf961caf2cc41c2e71da3ba2149a  ./libraries/provider_dnsimple_record.rb
a5e7b5de7d091fde3490edd0acaec679903f53be  ./libraries/resource_dnsimple_certificate.rb
26e25e0083e6f6a6f7b64cddf1ddd07c431b080f  ./libraries/resource_dnsimple_record.rb
43d5983e020268cd094339feb9314e9b5b47642c  ./LICENSE
3f796ca2ad89c094d80337c2d87f66794844eb36  ./.markdownlint.yaml
ee587623e295b67a8b8ac04e8e27478ddc1200e8  ./metadata.json
0d07e8fe99af3942803ebf9521e588fcfb26f70e  ./metadata.rb
cbe7595cff21e81c4fc49cdc6435728782c45c7e  ./README.md
12c89c2e34a598eec1af6c8ee10235e9873c8683  ./recipes/default.rb
605186cdff069ff9a4a1fb0a94a07b5e817947ab  ./RELEASE.md
e75aa4facce6a89a0fae5f1917a0699b3c94155e  ./.rubocop_todo.yml

on a linux system the policy contains

    "dnsimple": {
      "version": "4.5.0",
      "identifier": "f8be033c209aca01ecee072b339f18a58792def3",
      "dotted_decimal_identifier": "70014715327191754.541982043354015.27099223219955",
      "cache_key": "dnsimple-4.5.0-supermarket.chef.io",
      "origin": "https://supermarket.chef.io:443/api/v1/cookbooks/dnsimple/versions/4.5.0/download",
      "source_options": {
        "artifactserver": "https://supermarket.chef.io:443/api/v1/cookbooks/dnsimple/versions/4.5.0/download",
        "version": "4.5.0"
      }
    },

on linux the cached cookbook looks like this

> cd ~/.chef-workstation/cache/cookbooks/dnsimple-4.5.0-supermarket.chef.io && find . | xargs shasum -a 1 | sort -k2
shasum: .: Is a directory
shasum: ./recipes: Is a directory
shasum: ./libraries: Is a directory
28ca784b82210f97d7bab4be123fc4ec86fd34f5  ./CHANGELOG.md
038469698f62041b84f41c045e93264cdd94eeda  ./._chefignore
17d954e8a17b9105a9c48073ab19086e1dedf16b  ./chefignore
038469698f62041b84f41c045e93264cdd94eeda  ./._.github_changelog_generator
c387b3c83b36c75e2968ffa37a167c1791f5e8f6  ./.github_changelog_generator
ae43286ed356fb6e24080e2a80317bee4389f449  ./libraries/dnsimple_provider.rb
e426baa7640db42d51559242687c8beb60018cc7  ./libraries/dnsimple_resource.rb
263d74b08ca00e26e49bc7d15ee74dcc7b7f451b  ./libraries/provider_dnsimple_certificate.rb
3cb1637aa04bdf961caf2cc41c2e71da3ba2149a  ./libraries/provider_dnsimple_record.rb
a5e7b5de7d091fde3490edd0acaec679903f53be  ./libraries/resource_dnsimple_certificate.rb
26e25e0083e6f6a6f7b64cddf1ddd07c431b080f  ./libraries/resource_dnsimple_record.rb
038469698f62041b84f41c045e93264cdd94eeda  ./._LICENSE
43d5983e020268cd094339feb9314e9b5b47642c  ./LICENSE
3f796ca2ad89c094d80337c2d87f66794844eb36  ./.markdownlint.yaml
ee587623e295b67a8b8ac04e8e27478ddc1200e8  ./metadata.json
0d07e8fe99af3942803ebf9521e588fcfb26f70e  ./metadata.rb
cbe7595cff21e81c4fc49cdc6435728782c45c7e  ./README.md
12c89c2e34a598eec1af6c8ee10235e9873c8683  ./recipes/default.rb
605186cdff069ff9a4a1fb0a94a07b5e817947ab  ./RELEASE.md
e75aa4facce6a89a0fae5f1917a0699b3c94155e  ./.rubocop_todo.yml

the additional ._ files seem to be the cause

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 mismatch by running chef install and chef update for the dnsimple 4.5.0 cookbook on macOS and Linux, then compare the cached cookbook contents and generated policyfile.lock.json. Investigate how ._ resource-fork files are included in the cookbook hash; done means both systems generate identical identifiers and dotted decimal identifiers.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
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.