You are not logged in.

#1 2005-05-02 06:55:33

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,615
Website

Directory permissions overwritten.

I just did an oops today. I was working on creating a package. The package has an install script for it. In the pkgbuild, I just run the install script. All well and good so far.

The install script does a umask 077 before it creates directories. So the directories created in the pkg dir are all chmod'ed 700. The package builds, and out pops the package.
I install it.

*queue explosion sounds*
Apparently all the permissions on the directories that were created are overwritten. That means my /usr, and my /var directories are now all chmod 700. Not good. Any directory that is present in the pkgbuild, gets overwritten by pacman somehow. Permissions are all changed.
Is this a bug, or is it supposed to be that way?

I realized my error, and am now in the process of fixing my system. Thankfully I have a build/test box for this kind of thing..

 sudo pacman --noconfirm -Sy `sudo pacman -Q | awk '{print $1" "}' | tr -d "n"`

heh. lets see where the above gets me. If the permissions were overwritten once, maybe they will be again..


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#2 2005-05-02 10:12:05

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Directory permissions overwritten.

I did the same thing some time ago.
I'm not sure if this can be considered a pacman bug.

The way I fixed it:

Started mc, entered the .pkg.tar.gz, looked at each dir in the archive and manually modified the corresponding dir's permissions on my disk.

Now, I would do it in a 'smarter' way.
1. I would unpack the .pkg.tar.gz to.. let's say /tmp/pkg.
2. "find /tmp/pkg -type d -exec chmod 755 {} ;"
3. move the contents of /tmp/pkg to /
(this does not work for 'special' dirs which don't have 755 permission)

I would have the permissions set back to normal.
I could uninstall the package, fix it and install it back.
Hmm.. it might work only by reinstalling the fixed package...

Offline

#3 2005-05-02 11:19:36

swiergot
Member
From: Kraków, Poland
Registered: 2005-01-08
Posts: 145

Re: Directory permissions overwritten.

I'd say all package managers bahaves that way. I always run another check on my packages apart from namcap:

tar tvzf package.pkg.tar.gz | egrep -v 'rw-r--r--|rwxr-xr-x'

EDIT: And maybe it's a good idea to add this check to namcap.

Offline

#4 2005-05-02 11:59:40

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: Directory permissions overwritten.

Well.. maybe namcap could also include a list of dirs and their correct modes.

You wouldn't like your /usr/bin to go 'rw-r--r--', would you? (that line would allow this, if I'm not wrong)

Offline

#5 2005-05-02 14:00:28

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

Re: Directory permissions overwritten.

I dunno... try reinstalling the "filesystem" package? that's the one which sets up all the directories on an install... I'd assume that has the proper permissions...

Offline

#6 2005-05-02 15:34:25

swiergot
Member
From: Kraków, Poland
Registered: 2005-01-08
Posts: 145

Re: Directory permissions overwritten.

IceRAM wrote:

You wouldn't like your /usr/bin to go 'rw-r--r--', would you? (that line would allow this, if I'm not wrong)

In theory yes but I don't expect any install script to create a directory without execute permission. Nevertheless, if namcap was to check permissions, it would be even better to secure against possible stupid scripts.

Offline

Board footer

Powered by FluxBB