salt icon indicating copy to clipboard operation
salt copied to clipboard

archive.extracted fails when archive includes files with non-ascii names with 2018.3.0

Open ender8282 opened this issue 8 years ago • 3 comments

Description of Issue/Question

I have a .tgz archive which fails to extract. I believe that it is due to a non-ascii character in the name of one of the files. I believe that this is a regression because the state functioned properly when using 2017.7.4 but now fails with 2018.3.0.

In searching for help with this issue I found a few issues that appeared related but none of those issues specifically dealt with archive.extracted.

Setup

ibm-java:
  archive.extracted:
    - name: /opt/java
    - source: salt://roles/csf_app_host/ibm-jvm.tgz
    - archive_format: tar
    - if_missing: /opt/java/ibm-java-80

I believe the problematic file is: ibm-java-80/_uninstall/Logs/IBM®_64-bit_SDK_for_Linux®,_v8.0_Install_01_06_2016_09_55_41.log

The error is:

----------
          ID: ibm-java
    Function: archive.extracted
        Name: /opt/java
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/site-packages/salt/state.py", line 1878, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1823, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/site-packages/salt/states/archive.py", line 1013, in extracted
                  verbose=True)
                File "/usr/lib/python2.7/site-packages/salt/modules/archive.py", line 419, in list_
                  if x.count('/') == 0]
              UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 31: ordinal not in range(128)
     Started: 11:45:42.568472
    Duration: 3533.573 ms
     Changes:

Versions Report

Salt Version:
           Salt: 2018.3.0

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.1
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Aug  4 2017, 00:39:18)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.4.1708 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-693.21.1.el7.x86_64
         system: Linux
        version: CentOS Linux 7.4.1708 Core

ender8282 avatar May 08 '18 17:05 ender8282

Reopening for some additional fixes.

garethgreenaway avatar Jun 06 '18 03:06 garethgreenaway

Still experiencing this bug in salt 2019.2, issue should be reopened. The state still fails if using use_cmd_unzip=True, but exec module archive.cmd_unzip works fine. Looks like the state fails because it tries to call archive.list. I'm using if_missing and skip_verify for archive.extracted

kriberg avatar Mar 14 '19 09:03 kriberg

May be related to this issue: https://github.com/saltstack/salt/issues/44184

There are some problems with the built-in module zipfile on Python 2. Are you having these problems on 2019.2.0 Py2 or Py3? If you're on Py2, does the problem persist when using the Py3 version of salt instead?

twangboy avatar Mar 14 '19 17:03 twangboy