Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 17 Apr 2014, 19:54
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
HowTo: Make Zip store files with absolute path? [Solved]
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [12 Posts]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 4980
Location: Arizona, U.S.A.

PostPosted: Sat 17 Apr 2010, 02:46    Post subject:  HowTo: Make Zip store files with absolute path? [Solved]  

I`ve tried to get Zip to store with absolute paths, but they`re always relative.
With absolute paths from /, you know exactly where the file is going. Period !
With relative paths, you need a script to set the current path and run Zip. ( Sucks...)

Even Tar insists on removing the leading / from the paths it stores.
Tar has the option: " -P --absolute-names " = Don't strip leading `/'s from file names.
But I can`t get it to work anyway... Error: Cannot stat: No such file or directory ( the Tar file ).

Anyone know how to do this?

Last edited by sunburnt on Tue 20 Apr 2010, 09:52; edited 1 time in total
Back to top
View user's profile Send private message 
RetroTechGuy


Joined: 15 Dec 2009
Posts: 2635
Location: USA

PostPosted: Mon 19 Apr 2010, 12:44    Post subject: Re: HowTo: Make Zip store files with absolute path?  

sunburnt wrote:
I`ve tried to get Zip to store with absolute paths, but they`re always relative.
With absolute paths from /, you know exactly where the file is going. Period !
With relative paths, you need a script to set the current path and run Zip. ( Sucks...)

Even Tar insists on removing the leading / from the paths it stores.
Tar has the option: " -P --absolute-names " = Don't strip leading `/'s from file names.
But I can`t get it to work anyway... Error: Cannot stat: No such file or directory ( the Tar file ).

Anyone know how to do this?


IIRC (long, long ago I used to be one of Info-Zip's beta testers), the preceding "/" was removed because it caused problems, and presented security risks... And for 99.999% of the users, they didn't want the root filesystem pointer stored anyway...

It will store the whole path, other than the "/". Is that not enough?

Look for "directory-traversal security vulnerability" for example:

http://infozip.sourceforge.net/FAQ.html#corruption
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3276
Location: Oregon

PostPosted: Mon 19 Apr 2010, 14:27    Post subject:  

Why not just make a PET out of the program.
There are instructions on how to make one and with a PET, all files and directories are placed where they are supposed to go.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4980
Location: Arizona, U.S.A.

PostPosted: Mon 19 Apr 2010, 15:22    Post subject:  

Hi RetroTechGuy; As I said, a script is then needed to set the current dir. making the archive utilities not so useful by themselves.

8-bit; It`s just a long standing Q I`ve had about the archive utilities...
Back to top
View user's profile Send private message 
RetroTechGuy


Joined: 15 Dec 2009
Posts: 2635
Location: USA

PostPosted: Mon 19 Apr 2010, 15:48    Post subject:  

sunburnt wrote:
Hi RetroTechGuy; As I said, a script is then needed to set the current dir. making the archive utilities not so useful by themselves.


I guess I don't understand what you mean. I just did a quick test, sitting in /root/ (my command prompt "home"):

Code:
zip -r test.zip /mnt/sda3/tmp


Which stored the contents of tmp as "mnt/sda3/tmp/____"

Then I did an unzip as:

Code:
unzip -d / test.zip


Which wrote the contents of test.zip back to the directory /mnt/sda3/tmp/, all while my working directory was /root/.

Code:
unzip -d extraction_directory zipfile.zip


tells unzip to start at "extraction_directory" for its unzip operation.

"unzip" with no parameters will give you a short help page.

Addendum: You could also set up a batch file, making it perform "unzip -d /" on your input your zipfile, or set up an alias:

Code:
alias restore='unzip -d /'
then
restore test.zip

Last edited by RetroTechGuy on Mon 19 Apr 2010, 15:59; edited 1 time in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4980
Location: Arizona, U.S.A.

PostPosted: Mon 19 Apr 2010, 15:54    Post subject:  

Oooppsss, I was looking at the zip -h page, that should help quite a bit...
having to use a special option isn`t "simple friendly", but it does get the job done!
Thanks T.
Back to top
View user's profile Send private message 
RetroTechGuy


Joined: 15 Dec 2009
Posts: 2635
Location: USA

PostPosted: Mon 19 Apr 2010, 16:04    Post subject:  

sunburnt wrote:
Oooppsss, I was looking at the zip -h page, that should help quite a bit...
having to use a special option isn`t "simple friendly", but it does get the job done!
Thanks T.


You are most welcome. Personally, I would set up the special alias, knowing that it is your "restore" function.

(for example, I also typically alias/replace "rm" with "remove", and then reset "rm" to "rm -i", to prevent accidents)
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4980
Location: Arizona, U.S.A.

PostPosted: Mon 19 Apr 2010, 21:36    Post subject:  

All good ideas, I only use rm in programs, I use Rox for the manual file operations.

Though I`ve wanted a good Win. file Explorer look-alike for years, none work very well.
ROX works well, that`s the other reason I use it, I want dir. panel at left and file on right side.
It would be nice if there was a slide out extra dir. panel to use when copying and moving.

I should look around again as it`s been a year since I`ve looked at them. Any suggestions?
Back to top
View user's profile Send private message 
RetroTechGuy


Joined: 15 Dec 2009
Posts: 2635
Location: USA

PostPosted: Mon 19 Apr 2010, 22:41    Post subject:  

sunburnt wrote:
All good ideas, I only use rm in programs, I use Rox for the manual file operations.

Though I`ve wanted a good Win. file Explorer look-alike for years, none work very well.
ROX works well, that`s the other reason I use it, I want dir. panel at left and file on right side.
It would be nice if there was a slide out extra dir. panel to use when copying and moving.

I should look around again as it`s been a year since I`ve looked at them. Any suggestions?


About the only thing I know off the top of my head is Midnight Commander (a Norton Commander clone).

Haven't used it, however...
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4980
Location: Arizona, U.S.A.

PostPosted: Mon 19 Apr 2010, 23:44    Post subject:  

Laughing I used Norton`s commander for many years in DOS of course.
I`ve tried MC but it`s like NC, 2 file panels, not like Win. Explorer with 1 dir. and 1 file.
It`s close but... There`s 2 Win.Ex. clones I`ve seen, but they just didn`t work as well as ROX.
I`m sure this had a big impression on Barry when he chose the file manager for Puppy.
Back to top
View user's profile Send private message 
RetroTechGuy


Joined: 15 Dec 2009
Posts: 2635
Location: USA

PostPosted: Tue 20 Apr 2010, 11:39    Post subject:  

sunburnt wrote:
Laughing I used Norton`s commander for many years in DOS of course.
I`ve tried MC but it`s like NC, 2 file panels, not like Win. Explorer with 1 dir. and 1 file.
It`s close but... There`s 2 Win.Ex. clones I`ve seen, but they just didn`t work as well as ROX.
I`m sure this had a big impression on Barry when he chose the file manager for Puppy.


I actually don't use Windows Exploder (nor Internet Exploder). And in those DOS days, wasn't really a fan of NC (I did/do use Qfiler, however).

What I do when I want 2 windows is simply to open 2 windows...dragging from one, to the other. Rox doesn't care if you have the same folder twice. And you simply navigate up and down to drag and drop.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4980
Location: Arizona, U.S.A.

PostPosted: Tue 20 Apr 2010, 15:44    Post subject:  

Yes... That`s my standard method of copying stuff. I`ll look into it at sometime... Thanks! T.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [12 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0755s ][ Queries: 11 (0.0148s) ][ GZIP on ]