2020-04-30
4/30
UbuntuでHomebrewで入れたtfenvだとtfenv installに失敗する
unzipで失敗する。
デバッグしたところ、Homebrewの依存でインストールされたunzipが使われてしまうからのようだ。
tfenvの libexec/helpers
内に which unzip
を仕込んで確かめた。
ログ:
% TFENV_DEBUG=true tfenv install 0.12.24
+ [tfenv:22] '[' -z '' ']'
++++ [tfenv:23] readlink_f /home/linuxbrew/.linuxbrew/bin/tfenv
:
(中略)
:
+ [tfenv-install:180] mkdir -p /home/linuxbrew/.linuxbrew/Cellar/tfenv/1.0.2/versions/0.12.24
+ [tfenv-install:181] unzip tfenv_download.DtVL3N/terraform_0.12.24_linux_amd64.zip -d /home/linuxbrew/.linuxbrew/Cellar/tfenv/1.0.2/version
s/0.12.24
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.
Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
Default action is to extract files in list, except those in xlist, to exdir;
file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage).
-p extract files to pipe, no messages -l list files (short format)
-f freshen existing files, create none -t test compressed archive data
-u update files, create if necessary -z display archive comment only
-v list verbosely/show version info -T timestamp archive to latest
-x exclude files that follow (in xlist) -d extract files into exdir
modifiers:
-n never overwrite existing files -q quiet mode (-qq => quieter)
-o overwrite files WITHOUT prompting -a auto-convert any text files
-j junk paths (do not make directories) -aa treat ALL files as text
-C match filenames case-insensitively -L make (some) names lowercase
-X restore UID/GID info -V retain VMS version numbers
-K keep setuid/setgid/tacky permissions -M pipe through "more" pager
See "unzip -hh" or unzip.txt for more help. Examples:
unzip data1 -x joe => extract all files except joe from zipfile data1.zip
unzip -p foo | more => send contents of foo.zip via pipe into program more
unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
+ [tfenv-install:181] error_and_die 'Tarball unzip failed'
++ [helpers:4] basename /home/linuxbrew/.linuxbrew/Cellar/tfenv/1.0.2/libexec/tfenv-install
+ [helpers:4] echo -e 'tfenv: tfenv-install: \033[0;31m[ERROR] Tarball unzip failed\033[0;39m'
tfenv: tfenv-install: [ERROR] Tarball unzip failed
+ [helpers:5] which unzip
/home/linuxbrew/.linuxbrew/bin/unzip
+ [helpers:6] exit 1
+ [helpers:1] rm -rf tfenv_download.DtVL3N
brew uninstall unzip --ignore-dependencies
した後、tfenv install 0.12.24
したら成功した。/home/linuxbrew/.linuxbrew/bin/unzip some.zip -d somedir
は同じエラーで失敗する。/usr/bin/unzip some.zip -d somedir
は成功する。
単独でunzipコマンドを実行しても失敗しているので、Linuxbrewのunzipが壊れてるんだと思う。
5/9 追記
これ、GCEにDebian 10とUbuntu 18.04とCent OS 8のVMを立てて追試したところ、全部linuxbrewのunzipが正常に動いた。
なぜだ。。
最終更新 2020-05-09: [memo] Add 20200509 (566a701c3)