You are not logged in.

#1 2008-03-05 13:19:14

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 996

makepkg unzip permissions

hello,

when i let makepkg unzip a source zip-package all permissions are messed up and set to 755.
but when i unzip same package by hand ("unzip xxx.zip") permissions are kept.
has anyone also noticed this?

vlad

Last edited by DonVla (2008-03-05 13:20:14)


pkgman - the ultimate mosquito control (AUR)

Offline

#2 2008-03-05 13:25:22

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: makepkg unzip permissions

What happens when you use bsdtar -xvf instead of unzip ?
What is your umask, and which makepkg (pacman) version are you using?


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#3 2008-03-05 13:32:09

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 996

Re: makepkg unzip permissions

hi shining,

thanks for your reply.
yes, it's a bsdtar issue. when i run bsdtar -xvf the permissions are set to 755. my umaks is 0022 and i use last pacman version (Pacman v3.1.2 - libalpm v2.2.0).
what now? bug report?

vlad


pkgman - the ultimate mosquito control (AUR)

Offline

#4 2008-03-05 14:51:29

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: makepkg unzip permissions

Maybe you could report the issue to bsdtar developer.
http://people.freebsd.org/~kientzle/libarchive/
Comments, questions, patches: kientzle@freebsd.org

Give him the os used, libarchive / bsdtar versions and simple instructions how to reproduce the problem.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#5 2008-03-06 11:46:18

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 996

Re: makepkg unzip permissions

hi,
i'll send him a mail today.
but is this not also a makepkg issue?
makepkg uses bsdtar and not preserving file permissions is a quite major flaw.
one can workaround this in a PKGBUILD, but i think that's not really the intention.

vlad


pkgman - the ultimate mosquito control (AUR)

Offline

#6 2008-03-06 20:38:01

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: makepkg unzip permissions

Are you sure it's not a bad zip file? A lot of zips come from windows machines, which means all permissions will be 755

Offline

#7 2008-03-06 22:34:16

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 996

Re: makepkg unzip permissions

that's a point, but as i said unzip (the application) seems to keep permissions right. i do not have much zip archives here to do more testing. i guess i try some more.
vlad

ps: it may be  that unzip uses the default umask settings...
pps: i think that's it, unzip uses the umask settings, bsdtar actually keeps the permissions. i've tried 2 other zip files and the bsdar-unpacked files are all 755 and the unzipped files are 644.

Last edited by DonVla (2008-03-06 22:41:05)


pkgman - the ultimate mosquito control (AUR)

Offline

#8 2008-03-06 22:44:17

brebs
Member
Registered: 2007-04-03
Posts: 3,066

Re: makepkg unzip permissions

Give us an example.

Offline

#9 2008-03-06 22:50:33

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 996

Re: makepkg unzip permissions

hi,
take any zip file,
e.g. http://www.epsxe.com/files/epsxe160lin.zip

vlad


pkgman - the ultimate mosquito control (AUR)

Offline

#10 2008-03-06 23:10:41

brebs
Member
Registered: 2007-04-03
Posts: 3,066

Re: makepkg unzip permissions

As a normal user, both unzip epsxe160lin.zip and bsdtar -xvf epsxe160lin.zip show:

$ ll sstates/kill.me 
-rwxr-xr-x 1 brebs brebs 27 2002-01-27 23:03 sstates/kill.me

$ umask
0022

Make sure you have libarchive 2.4.12-1

Offline

#11 2008-03-07 18:30:04

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: makepkg unzip permissions

That's strange, I didn't have any problems reproducing the problem
1) echo foo > foo
2) echo bar > bar
3) chmod 640 foo
4) chmod 400 bar
5) zip test.zip foo bar
6) mkdir test1 test2
7) unzip test.zip -d test1
8) bsdtar -xvf test.zip -C test2
9) ls -l test1 test2


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#12 2008-03-07 18:39:27

brebs
Member
Registered: 2007-04-03
Posts: 3,066

Re: makepkg unzip permissions

OK, that shows a discrepancy:

$ ls -l test1 test2
test1:
total 8
-r-------- 1 brebs brebs 4 2008-03-07 18:36 bar
-rw-r----- 1 brebs brebs 4 2008-03-07 18:35 foo

test2:
total 8
-rwxr-xr-x 1 brebs brebs 4 2008-03-07 18:36 bar
-rwxr-xr-x 1 brebs brebs 4 2008-03-07 18:35 foo

Offline

#13 2008-06-15 21:09:06

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: makepkg unzip permissions

Donvla said he would send a mail, but apparently he did not. Or at least he didn't share the answer with us.
I finally decided to send a mail earlier today, and this evening I already had the answer, that guy is amazing wink

Kientzle wrote:

As it turns out, "bsdtar -tvf test.zip" does not
show the permissions, due to a basic architectural
trade-off:
* bsdtar can extract arbitrarily large zip archives from stdin:
     cat test.zip | tar -tvf -
* unzip can extract permission data written by Info-Zip

The core problem here is that Info-Zip only stores
permission information at the end of the archive.
As a result, in order to use that information
you must be able to read the end of the archive
first, before you extract any of the data.
unzip always reads the end of the archive first,
which is why it cannot read from stdin.  bsdtar
always streams the archive data, so it cannot
read the permission data before extracting the
file.

A few of the libarchive developers have been
tossing around ideas for allowing bsdtar to
read the end-of-file archive information from
Zip archives if the archive happens to be
stored in a seekable file.  That would give the
best of both worlds.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

Board footer

Powered by FluxBB