Welcome to CRUX bug tracking.

FS#1382 - pkgmk checks of directory permissions are too strict

Attached to Project: CRUX
Opened by Erich Eckner (deepthought) - Sunday, 26 February 2017, 22:38 GMT
Task Type Improvement
Category ports → core/opt
Status New
Assigned To No-one
Operating System CRUX
Severity Low
Priority Normal
Reported Version 3.2
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No


The checks of directory permissions of pkgmk are too strict.

what I've stumbled upon so far:
-uf -um -us only need read permission on source directory and write permission on port directory
-rs only needs write permission on port directory
-do needs write permission on source directory and read permission on port directory

regards, deepthought

P.S. The user building my own ports is not the one who owns the ports tree. So I have to "pkgmk -uf", "pkgmk -um" and "pkgmk -us" as root and chown the files afterwards.
This task depends upon

Comment by Fun (fun) - Tuesday, 28 February 2017, 04:26 GMT
Could you test the attached pkgmk?
   pkgmk (21.3 KiB)
Comment by Fun (fun) - Tuesday, 28 February 2017, 11:39 GMT
Patch attached.
Comment by Fun (fun) - Tuesday, 28 February 2017, 16:44 GMT
frinnst, I've attached the program instead of a patch thinking that the most interested person, Erich, will find time to test it.
Comment by Erich Eckner (deepthought) - Wednesday, 01 March 2017, 19:14 GMT
Thanks, fun.

However, now it's a little too liberate:

- check_file should test if it can create a file if it does not exist yet (this bug seems to have been hidden until now)
- and I was wrong regarding "-uf": it does a touch on the package, so it needs write permission on this file

As I can tell from the code, the touch is not really needed, since "build_needed()" only looks at the date of source files (not .footprint, .md5sum, .signature) and I can't imagine a different reason to touch the package after changing the footprint.

The attached patch should take care of both points, too.
Comment by Fun (fun) - Wednesday, 17 May 2017, 20:41 GMT
Erich, in case you still need this fix, you can have it without patching /usr/bin/pkgmk, but /etc/pkgmk.conf
Comment by Erich Eckner (deepthought) - Thursday, 18 May 2017, 04:26 GMT
thanks, fun

I'll give it a try, when I have some time.
Currently I'm using the patch I posted for pkgmk