Bug 25229 - В %post_control не продумано добавление новых возможностей при обновлении
Summary: В %post_control не продумано добавление новых возможностей при обновлении
Status: NEW
Alias: None
Product: Sisyphus
Classification: Development
Component: control (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: Dmitry V. Levin
QA Contact: qa-sisyphus
URL:
Keywords:
: 37480 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-14 20:45 MSK by Evgeny Sinelnikov
Modified: 2019-11-16 21:40 MSK (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny Sinelnikov 2011-03-14 20:45:00 MSK
При обновлении пакета с новыми возможностями (facilities) для управления через control возникает проблема установки прав, по умолчанию.

Например, в пакете sudo добавляется новая утилита sudoreplay.

Делаем так:

@@ -83,6 +83,7 @@ mkdir -p %buildroot/var/run/sudo
 chmod u+rwx %buildroot%prefix/*bin/*
 install -pD -m755 sudo.control %buildroot/etc/control.d/facilities/sudo
 install -pD -m755 sudoers.control %buildroot/etc/control.d/facilities/sudoers
+install -pD -m755 sudoreplay.control %buildroot/etc/control.d/facilities/sudoreplay
 
 # sudoedit
 ln -snf sudo %buildroot%_bindir/sudoedit
@@ -91,10 +92,12 @@ ln -snf sudo.8 %buildroot%_man8dir/sudoedit.8
 %pre
 %pre_control sudo
 %pre_control sudoers
+%pre_control sudoreplay
 
 %post
 %post_control -s wheelonly sudo
 %post_control -s strict sudoers
+%post_control -s wheelonly sudoreplay
 
 %files
 %config /etc/control.d/facilities/sudo*

При обновлении получаем вот так:
[sin@inf sudo]$ sudo rpm -Uv --oldpackage sudo-1.6.8p12-alt8.i586.rpm 
Password: 
Подготовка пакетов для установки...
sudo-1.6.8p12-alt8
предупреждение: /etc/sudoers создан как /etc/sudoers.rpmnew
Running /usr/lib/rpm/posttrans-filetriggers
[sin@inf sudo]$ sudo rpm -Uv /home/sin/RPM/RPMS/athlon/sudo-1.7.5-alt1.athlon.rpm
[sudo] password for sin:
Preparing packages for installation...
control: No such facility: sudoreplay
sudo-1.7.5-alt1
warning: /etc/sudoers created as /etc/sudoers.rpmnew
control-restore: No status available for "sudoreplay" facility
Running /usr/lib/rpm/posttrans-filetriggers

Соответственно неопределённое состояние для возможности sudoreplay:
[sin@inf ~]$ sudo control sudoreplay 
Password: 
unknown

Причина в макросе post_control, который не учитывает установку значения, по умолчанию, при обновлении для новых control facilities.

$ grep post_control -R /usr/lib/rpm -A8
/usr/lib/rpm/macros.d/control:%post_control(s:) \
/usr/lib/rpm/macros.d/control-if [ $1 -ge 2 ]; then \
/usr/lib/rpm/macros.d/control-  /usr/sbin/control-restore %* \
/usr/lib/rpm/macros.d/control-else \
/usr/lib/rpm/macros.d/control-  for facility in %*; do \
/usr/lib/rpm/macros.d/control-          /usr/sbin/control "$facility" %{-s*}%{!-s:public} \
/usr/lib/rpm/macros.d/control-  done \
/usr/lib/rpm/macros.d/control-fi \
/usr/lib/rpm/macros.d/control-%nil
Comment 1 Evgeny Sinelnikov 2019-11-16 21:40:03 MSK
*** Bug 37480 has been marked as a duplicate of this bug. ***