Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-25-2011, 01:49 PM
|
#1
|
Member
Registered: Feb 2009
Posts: 78
Rep:
|
tar and absolute paths
I can't seem to get tar to reference the archived files by absolute path.
I've used both the P and --absolute-names options and still it always shows up without the / (and certainly not absolute from the / directory)
I've used the P option on the tar -xvf foo.tar command as well... still relative paths...
What am I missing?
This is for GNU TAR v1.23 distributed with Debian 6.
Thanks,
WT
Last edited by wjtaylor; 03-25-2011 at 02:15 PM.
|
|
|
03-25-2011, 04:12 PM
|
#2
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,939
|
I think there's something wrong with how the file was tarred in the first place.
I personally use tar -cvf to create and tar -xvf to extract and never have any problems.
I also use tar -tvf to get a report on a tar or tar zipped file if I question what's up with it.
Sounds like someone tarred in symbolic links where the targets of the links are not encompassed by the archive scope.
In reading the tar man page, they should have created it using either -h or --dereference to dereference the files that symbolic links point to versus include the symbolic link intact. However if the symbolic link and the target are both encompassed by the archive (for instance if you archived a tree and they are both in that tree) I feel it will work out O.K.
The -P --absolute-names does nothing about this type of problem by the way.
|
|
|
03-25-2011, 05:34 PM
|
#3
|
Member
Registered: Feb 2009
Posts: 78
Original Poster
Rep:
|
Quote:
Originally Posted by rtmistler
I think there's something wrong with how the file was tarred in the first place.
I personally use tar -cvf to create and tar -xvf to extract and never have any problems.
I also use tar -tvf to get a report on a tar or tar zipped file if I question what's up with it.
Sounds like someone tarred in symbolic links where the targets of the links are not encompassed by the archive scope.
In reading the tar man page, they should have created it using either -h or --dereference to dereference the files that symbolic links point to versus include the symbolic link intact. However if the symbolic link and the target are both encompassed by the archive (for instance if you archived a tree and they are both in that tree) I feel it will work out O.K.
The -P --absolute-names does nothing about this type of problem by the way.
|
No, I recreated the tarball with just the standard: tar -cvf foo.tar source/ and there are no absolute paths
I tried again with, tar -cvfP and still nothing...
Tar behaves differently depending on the brand. The tar that comes with Solaris keeps absolute paths by default, I believe. This is for GNU TAR. What brand/version of tar are you using?
You're from Milford? I have some friends from Milford... down the road from EMC. Small world...
|
|
|
03-25-2011, 05:58 PM
|
#4
|
Member
Registered: Feb 2009
Posts: 78
Original Poster
Rep:
|
I think I figured it out... If, when I am creating the archive, I specify the absolute path of the source files then I get them recorded in the tarball; if I use the relative path it only records relative paths in the archive.
Yes, you are right. The P option doesn't control it. It only affects the leading slash.
Thanks,
WT
|
|
|
03-28-2011, 09:09 AM
|
#5
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,939
|
I work at TechEn off Rt 85 in Milford, small design house for electronics. Got a buddy who works at EMC. Yep, small world, but then again, it's not like there aren't about a zillion engineering people around MA. Glad you figured it out. Yes, depending on the tar flavor, it can be complicated. I hated the old busybox because of that, however they have improved on it somewhat.
|
|
|
All times are GMT -5. The time now is 08:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|