libarchive error code -30 opening a tarball: Unrecognized archive format

43 Views Asked by At

I have a file resolving service that needs to extract and read .tgz files. I'm using libarchive to do this. This is working for almost all of the tarballs I have, but with one of them, I get

 error code: -30 Unrecognized archive format.

I have enabled all filters and formats:

  archive_read_support_filter_all(archive.get());
  archive_read_support_format_all(archive.get());
  int archive_open_error = archive_read_open_filename(
      archive.get(), std::string(archive_file_path).c_str(),
      /*block_size=*/1024);

If I run file on it, I get

gzip compressed data, original size modulo 2^32 48102400

if I run tar -xf on it, it extracts fine.

Any advice on how to proceed here? I could extract and rebuild the tarball presumably, but I'd love to get libarchive to handle this correctly so it'd be future proof for similar tarballs I get in the future (they come from npm fwiw).

Thanks!

0

There are 0 best solutions below