I was trying to set up a script to download and untar some sources in a build script, but for some maddening reason tar seems to have gone insane, where it constantly attempts to do something with some long-gone folder.

Initially I was attempting to

curl -L http://www.example.com/tehcodez.tar.gz | tar -C assets -xz

And I got a confusing error...so I stripped it way down to tar x (which shouldn't really do anything, but at least not die like it does), I get the truly inexplicable error:

$ tar x
tar: ~/Projects/Tape-Worms/: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

...Tape-Worms is some old project I was working on (and the folder no longer exists), and I have no idea how tar is a) pulling that path out of thin air, then b) choking on it. It doesn't matter what folder I'm in, /, ~, I get the exact same error.


tar apparently uses the variable TAPE as a default file path, and I had it set to the offending ~/Projects/Tape-Worms/ in my .bashrc for a shortcut. Naturally.

     The behavior of tar is controlled by the following environment variables, among 

     TAPE    Device or file to use for the archive if --file is not specified.  If 
             this environment variable is unset, use stdin or stdout instead.


$ unset TAPE
$ tar x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.