How to recover from a tarbomb incident, and why not to do it

Tarbombs are irritating. I just experienced a minor one downloading the project.net version 9 beta 1 tarball. My working directory was filled with install scripts and a file called “ping.html” that I was fairly sure I didn’t care about.

There’s an easy way to fix it using xargs, that I found via google on Toolbox for IT, a new site for me.

All you do is ask tar to list the contents of the tarball and use xargs to delete those files. Look how easy it seems:

$ tar ztf project_net_installer_linux90b1.tar.gz | xargs rm -rf

HOWEVER. The first entry in this particular tarball is ‘./‘. So the first thing running that script did was to delete everything in my working directory (and tell me that it couldn’t delete the working directory itself). Awesome.

Nothing of value was lost, though I did have to redownload the tarball. And this is nowhere near as elegant, but to save youself from this one could try

$ tar ztf project_net_installer_linux90b1.tar.gz | egrep -v '^./$' | xargs rm -rf

It worked for me.

Advertisement

Post a Comment

Required fields are marked *

*
*

Follow

Get every new post delivered to your Inbox.