Why is this archive failing to create symlinks?

4

When I extract the archive Symfony_Standard_2.2.1.tgz using this command:

$ tar xzf /home/tomas/downloads/Symfony_Standard_2.2.1.tgz

I always get the errors:

tar: doctrine.php: Cannot create symlink to `../vendor/doctrine/orm/bin/doctrine.php': Operation not supported
tar: doctrine: Cannot create symlink to `../vendor/doctrine/orm/bin/doctrine': Operation not supported
tar: Exiting with failure status due to previous errors

Why is it failing to create the symlinks?


$ tar --version
tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 6.0.7 (squeeze)
Release:        6.0.7
Codename:       squeeze

Hubro

Posted 2013-04-17T16:20:04.783

Reputation: 4 846

6To which filesystem are you extracting? I'm guessing it's one that doesn't support symlinks? Like FAT – BloodPhilia – 2013-04-17T16:29:46.640

Answers

6

BloodPhilia's comment said it all. I didn't consider the fact that I'm working on a VMware shared folder from a Windows machine with NTFS partitions. Extracting the archive anywhere on the virtual machine works fine.

Hubro

Posted 2013-04-17T16:20:04.783

Reputation: 4 846

0

I'm coming a bit late to this party, but had the same problem yesterday. If the filesystem does not support symlinks and you despite want all the contents from the archive to be accessible, it might be a workaround to copy those files (which should be symlinked).

The archive I wanted to extract had 20+ symlinks, so I decided to generate the cpcommands by a script. I just need to provide the stderr output of tar (via a file by tar ... 2> /tmp/tar-stderr.txt) and the target folder. I decided to not yet execute the cp commands, but pipe them to a file which I can check before I chmod +x and execute it. Feel free to improve the script, pipe tar directly to it (e.g. by exchanging stdout/stderr), use somehow tee to provide the ignored messages of tar...

#!/bin/sh
(export DIR=/your/extraction/target/directory; echo \#\!/bin/sh -e; cat /tmp/tar-stderr.txt | grep 'Cannot create symlink to' | sed -e 's7^tar: \.\([^:]\+\): Cannot create symlink to .\([^:]\+\).*$7\1:\27' -e "s7^\(.\+\)/\([^:]\+\):\(.\+\).\$7cd $DIR\1 \&\& cp \3 \2;7")

EDIT: Explanation of script added:

The grep filters the lines of interest. My sed commands are simple, but use 7 as field delimiter instead of the common /. With this I can search for and/or write /.

The first sed expression filters the relevant information (relative path and the 2 filenames) and puts a : as delimiter. The second distinguishes filename from path and throws away the ' at the very end; the final output then is a cp command.

tueftl

Posted 2013-04-17T16:20:04.783

Reputation: 101