dtrx-py / dtrx

Do The Right Extraction
GNU General Public License v3.0
224 stars 10 forks source link

Crash with file not found even though the file does exist #24

Closed Docteur-RS closed 2 years ago

Docteur-RS commented 2 years ago

Using dtrx with any (or no) options crashes with the following stacktrace:

dtrx hello.zip
Traceback (most recent call last):
  File "/usr/local/bin/dtrx", line 1404, in <module>
    sys.exit(app.run())
  File "/usr/local/bin/dtrx", line 1388, in run
    self.try_extractors(filename,
  File "/usr/local/bin/dtrx", line 1335, in try_extractors
    for extractor in builder:
  File "/usr/local/bin/dtrx", line 1054, in get_extractor
    getattr(self, 'try_by_' + func_name)(self.filename)
  File "/usr/local/bin/dtrx", line 1081, in try_by_magic
    process = subprocess.Popen(['file', '-zL', filename],
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'file'
~# command terminated with exit code 137

The file exist and can even be uncompressed using unzip.

Using dtrx-noahp-7.1.2

Docteur-RS commented 2 years ago

Seems to be OS related.

I was using this docker image for python :

FROM python:3.10-slim-buster

It resulted in the above stacktrace.

I ended up using this docker image:

FROM python:3.9-alpine3.13

It's working...

noahp commented 2 years ago

Ah yes, dtrx will use the file program when detecting the archive type, so if that's not installed on the host it will fail there. We could definitely do better, two things come to mind-

I'll update here if I make those improvements.

Thanks for reporting this issue!