FS#9183 - libalpm creates /tmp with incorrect permissions

Attached to Project: Pacman
Opened by Jaroslaw Swierczynski (swiergot) - Sunday, 13 January 2008, 08:53 GMT
Last edited by Xavier (shining) - Monday, 14 January 2008, 23:36 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To Xavier (shining)
Architecture All
Severity Medium
Priority Normal
Reported Version 3.1.0
Due in Version 3.1.1
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

During mkarchroot, I get the following message from pacman while installing filesystem package:

warning: directory permissions differ on tmp/
filesystem: 755 package: 1777

I guess it's either pacman or libalpm that creates this directory earlier. I didn't search too much but found this:

(lib/libalpm/trans.c:488)

snprintf(tmpdir, PATH_MAX, "%stmp/", root);
if(stat(tmpdir, &buf)) {
_alpm_makepath(tmpdir);
}

(lib/libalpm/util.c:199)

if(mkdir(full, 0755)) {

The solution would be to fix permissions either in libalpm or filesystem package post-install script.
This task depends upon

Closed by  Xavier (shining)
Monday, 14 January 2008, 23:36 GMT
Reason for closing:  Fixed
Additional comments about closing:  last patch was applied to git, commit 801a2680.
Comment by Xavier (shining) - Sunday, 13 January 2008, 09:02 GMT
Indeed, the chmod /tmp was just removed from filesystem post-install script, which was the reason of my comment yesterday:
http://archlinux.org/pipermail/pacman-dev/2008-January/010834.html

So right, it should probably be fixed in libalpm instead.
But then, why does the filesystem package install the /tmp/ directory, since it's always created by pacman first?
Comment by Xavier (shining) - Sunday, 13 January 2008, 11:52 GMT
I thought about another way to fix this and the little problem mentioned in my first comment.
See attached patch.
Comment by Jaroslaw Swierczynski (swiergot) - Sunday, 13 January 2008, 12:47 GMT
I think this is an overhead. Attached is my solution.
Comment by Xavier (shining) - Sunday, 13 January 2008, 13:15 GMT
Yes, I was thinking about doing it that way, it looks good (I would just rename _alpm_makepath_internal directly to _alpm_makepath_mode though).
But it still bothers me a bit that the /tmp/ directory is always set up by pacman, and not filesystem package.

I'll just let Dan or Aaron decide which solution they prefer.
Comment by Jaroslaw Swierczynski (swiergot) - Sunday, 13 January 2008, 13:19 GMT
Oh, right. I don't know what I was thinking. Additional _alpm_makepath_internal is indeed unnecessary.
Comment by Xavier (shining) - Sunday, 13 January 2008, 14:18 GMT
There was one typo though, the correct permission is 01777 (octal) :)
Comment by Dan McGee (toofishes) - Sunday, 13 January 2008, 17:18 GMT
Hmm, I like the first patch a bit better as it is something we can use down the road if need be. Deleting /tmp is a stupid idea as well- what if the scriptlet itself leaves files there for the user?

We also need to address the other times /tmp may be created, such as the creation of a cachedir (even if this is extremely unlikely, we still need to ensure we always create /tmp correctly).
Comment by Xavier (shining) - Sunday, 13 January 2008, 17:28 GMT
You meant the second patch?
The first patch was the one that deleted /tmp/. Having a scriptlet leave files in /tmp/ for the user sounds weird to me, I wouldn't think about doing such things.

Anyway, I am fine with the last patch, it's fine too. Just that the /tmp/ directory could be removed from filesystem package, it wouldn't make any difference.
And yes, I forgot about cachedir, I will have a look.

Loading...