Produced GNU Sparse File (aka 'GNUSparseFile.0') instead of unpacked .tar.gz
chshersh opened this issue · comments
Dmitrii Kovanikov commented
I'm using flate2
in my Cargo.toml
like this:
flate2 = "1.0"
When I'm trying to unpack tokei-x86_64-apple-darwin.tar.gz using the following code:
fn unpack_tar(tar_path: &PathBuf, tmp_dir: &Path) -> Result<(), std::io::Error> {
let tar_file = File::open(tar_path)?;
let tar_decoder = GzDecoder::new(tar_file);
let mut archive = tar::Archive::new(tar_decoder);
archive.unpack(tmp_dir)
}
I see that the unpacking result produces the GNUSparseFile.0
directory:
$ exa --tree
.
├── GNUSparseFile.0
│ └── tokei
└── tokei-x86_64-apple-darwin.tar.gz
I'm not sure if the file actually valid (since I'm on Ubuntu 20.04 and the archive contents a macOS executable so I can't run it). But is this expected and can/should it be fixed?
Dmitrii Kovanikov commented
Seems to be an issue in the tar
crate:
Closing in favour of the issue in another repository. But maybe it'll help somebody to discover it 😌