Thursday, 27 October 2016

To unzip or not to unzip - Or the simplest solution is often the right solution

I was stressing as to why I couldn't expand a ZIP archive downloaded from IBM: -

-rw-r--r--  1 hayd  staff  1414823936 27 Oct 14:36 /Volumes/DaveHaySSD/Software/WAS9/Product/

which contains the WebSphere Application Server (WAS) Network Deployment V9.0 media.

This was what I was doing: -

unzip -d /tmp/WAS9

and this is what I was seeing: -

  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of or, and cannot find, period.

I saw this both on macOS Sierra and Red Hat Linux.

I checked the file type: -

file Zip archive data, at least v1.0 to extract

which looked OK.

I even tried Archive Utility: -

Can you guess what'd gone wrong ?

I'd downloaded the file on my MacBook Pro and then SCP'd it across my network to my Mac Mini.

At some point in the transition, the file got corrupted :-(

When I checked the file size on the original download: -

-rw-r--r--@    1 davidhay  staff  1633871835 27 Oct 14:27

it was rather different to the version on the Mac Mini: -

-rw-r--r--  1 hayd  staff  1414823936 27 Oct 14:36 /Volumes/DaveHaySSD/Software/WAS9/Product/

I checked this using the crc32 tool on the MacBook Pro, which returned: -


whereas crc32 on the Mac Mini returned: -


When I re-uploaded the file back to the Mini, it all looked OK: -

-rw-r--r--  1 hayd  staff  1633871835 27 Oct 15:06

and crc32 also looks good: -


and, more importantly, it expands without problems: -

unzip /Volumes/DaveHaySSD/Software/WAS9/Product/ 

Archive:  /Volumes/DaveHaySSD/Software/WAS9/Product/
   creating: Offerings/
   creating: atoc/
   creating: atoc/nq/

  inflating: readme/zh/TW/swg_info_common.css  
  inflating: readme/zh/TW/wasstyle_nlv.css  
  inflating: repository.config       
  inflating: repository.xml   

and, even better, installs OK :-)