Tar archive won't unpack – "Path contains '..'"
The name of the file 2014-12-12 04-00-01.tar
. I executed the command:
tar xvf 2014-12-12\ 04-00-01.tar
The output is many lines of the form:
x ../server/: Path contains '..'
And then a few of the form:
tar: copyfile unpack (../server/logs/.DS_Store) failed: No such file or directory
It seems that I wasn't very careful when I wrote the backup script. How can I unpack the file?
You'll want to add the P
(or -P
) flag to your command line. From the manpage:
-P Preserve pathnames. By default, absolute pathnames (those that begin with a / character have the leading slash removed both when creating archives and extracting from them. Also, tar will refuse to extract archive entries whose pathnames contain .. or whose target directory would be altered by a symlink. This option suppresses these behaviors.
Try tar Pxvf 2014-12-12\ 04-00-01.tar
. Note that you'll need write access to the parent directory of the working directory where you invoke the command.