tar with symbolic links
I could create a symbolic links by ln -s.
root@localhost:~# ls -l kkk
total 0
-rw-rw-rw- 1 root root 14 Apr 7 04:53 atest
lrwxrwxrwx 1 root root 5 Apr 7 04:54 btest -> atest
But I can't archive with the tar.
root@localhost:~# tar cvf kkk.tar kkk
kkk/
kkk/atest
tar: kkk/btest: Cannot readlink: Invalid argument
tar: Exiting with failure status due to previous errors
In reverse, the symbolic links in a tar file which built on Linux can't be extracted.
Related to #3 and/or #6 ?
The error messages are different.
In my case, ln -s is working, but not compatible with tar.
Here is the reverse operation output. ( extracting symlinks-containing tar whilch is built on real Linux )
root@localhost:~# tar tvf /mnt/c/temp/kkk.tar
drwxr-xr-x root/root 0 2016-04-07 05:25 kkk/
lrwxrwxrwx root/root 0 2016-04-07 05:25 kkk/btest -> atest
-rw-r--r-- root/root 12 2016-04-07 05:24 kkk/atest
root@localhost:~# tar xvf /mnt/c/temp/kkk.tar
kkk/
kkk/btest
tar: kkk/btest: Cannot create symlink to ‘atest’: Invalid argument
kkk/atest
tar: Exiting with failure status due to previous errors
I can echo this: I tried to install rvm from get.rvm.io and the script crashes and burns because of the tar symlink incompatibility.
I also can confirm this. (Running on 64-bit, on the off chance that matters). Can create symlinks just fine, cannot tar them or untar packages which contain them. As an interesting consequence, apt packages which contain symlinks (Java) also cannot be installed.
I was trying to copy files from a real linux box using tar. Also running into the symlink issue. As a workaround I was able to copy the files using bsdtar which creates symlinks correctly.
This is affecting http://nvm.sh installs via windows as well. https://github.com/creationix/nvm/issues/1054
This might relate to is #44 as well...for me anyway, the move won't work on tarballs/zips from CPAN which contain soft links.
+1. Can't install Meteor due to this issue. Copying the files from a Linux VM sort of works if you re-create the tarball with the h option (i.e. tar cvfh).
As @ljharb said: nvm doesn't install properly. And none of the tools that uses symlinks with tar works right now.
To clarify, this is affecting nvm's ability to install node. nvm itself installs fine.
because of this error i am not able to install rbenv
The tar extraction problem with symlinks is caused by the missing symlinkat syscall (symlink was supported but not the at variant). This bug has been fixed internally.
Similarly, I believe creating a tar file with symlinks fails because readlinkat is missing.
Just as a note if someone else stumbles upon this: this also affects installation of Miniconda using Continuum Analytics Miniconda installation shell script that extracts a tar archive containing symlinks.
You get errors like this:
tar: bin/2to3: Cannot create symlink to ‘2to3-3.5’: Invalid argument
Having the same trouble installing RVM. I can download the zip version and install manually, but I get a warning at the end of the install:
* WARNING: you are missing '/dev/fd' it is important for shell scripting used by RVM,
You can fix it on most linux systems with:
ln -sf /proc/self/fd /dev/fd
/proc/self/fd does exist, but following those instructions gives me:
root@localhost:~# ln -s /proc/self/fd /dev/fd
ln: failed to create symbolic link ‘/dev/fd’: Operation not permitted
This is a different error. I make a note here wondering if the (internal) fix would address this, or if we're into some unsupported behavior in the /proc filesystem now.
I got RVM installed manually, but, of course, it wants to install rubies from tar-ed sources, which loops me back around to the original problem, and I'm tired of fighting it.
DunKirk, that error is due to some limitations of our /dev filesystem that prevent you from creating a link there. We're working to address this. This is separate from the symlinkat error.
@SvenGroot thank you much!
I have an example where openat() on a symlink returns no such file or directory despite the symlink existing but not the target. Does the symlinkat fix also apply here?
# e.g. openat("libsolv.so") fails with no such file or directory
root@localhost:# ls -l
total 0
lwrxwrxwrx 1 root root 12 Apr 10 23:33 libsolv.so -> libsolv.so.1
root@localhost:#
Example: https://github.com/haiku/haiku/blob/master/src/bin/package/command_extract.cpp#L552
Thanks for the feedback. Support for both symlinkat and readlinkat has been added to the code, but the build has not made it to flighting yet.
Is there some kind of workaround for this?
Thanks for the feedback. Support for both symlinkat and readlinkat has been added to the code, but the build has not made it to flighting yet.
@sunilmut - any idea about when the new build will be released? Is there a release plan hidden somewhere? :wink: