linux.zipをunzipで解凍しようとしたらエラーが発生したときの対処メモ。
エラー内容
unzip linux.zip
とした場合にsymlinkの解凍時にエラーが発生した。
以下のIssueが同様のエラーなので引用する。
unzip tarball fail on symlink error: File name too long · Issue #34 · raspberrypi/linux:
$ unzip raspberrypi-linux-b683e89.zip
finishing deferred symbolic links:
raspberrypi-linux-b683e89/arch/microblaze/boot/dts/system.dts -> ../../platform/generic/system.dts
raspberrypi-linux-b683e89/drivers/scsi/aacraid/linit.c -> /^J *^IAdaptec AAC series RAID controller driver^J *^I(c) Copyright 2001 Red Hat Inc.^J *^J * based on the old aacraid driver that is..^J * Adaptec aacraid device driver for Linux.^J *^J * Copyright (c) 2000-2010 Adaptec, Inc.^J * 2010 PMC-Sierra, Inc.
~ 中略 ~
Adaptec NEMER/ARK Catch All /^J^I{ aac_src_init, "aacraid", "ADAPTEC ", "RAID ", 2 } / Adaptec PMC Catch All /^J};^J^J/^J *^Iaac_queuecommand^I-^Iqueue a SCSI command^J *^I@cmd:^I^ISCSI command to queue^J *^I@done:^I^IFunction to call on command completion^J *^J *^IQueues a command for execution by the associated Host Adapter.^J *^J *^ITODO: unify with aac_scsi_cmd().^J */^J^Jstatic int aac_queuecommand_lck(struct scsi_cmnd *cmd, void (done)(struct scsi_cmnd *)...
symlink error: File name too long
symlink の LINK_NAME がファイルの内容になってしまっている。
Issueの中のコメントでもあるが、どうやらunzipの古いバージョン特有のバグらしい。
git - "git archive" seems to be broken wrt zip files:
上のリンク先でunzipにバグが有ることが言及されている。
unzipのバージョン
$ unzip --version
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
少なくとも ubuntu 12.04 や fedora17 以下では再現すると思われる。
対処法
(※あくまでもzipで解凍が必要な場合の対処法。tar.gz等があるならそちらを使えば良い。)
7zipを使う(古いunzip特有のバグのため、unzip以外なら問題ない)
インストール
# yum
sudo yum install p7zip
# apt
sudo apt-get install p7zip-full
解凍
7za x linux.zip
参考
unzip tarball fail on symlink error: File name too long · Issue #34 · raspberrypi/linux:
git - "git archive" seems to be broken wrt zip files: