ssokolow / makeself_safeextract

Experimental tool to extract makeself archives without running untrusted code
12 stars 2 forks source link

UnicodeDecodeError using Python 2.7 for makeself 2.1.5 package. #1

Open kamiccolo opened 8 years ago

kamiccolo commented 8 years ago

Input:

$ python2.7 ./makeself_safeextract.py ../DepthSenseSDK-1.9.0-5-amd64-deb.run

Error:

File "./makeself_safeextract.py", line 203, in <module>
main()
File "./makeself_safeextract.py", line 166, in main
offsets = get_offsets(path)
File "./makeself_safeextract.py", line 69, in get_offsets
if not accum_find(lexer, [b'-', b'-', b'tar'], limit=1024):
File "./makeself_safeextract.py", line 28, in accum_find
for token in lexer:
File "/usr/lib/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib/python2.7/shlex.py", line 153, in read_token
elif nextchar in self.quotes:
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 0: ordinal not in range(128)

Package info:

$ ./DepthSenseSDK-1.9.0-5-amd64-deb.run --info
Identification: DepthSenseSDK
Target directory: DepthSenseSDK-1.9.0-5-amd64
Uncompressed size: 7168 KB
Compression: gzip
Date of packaging: Fri Sep 18 00:17:33 CEST 2015
Built with Makeself version 2.1.5-dssdk1.0.0 on
Build command was:     /mnt/ssd/CI/workspaces/workspace/DSSDK_package_ubuntu64_hg/Installer/../Tools/Packaging/makeself/makeself \
"--notemp" \
"--header" \
    "/mnt/ssd/CI/workspaces/workspace/DSSDK_package_ubuntu64_hg/Installer/../Tools/Packaging/makeself/makeself-header" \
"DepthSenseSDK-1.9.0-5-amd64" \
    "/mnt/ssd/CI/workspaces/workspace/DSSDK_package_ubuntu64_hg/build/_packages/DepthSenseSDK-1.9.0-5-amd64-deb.run" \
"DepthSenseSDK" \
"./install.sh" \
"DepthSenseSDK-1.9.0-5-amd64.deb"
Script run after extraction:
     ./install.sh DepthSenseSDK-1.9.0-5-amd64.deb
directory DepthSenseSDK-1.9.0-5-amd64 is permanent
ssokolow commented 8 years ago

Ugh. I thought I'd squashed all of those "This bit of the standard library doesn't say whether it takes bytes, unicode, or either" errors that showed up when I decided to support both Python 2 and Python 3.

kamiccolo commented 8 years ago

Decreasing limit (to actual script size) hits another fan...

Change:

if not accum_find(lexer, [b'-', b'-', b'tar'], limit=380):

Error:

$ python2 ./makeself_safeextract.py -v ../DepthSenseSDK-1.9.0-5-amd64-deb.run 
Traceback (most recent call last):
File "./makeself_safeextract.py", line 203, in <module>
main()
File "./makeself_safeextract.py", line 166, in main
offsets = get_offsets(path)
File "./makeself_safeextract.py", line 70, in get_offsets
raise ValueError("Could not find definition of --tar")
ValueError: Could not find definition of --tar

But... that's probably deserve another bug report :P

ssokolow commented 8 years ago

@kamiccolo Definitely. That one sounds like it's probably a case of "generated using a version of makeself which produces results that are confusingly different".

When you open another bug, please also answer "What version of makeself does the comment header say it was generated with?"

ssokolow commented 8 years ago

For the record, I haven't forgotten about you. I've just had my time completely dominated by my degree project. I'll start unwinding the backlogged tasks in May.

kamiccolo commented 8 years ago

Mhm. I was trying to write couple of tests which would iterate through different versions of Makeself. But apparently their release/version naming is such a mess >_< Blargh. Basically, picking commit hashes from the log by hand.