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

Bug 665116

Summary: mail-mta/postfix-3.2.6 tunes special permission on / instead of ${ROOT}/ when installing from binpkg
Product: Gentoo Linux Reporter: Bruno <bonbons>
Component: Current packagesAssignee: Eray Aslan <eras>
Status: UNCONFIRMED ---    
Severity: normal CC: hydrapolic, jstein, net-mail+disabled, williamh
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Bruno 2018-09-02 16:16:14 UTC
When installing postfix into ROOT=/ from binpkg file permissions are correct.

ls -l /usr/sbin/post*
-rwxr-xr-x 1 root root      18312 Sep  2 17:58 /usr/sbin/postalias
-rwxr-xr-x 1 root root      18384 Sep  2 17:58 /usr/sbin/postcat
-rwxr-xr-x 1 root root     175208 Sep  2 17:58 /usr/sbin/postconf
-rwxr-sr-x 1 root postdrop  14344 Sep  2 17:58 /usr/sbin/postdrop
-rwxr-xr-x 1 root root      14296 Sep  2 17:58 /usr/sbin/postfix
-rwxr-xr-x 1 root root      10120 Sep  2 17:58 /usr/sbin/postkick
-rwxr-xr-x 1 root root      10120 Sep  2 17:58 /usr/sbin/postlock
-rwxr-xr-x 1 root root      10280 Sep  2 17:58 /usr/sbin/postlog
-rwxr-xr-x 1 root root      18312 Sep  2 17:58 /usr/sbin/postmap
-rwxr-xr-x 1 root root      26904 Sep  2 17:58 /usr/sbin/postmulti
-rwxr-sr-x 1 root postdrop  22488 Sep  2 17:58 /usr/sbin/postqueue
-rwxr-xr-x 1 root root      22744 Sep  2 17:58 /usr/sbin/postsuper


When installing postfix into ROOT=/mnt/image from binpkg file permissions are incorrect:

ls -l /mnt/image/usr/sbin/post*
-rwxr-xr-x 1 root root  18312 Sep  2 17:58 /mnt/image/usr/sbin/postalias
-rwxr-xr-x 1 root root  18384 Sep  2 17:58 /mnt/image/usr/sbin/postcat
-rwxr-xr-x 1 root root 175208 Sep  2 17:58 /mnt/image/usr/sbin/postconf
-rwxr-xr-x 1 root root  14344 Sep  2 17:58 /mnt/image/usr/sbin/postdrop
-rwxr-xr-x 1 root root  14296 Sep  2 17:58 /mnt/image/usr/sbin/postfix
-rwxr-xr-x 1 root root  10120 Sep  2 17:58 /mnt/image/usr/sbin/postkick
-rwxr-xr-x 1 root root  10120 Sep  2 17:58 /mnt/image/usr/sbin/postlock
-rwxr-xr-x 1 root root  10280 Sep  2 17:58 /mnt/image/usr/sbin/postlog
-rwxr-xr-x 1 root root  18312 Sep  2 17:58 /mnt/image/usr/sbin/postmap
-rwxr-xr-x 1 root root  26904 Sep  2 17:58 /mnt/image/usr/sbin/postmulti
-rwxr-xr-x 1 root root  22488 Sep  2 17:58 /mnt/image/usr/sbin/postqueue
-rwxr-xr-x 1 root root  22744 Sep  2 17:58 /mnt/image/usr/sbin/postsuper


Interestingly, when removing group/g+s from /usr/sbin/postdrop, re-installing postfix under ROOT=/mnt/image restores the special permissions for /usr/sbin/postdrop (instead of fixing those of /mnt/image/usr/sbin/postdrop).


Note: not tested for non-binpkg installs.

Portage version: sys-apps/portage-2.3.40-r1
Probably a regression since sys-apps/portage-2.3.24-r1.
Comment 1 Zac Medico gentoo-dev 2018-09-02 20:40:50 UTC
This must be due to postfix set-permissions call in pkg_postinst of the postfix-3.2.6 and later ebuilds:

	# check and fix file permissions
	"${EROOT}"/usr/sbin/postfix set-permissions 2>/dev/null
Comment 2 Bruno 2018-09-27 19:25:26 UTC
It seem like calling `postfix set-permissions` with some extra arguments can get things in a better shape.


Shouldn't it be called during src_install while setting the various location variables to point to $E? Worst-case running it in pkg_postinst for it to recreate empty directories but then setting paths with proper ${EROOT} prefix.

Kind of
  postfix set-permissions queue_directory=${E}/var/spool/postfix command_directory=${E}/usr/sbin ...

Such as to cover all location prefixes from /etc/postfix/postfix-files:
  $command_directory
  $config_directory
  $daemon_directory
  $data_directory
  $html_directory
  $mailq_path
  $manpage_directory
  $meta_directory
  $newaliases_path
  $queue_directory
  $readme_directory
  $sample_directory
  $sendmail_path
  $shlib_directory