saltstack / saltstack/salt

[BUG] `archive.extracted` fails, when "source_hash" provides multiple matching filenames

Open
#62,554 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
When using archive.extracted and the provided source_hash file contains multiple matching filenames, where the correct match isn't the first one, it will fail: File is cached to [...], but the hash ([...]) does not match the specified hash ([...])

Setup

  • have salt-minion (3005, onedir) installed on Ubuntu 22.04 via repo.saltproject.io

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD

Steps to Reproduce the behavior

  • Execute:
    salt-call state.single archive.extracted name=/tmp/salt-3005/bin source=https://repo.saltproject.io/salt/onedir/3005-1/salt-3005-1-linux-amd64.tar.gz source_hash=https://repo.saltproject.io/salt/onedir/3005-1/salt-3005-1_SHA512 if_missing=/tmp/salt-3005/bin/salt enforce_toplevel=False
    

Expected behavior
I expect archive.extracted to work as expected:

  • verify the checksum (which is listed in the specified source_hash, but just not as the 1st line containing the corresponding filename)
  • extract the archive content

Output

local:
----------
          ID: /tmp/salt-3005/bin
    Function: archive.extracted
      Result: False
     Comment: File is cached to /var/cache/salt/minion/extrn_files/base/repo.saltproject.io/salt/onedir/3005-1/salt-3005-1-linux-amd64.tar.gz, but the hash (f6e50081afea69ce74686cb4e9dc289fbfa1c47907ccc6f619e2ad3330f652a0d3e7cb3a1f305fe1eaab2161c3cf1e85a9bc92b4698944439d32f72bfdd57cd3) does not match the specified hash (6f0abd531fd20f4abe08df38ce9c3af536bbcf99f06360e24bc44cb1ab4a004747d32f9cfa252e884387620c8c0cfc1d345fb097c88d5b5007c75e0605eca360)
     Started: 07:16:24.795874
    Duration: 2659.067 ms
     Changes:

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   2.659 s

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3005

Dependency Versions:
          cffi: 1.15.0
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: 5.0.3
         gitdb: 4.0.9
     gitpython: 3.1.24
        Jinja2: 3.0.3
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: 1.1.3
       msgpack: 1.0.3
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.11.0
        pygit2: Not Installed
        Python: 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 22.3.0
         smmap: 5.0.0
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: ubuntu 22.04 Jammy Jellyfish
        locale: utf-8
       machine: x86_64
       release: 5.15.0-41-generic
        system: Linux
       version: Ubuntu 22.04 Jammy Jellyfish

Additional context
Add any other context about the problem here.

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

Start with the reported salt-call state.single archive.extracted command and trace the archive.extracted handling of the supplied source_hash file. Reproduce the failure with the listed Salt 3005 and Ubuntu 22.04 setup; done means a matching checksum on a later filename is accepted and the archive is extracted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.