SliTaz SliTaz Forum

You are not logged in.

#1 2013-02-14 18:08:59

arodulfo
Member
Registered: 2012-11-03
Posts: 71

Uncompressing zipfiles with baclslashes in file paths

Dear all,

I needed a full version of unzip, not just the small one that is included in busybox.

Before uncompressing the files, I test the zip file for potential errors.

If it reports no testing errors, I go to step 2, uncompressing.

Here's where I get a couple of surprises: On the one hand, unzip does a wonderful job extracting the files with its proper linux path separator ("/"). Great! On the other, the exit code is (not so surprising) 1: it warns the user about the zip file using backslashes instead of the proper separator.

My problem is that, unzip seems to issue exit code 1 when finding those backslashes. According to info-zip.org details on this subject, this exit code is also issued when there are files in the zip unzip skipped due to "unsupported compression method or encryption with an unknown password".

I tried to wander unzip man pages and help info, looking for a method to convince it those backslashes are welcome (even if they need to be translated to forward slash). No luck!

Any hint?

Offline

#2 2013-02-14 19:52:52

arodulfo
Member
Registered: 2012-11-03
Posts: 71

Re: Uncompressing zipfiles with baclslashes in file paths

Dear all,

I have managed to overcome this limitation (I guess!).

Before decompressing the archive contents, I'm listing it through grep and keeping just the latest line, where unzip list resumes the amount of files it has listed.

I prepared a stupid script that returns the second argument: that line has the amount of bytes involved in the listing, the amount of files and the word file or files... Simple!

When decompressing the archive, I pass unzip output through grep, telling it to count how many lines do contain the word "inflating" ([c]grep -c inflating[/c]). Simple, as well!

If I get 1 as the exit code of unzip AND the amount of files in the archive is equal to the amount of files "inflated", I have all of them available, so there's no need to worry about lost or skipped files.

This should have come to my mind before posting my question here. I'm sorry for making you lose time.

I hope my experience help others at least.

Kind regards,

Antonio

Offline

#3 2013-02-14 20:07:40

bellard
Administrator
Registered: 2011-03-28
Posts: 657

Re: Uncompressing zipfiles with baclslashes in file paths

# tazpkg get-install unzip

http://pkgs.slitaz.org/search.sh?file=/unzip$&version=s

Offline

#4 2013-02-15 13:14:59

arodulfo
Member
Registered: 2012-11-03
Posts: 71

Re: Uncompressing zipfiles with baclslashes in file paths

@Bellard: Thanks a lot for your hint. I had already solved it on my own, either, as shown in my second post you mos t probably didn't read before posting the hint.

In fact, the more I use SliTaz, the happier I feel with it: "Normal" unzip is not said to be able to deal with backlashes properly. unzip SliTaz full package managed them perfectly since the first second.

I just needed to overcome the multiple readings of its exit code #1, which I did.

Thanks a lot for your close support. SliTaz forever!!!!

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.016 seconds, 7 queries executed - Memory usage: 1.53 MiB (Peak: 1.77 MiB) ]