Bug 27872 - univention-lib/ucr.sh: remove_ucr_template() fehlerhaft — korrektes entfernen von Templates
univention-lib/ucr.sh: remove_ucr_template() fehlerhaft — korrektes entfernen...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UCR
UCS 3.0
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Philipp Hahn
Janek Walkenhorst
http://wiki.debian.org/DpkgConffileHa...
: interim-1
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-11 10:03 CEST by Philipp Hahn
Modified: 2017-04-04 18:28 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Troubleshooting
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2012-07-11 10:03:06 CEST
/usr/share/univention-lib/ucr.sh:
...
remove_ucr_template () {
...
  dpkg-divert --remove "$1"

1. Die Shell-Lib sollte das nicht machen, weil univention-config-registry für das Einrichten und Entfernen der Diversions zuständig ist.
2. Hier fehlt das --rename.

Beides zusammen führt dazu, daß UCR dann erkennt, daß die Diversion bereits nicht mehr besteht und deswegen die .debian-Datei nicht zurück umbenannt wird.


Eigentlich™ sollte univention-config-registry über das hinzufügen/ändern/entfernen von .info-Dateien selber die notwendigen Schritte unternehmen, allerdings sind die .info- und templates/-Dateien alle unter /etc/ und damit conffiles, weswegen diese manuell entfernt werden müssen.

Dazu kann "dpkg-maintscript-helper" verwendet werden:
debian/control:
 Pre-Depends: dpkg (>= 1.15.7.2)
debian/$pkg.preinst:
 dpkg-maintscript-helper rm_conffile /etc/univention/templates/$file -- "$@"
debian/$pkg.postinst:
 dpkg-maintscript-helper rm_conffile /etc/univention/templates/$file -- "$@"
 univention-config-registry update # s.u.
debian/$pkg.postrm:
 dpkg-maintscript-helper rm_conffile /etc/univention/templates/$file -- "$@"


Der trigger greift derzeit nur beim kompletten Deinstallieren eines Pakets, aber nicht beim Aktualisieren. Dadurch werden entfernte und hinzugefügte Templates nicht selbständig aktualisiert.

/var/lib/dpkg/info/univention-config.postinst:55
  install*)
    univention-config-registry update
    ;;

Siehe auch Bug #27597
Comment 1 Stefan Gohmann univentionstaff 2012-09-05 08:52:16 CEST
Nicht kritisch und kein Patch vorhanden.
Comment 2 Philipp Hahn univentionstaff 2012-11-27 15:58:30 CET
(In reply to comment #0)
> /usr/share/univention-lib/ucr.sh:
> ...
> remove_ucr_template () {
> ...
>   dpkg-divert --remove "$1"
> 
> 1. Die Shell-Lib sollte das nicht machen, weil univention-config-registry für
> das Einrichten und Entfernen der Diversions zuständig ist.
> 2. Hier fehlt das --rename.

Dann ist hier aber auch die Reihenfolge falsch: Erst muß die alte Datei entfernt werden, bevor die Diversion mit --rename rückgängig gemacht wird.

>»···if [ -e "$1" ] ; then
>»···    mv "$1" /etc/univention/templates/removed/
>»···fi


> Dazu kann "dpkg-maintscript-helper" verwendet werden:

Leider nicht, denn das Helper-Skript untrstützt nur "update", aber kein "remove".
Anscheinend beliben die Conffiles auch in /var/lib/dpkg/status bestehen, so daß sie bei der nächsten Paketinstallation dann nicht wieder installiert werden → "dpk --force-confmiss"

Die sauberste Lösung bleibt Bug #28284
Comment 3 Florian Best univentionstaff 2016-09-06 13:59:59 CEST
Please let's fix this.
Comment 4 Philipp Hahn univentionstaff 2016-09-06 17:32:51 CEST
r72320 | Bug #27872 base: Move ucs.sh to univention-config
r72319 | Bug #27872 ucr: Deprecate remove_ucr_*
r72318 | Bug #27872 tftp: Remove update code
r72317 | Bug #27872 squid: Remove update code
r72316 | Bug #27872 postfix: Remove update code
r72315 | Bug #27872 cyrus-murder: Remove update code
r72314 | Bug #27872 cyrus: Remove update code
r72313 | Bug #27872 boot: Remove update code
r72312 | Bug #27872 ucslint: Check for broken UCS file removal
r72311 | Bug #27872 ucslint: autopep8
r72322 | Bug #42294 ucr: Workaround broken ucslint

Package: univention-lib
Version: 6.0.2-1A~4.2.0.201609061709
Branch: ucs_4.2-0

Package: univention-config-registry
Version: 12.0.0-1A~4.2.0.201609061711
Version: 12.0.0-1A~4.2.0.201609061726
Branch: ucs_4.2-0

r72324 | Bug #23737,Bug #27872 UCR: changelog
Comment 5 Janek Walkenhorst univentionstaff 2017-02-03 17:14:26 CET
(In reply to Philipp Hahn from comment #4)
> r72320 | Bug #27872 base: Move ucs.sh to univention-config
> r72319 | Bug #27872 ucr: Deprecate remove_ucr_*
> r72318 | Bug #27872 tftp: Remove update code
> r72317 | Bug #27872 squid: Remove update code
> r72316 | Bug #27872 postfix: Remove update code
> r72315 | Bug #27872 cyrus-murder: Remove update code
> r72314 | Bug #27872 cyrus: Remove update code
> r72313 | Bug #27872 boot: Remove update code
> r72312 | Bug #27872 ucslint: Check for broken UCS file removal
> r72311 | Bug #27872 ucslint: autopep8
> r72322 | Bug #42294 ucr: Workaround broken ucslint
OK

> r72324 | Bug #23737,Bug #27872 UCR: changelog
OK
Comment 6 Stefan Gohmann univentionstaff 2017-04-04 18:28:39 CEST
UCS 4.2 has been released:
 https://docs.software-univention.de/release-notes-4.2-0-en.html
 https://docs.software-univention.de/release-notes-4.2-0-de.html

If this error occurs again, please use "Clone This Bug".