hexpm / hex_core

Reference implementation of Hex specifications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not crash when unpacking empty packages

wojtekmach opened this issue · comments

E.g.:

mix hex.package fetch loki 0.1.0 --unpack
** (MatchError) no match of right hand side value: {:error, :enoent}
    (hex 0.20.1) src/mix_hex_tarball.erl:220: :mix_hex_tarball.copy_metadata_config/2
    (hex 0.20.1) src/mix_hex_tarball.erl:209: :mix_hex_tarball.finish_unpack/1
    (hex 0.20.1) lib/hex.ex:183: Hex.unpack_tar!/2
    (hex 0.20.1) lib/mix/tasks/hex.package.ex:114: Mix.Tasks.Hex.Package.fetch/4
    (mix 1.10.0-dev) lib/mix/task.ex:330: Mix.Task.run_task/3
    (mix 1.10.0-dev) lib/mix/cli.ex:83: Mix.CLI.run_task/2
 mix hex.package fetch xclient 0.5.0-vendored-xhttp --unpack
** (Mix) Unpacking tarball failed: inner tarball error, no such file or directory

The packages are broken but hex_core should gracefully handle that.