mikeryan / unuzip

decompress FreeBSD UZIP image files
MIT License
5 stars 3 forks source link

unuzip with Python 3.8.12 on FreeBSD #2

Open grahamperrin opened 2 years ago

grahamperrin commented 2 years ago

Hi, must I install Python 2 for unuzip to work here?

% pwd
/tmp/0.6.0
% /usr/home/grahamperrin/dev/unuzip/unuzip -v ./system.uzip system.ufs
env: python2: No such file or directory
% python /usr/home/grahamperrin/dev/unuzip/unuzip -v ./system.uzip system.ufs
  File "/usr/home/grahamperrin/dev/unuzip/unuzip", line 41
    print "Error: can't open input file: %s" % e
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Error: can't open input file: %s" % e)?
% cd /usr/home/grahamperrin/dev/unuzip
% python unuzip /tmp/0.6.0/system.uzip /tmp/0.6.0/system.ufs
  File "unuzip", line 41
    print "Error: can't open input file: %s" % e
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Error: can't open input file: %s" % e)?
% which python
/usr/local/bin/python
% python --version
Python 3.8.12
% pkg search python2
py38-dnspython2-2.1.0          DNS toolkit for Python - 2.X branch
python2-2_3                    Meta-port for the Python interpreter 2.7
python27-2.7.18_1              Interpreted object-oriented programming language
% pkg info -x python
py38-dnspython-1.16.0
py38-gitpython-3.1.24
py38-python-distutils-extra-2.45
py38-python-poppler-qt5-0.75.0_22
py38-wxPython40-4.0.7_2
python-3.8_3,2
python3-3_3
python37-3.7.12_1
python38-3.8.12_1
python39-3.9.7_1
% uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #112 main-n249988-2c614481fd5: Sun Oct 10 21:42:16 BST 2021     root@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG  amd64 1400036 1400036
% 
grahamperrin commented 2 years ago

The answer seems to be yes … unfortunately I seem to have problematic .uzip files:

% python2 /usr/home/grahamperrin/dev/unuzip/unuzip /tmp/0.6.0/system.uzip /tmp/0.6.0/system.ufs
Error: file is not UZIP
Decompressing /tmp/0.6.0/system.uzip to /tmp/0.6.0/system.ufs

Block size:        16384
Total blocks:     196608
Total size:   3221225472

  0%
Traceback (most recent call last):
  File "/usr/home/grahamperrin/dev/unuzip/unuzip", line 115, in <module>
    block_data = zlib.decompress(zlib_data)
zlib.error: Error -5 while decompressing data: incomplete or truncated stream
%

Context: https://github.com/helloSystem/hello/discussions/229#discussioncomment-1529104

grahamperrin commented 2 years ago

… I seem to have problematic .uzip files: …

From https://github.com/helloSystem/hello/discussions/229#discussioncomment-1565485, might this explain the error above?

… we don't really have an ISO9660 filesystem on that uzip, but zfs, and the embedded script can't handle that. …