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

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

Open
hsergei opened this issue Nov 23, 2020 · 2 comments · May be fixed by #66463
Open

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

hsergei opened this issue Nov 23, 2020 · 2 comments · May be fixed by #66463
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@hsergei
Copy link

hsergei commented Nov 23, 2020

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

@hsergei hsergei added the Bug broken, incorrect, or confusing behavior label Nov 23, 2020
@hsergei
Copy link
Author

hsergei commented Nov 24, 2020

I'm not sure if this is a correct "fix" or if this will break something else but replacing "r" with "rb" at https://github.com/saltstack/salt/blob/v3001.3/salt/spm/pkgfiles/local.py#L191 seem to help this particular case

@Ch3LL Ch3LL added severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around and removed needs-triage labels Dec 4, 2020
@Ch3LL Ch3LL added this to the Approved milestone Dec 4, 2020
@Ch3LL Ch3LL removed their assignment Dec 4, 2020
@Ch3LL
Copy link
Contributor

Ch3LL commented Dec 4, 2020

@hsergei that fix should work. Mind submitting a PR? When you do can you ensure there is test coverage for when using both a text and binary file to ensure it works with both cases?

@oogali oogali linked a pull request May 3, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants