Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 457162 - ebuild's keepdir() alter target-dir permissions.
Summary: ebuild's keepdir() alter target-dir permissions.
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PMS/EAPI
Depends on:
Reported: 2013-02-13 22:03 UTC by Piotr Karbowski (RETIRED)
Modified: 2020-10-25 17:09 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Karbowski (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2013-02-13 22:03:15 UTC

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 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) archtester Gentoo Infrastructure gentoo-dev Security 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) archtester Gentoo Infrastructure gentoo-dev Security 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.