Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 457162

Summary: ebuild's keepdir() alter target-dir permissions.
Product: Gentoo Hosted Projects Reporter: Piotr Karbowski (RETIRED) <slashbeast>
Component: PMS/EAPIAssignee: PMS/EAPI <pms>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://dev.gentoo.org/~ulm/pms/5/pms.html#x1-13600011.3.3.8
Whiteboard:
Package list:
Runtime testing required: ---

Description Piotr Karbowski (RETIRED) gentoo-dev 2013-02-13 22:03:15 UTC
sys-apps/portage-2.2.0_alpha161
app-shells/bash-4.2_p42

using keepdir does alter permissions, for example dir with 2775 after keepdir have 2755. a quicktest with:

    ls -ld "$D"/var/spool/dma
    keepdir /var/spool/dma
    ls -ld "$D"/var/spool/dma

results with:

    drwxrwsr-x 2 root mail 4096 Feb 13 22:59 /var/tmp/portage/mail-mta/dma-0.8/image//var/spool/dma
    drwxr-sr-x 2 root mail 4096 Feb 13 22:59 /var/tmp/portage/mail-mta/dma-0.8/image//var/spool/dma

I tried to do what keepdir() do and 'touch "$D/var/spool/dma/.keep_${CATEGORY}_${PN}-${SLOT%/*}"' does not breaks permissions.

Reproducible: Always
Comment 1 Zac Medico gentoo-dev 2013-02-13 23:51:19 UTC
According to PMS section 11.3.3.8 Installation commands, dodir and keepdir use the DIROPTIONS, by default with file mode 0755.

In portage, keepdir calls dodir, and dodir simply does this:

  install -d ${DIROPTIONS} "${@/#/${ED}/}"
Comment 2 Piotr Karbowski (RETIRED) gentoo-dev 2013-02-14 00:04:32 UTC
Still thats a bit odd because it does leave the setGID there so it looks like not 0755 but 755 is used. I wonder if it really suppose to act like that.
Comment 3 SpanKY gentoo-dev 2013-02-19 08:06:22 UTC
(In reply to comment #1)

i'm not sure the expectation is that existing dirs get munged.  although, it's always behaved this way ...

(In reply to comment #2)

for +s bits, it's generally sane to do that all at the end due to the number of operations that can easily reset them
Comment 4 Ulrich Müller gentoo-dev 2013-02-19 08:38:56 UTC
It behaves in the same way as dodir. I'd rather not change this, as it would only add to the confusion.

Ebuilds can easily work around the problem by using DIROPTIONS, or call keepdir before emake install.
Comment 5 Piotr Karbowski (RETIRED) gentoo-dev 2013-02-19 14:13:52 UTC
Well you would expect keepdir to only create a empty file inside and nothing else, I am prepared to adjust permissions at the very end of install process too but I thinks the real confusion comes from the chanding permissions but yeah, I am fain with it as-is, now when I know how it does work.
Comment 6 Ulrich Müller gentoo-dev 2020-10-25 17:09:00 UTC
Closing by comment #4.