As a BI-Solution developer, every now and then there comes a time to bring out the serious tools. When dealing with report files, you may find that you need to peek inside the ZIP structure, to trace down an error, or to simply look at some of its metadata quickly.
But unzipping manually is tedious. Luckily, on every Linux system (and on Cygwin), the Midnight Commander makes file operations on the console a lot easier. The MC treats ZIP files as a virtual file system, and allows you to browse them like subdirectories and makes it possible to add, edit or remove files from these archives easily.
The only problem is: It only works if the Midnight Commander recognizes the file as a ZIP file. And sadly, for PRPTs it does not.
Internally the Midnight Commander relies on the ‘file’ command, which relies on the ‘magic’ database to check files against known signatures. So lets teach MC how to play nice with PRPTs.
Create a $HOME/.magic file with your favourite text editor, and add the following content:
# ZIP archives (Greg Roelofs, c/o email@example.com)
0 string PK\003\004
>30 ubelong !0x6d696d65
>>4 byte 0x00 Zip archive data
>>4 byte 0x09 Zip archive data, at least v0.9 to extract
>>4 byte 0x0a Zip archive data, at least v1.0 to extract
>>4 byte 0x0b Zip archive data, at least v1.1 to extract
>>0x161 string WINZIP Zip archive data, WinZIP self-extracting
>>4 byte 0x14 Zip archive data, at least v2.0 to extract
>30 string mimetype
>>50 string vnd.pentaho. Zip archive data, Pentaho Reporting
Then all you need to do is compile the file, and you are ready to go:
file -C -m $HOME/.magic
This creates a $HOME/.magic.mgc file, which contains the compiled magic code.
Test it via
and if it says, “Zip archive data, Pentaho Reporting” your system has learned how to treat PRPTs as ZIPs.