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
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}/}"
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.
(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
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.
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.
Closing by comment #4.