saltstack / saltstack/salt

[BUG] SPM fails installing formula that has binary files in it

Open
#59,014 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
SPM package containing a binary file fails to install

Setup
Amazon Linux 2 4.14.193-149.317.amzn2.x86_64
salt-api-3001.3-1.amzn2.noarch
salt-minion-3001.3-1.amzn2.noarch
salt-3001.3-1.amzn2.noarch
salt-master-3001.3-1.amzn2.noarch

Steps to Reproduce the behavior

cat > FORMULA <<EOF
name: SPM_TEST
os: Amazon
os_family: RedHat
version: 0.1
release: 1
summary: Testing SPM with binary files
description: Testing SPM with binary files
top_level_dir: spm-test
EOF

mkdir spm-test
dd if=/dev/urandom of=spm-test/spm-test.bin bs=1 count=1024
echo "# test" > spm-test/spm-test.sls

Build SPM and try to install it

spm build spm-test
spm local install -f -y /srv/spm_build/SPM_TEST-0.1-1.spm

This fails with

[ERROR   ] An un-handled exception was caught by salt's global exception handler:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9b in position 4: invalid start byte
Traceback (most recent call last):
  File "/bin/spm", line 11, in <module>
    load_entry_point('salt==3001.3', 'console_scripts', 'spm')()

Expected behavior

Remove binary file, build SPM and install works correct

rm -f spm-test/spm-test.bin
spm build spm-test
spm local install -f -y /srv/spm_build/SPM_TEST-0.1-1.spm

Screenshots
n/a

Versions Report

Salt Version:
           Salt: 3001.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: unknown
       dateutil: 2.8.1
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: Not Installed
   pycryptodome: 3.6.1
         pygit2: Not Installed
         Python: 3.7.9 (default, Aug 27 2020, 21:59:41)
   python-gnupg: Not Installed
         PyYAML: 4.2
          PyZMQ: 17.0.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.3

System Versions:
           dist: amzn 2
         locale: UTF-8
        machine: x86_64
        release: 4.14.193-149.317.amzn2.x86_64
         system: Linux
        version: Amazon Linux 2

Additional context
n/a

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 failure using the shown FORMULA, spm-test/spm-test.bin, and the spm build and spm local install commands, starting at the /bin/spm entry point and following the SPM build/install path. Trace where the binary content is decoded, then verify that an SPM containing the generated binary installs successfully without the UnicodeDecodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.