.tgz not extracting properly

4

I've just received some files file(s).tgz... I've tried tar -xvzf file.tgz... However I'm getting error "Attempt to write to an empty file"... Am I missing something... The folder directory system has been made but all the directories are empty...

Thanks.

Simon

Posted 2010-02-21T18:02:15.307

Reputation: 153

I cannot find the string "Attempt to write to an empty file" in the source code for tar or gzip. Is that the exact error message, or are you rephrasing? – Jacob – 2010-02-21T18:14:32.927

Exact message... I'm on MacOX... bsdtar 2.6.2 - libarchive 2.6.2 – None – 2010-02-21T18:16:24.513

Answers

11

A similar issue is encountered at http://code.google.com/p/libarchive/issues/detail?id=3

It looks like a bug in BSD tar, which is the default tar on FreeBSD, Mac OS X, and possibly other systems.

Easiest workaround is probably to extract with GNU tar. Just run "gnutar" instead of "tar" if you're on OS X. On FreeBSD you may need to install gnutar from ports.

Andrew

Posted 2010-02-21T18:02:15.307

Reputation:

I was using BSD tar... and I needed to use GNU tar.... On Mac OSX use "gnutar -xvzf"... Many thanks... – None – 2010-02-21T18:25:22.110

1Nice. On Mac OS X, I did the following:

brew install gnu-tar

Then just made sure my path was updated to include that tar first, then it works fine. – Wing Tang Wong – 2015-05-11T04:40:37.010

sudo ln -s /usr/local/opt/gnu-tar/libexec/gnubin/tar /usr/bin/gnutar – Rocky – 2016-12-27T04:24:59.337

3brew install gnu-tar then gtar zxvf ... worked for me. – timkofu – 2018-05-29T15:46:48.050