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/WAS_ND_V9.0_MP_ML.zip

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

This was what I was doing: -

unzip WAS_ND_V9.0_MP_ML.zip -d /tmp/WAS9

and this is what I was seeing: -

Archive:  WAS_ND_V9.0_MP_ML.zip
  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 WAS_ND_V9.0_MP_ML.zip or
        WAS_ND_V9.0_MP_ML.zip.zip, and cannot find WAS_ND_V9.0_MP_ML.zip.ZIP, period.


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

I checked the file type: -

file WAS_ND_V9.0_MP_ML.zip 

WAS_ND_V9.0_MP_ML.zip: 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 WAS_ND_V9.0_MP_ML.zip

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/WAS_ND_V9.0_MP_ML.zip

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

3413d26e

whereas crc32 on the Mac Mini returned: -

3d68b57d

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 WAS_ND_V9.0_MP_ML.zip

and crc32 also looks good: -

3413d26e

and, more importantly, it expands without problems: -

unzip /Volumes/DaveHaySSD/Software/WAS9/Product/WAS_ND_V9.0_MP_ML.zip 

Archive:  /Volumes/DaveHaySSD/Software/WAS9/Product/WAS_ND_V9.0_MP_ML.zip
   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 :-)

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...