What's the meaning of the different "removing leading slash" warnings?
I'm using gnu tar with a few instances of --exclude specified.
I get both the
Removing leading / from member namesand
Removing leading / from hard link targetswarnings. What's the difference between them?
1 Answer
No entry within a tarball may begin with a "/", i.e. have an absolute path. It's a security feature, so that if you unpack the tarball, you can be sure that all files will reside in the target directory and subdirectories, instead of being scattered all over the system (and possibly overwriting critical files).
The warnings you see result from tar stripping the leading "/" from any absolute paths, both for normal files ("member names") and hard links ("hard link targets").
For example, this command...
/home/user $ tar czf tarball.tgz /home/user/data...would result in those warnings, as "/home/..." is converted into "home/...". Unpacking the tarball...
/home/user $ tar xzf tarball.tgz...would result in all files being unpacked to /home/user/home/user/data. If tar hadn't stripped the leading slashes, the files in /home/user/data would have been overwritten instead.