zipdetails
zipdetails copied to clipboard
Undefined opt_EncodingFrom is dereferenced when perl-encoding is not installed
When the perl encoding library isn't installed, for some of my zip files, if I run zipdetails -vv <file>
, it fails with:
❯ zipdetails -vv <file>
00000000 00000003 00000004 50 4B 03 04 LOCAL HEADER #1 04034B50 (67324752)
00000004 00000004 00000001 14 Extract Zip Spec 14 (20) '2.0'
00000005 00000005 00000001 00 Extract OS 00 (0) 'MS-DOS'
00000006 00000007 00000002 08 00 General Purpose Flag 0008 (8)
[Bit 3] 1 'Streamed'
00000008 00000009 00000002 00 00 Compression Method 0000 (0) 'Stored'
0000000A 0000000D 00000004 00 00 21 00 Modification Time 00210000 (2162688) 'Mon Dec 31 19:00:00 1979'
0000000E 00000011 00000004 00 00 00 00 CRC 00000000 (0)
00000012 00000015 00000004 00 00 00 00 Compressed Size 00000000 (0)
00000016 00000019 00000004 00 00 00 00 Uncompressed Size 00000000 (0)
0000001A 0000001B 00000002 1C 00 Filename Length 001C (28)
0000001C 0000001D 00000002 00 00 Extra Length 0000 (0)
Can't call method "name" on an undefined value at /home/chenxiaolong/git/github/zipdetails/bin/zipdetails line 7110.
I did some debugging and it seems like the eval
in getNativeLocale
is eating the error. If I comment out the eval
, then I get:
Can't locate encoding.pm in @INC (you may need to install the encoding module) (@INC entries checked: /usr/local/lib64/perl5/5.38 /usr/local/share/perl5/5.38 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /home/chenxiaolong/git/github/zipdetails/bin/zipdetails line 6981.
It wasn't clear to me before that I had to install this library.
I'm unsure if the encoding library is meant to be an optional or required dependency. If it's a required dependency, is there a way to avoid suppressing the error (or alternatively, could the dependency be documented)?
Thanks!
(I'm using commit 66f376c946e4cbefe7b587461434b91476f8f2f9.)