Bug 35239 - UCR modules and handlers are double-registered and double-executed
UCR modules and handlers are double-registered and double-executed
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UCR
UCS 4.3
Other Linux
: P5 normal (vote)
: UCS 4.3-2-errata
Assigned To: Jannik Ahlers
Arvid Requate
https://git.knut.univention.de/univen...
:
: 39443 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-03 10:46 CEST by Philipp Hahn
Modified: 2018-12-06 15:24 CET (History)
4 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): Cleanup, Design, Error handling, Troubleshooting
Max CVSS v3 score:
best: Patch_Available+


Attachments
Fix hashing to prevent double registration (1.29 KB, patch)
2014-07-10 12:27 CEST, Philipp Hahn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2014-07-03 10:46:50 CEST
The WebWeaver integration packet contains an UCR module, which is registered using univention-install-config-registry. If the package is re-installed due to an upgrade, the handler is then double-registered and gets called two times:

# ucr unset webweaver/foobar/ServerPasswd 
Unsetting webweaver/foobar/ServerPasswd
Module: univention-digionline-webweaver
WebWeaver: Handling changes: {'webweaver/foobar/ServerPasswd': ('41dff51b237d4961963f0cd12823a6b4', None)}
WebWeaver: Writing new configuration file "/etc/univention-digionline-webweaver.json"...
Module: univention-digionline-webweaver
WebWeaver: Handling changes: {'webweaver/foobar/ServerPasswd': ('41dff51b237d4961963f0cd12823a6b4', None)}
WebWeaver: Writing new configuration file "/etc/univention-digionline-webweaver.json"...


# ucr update
# python -c 'import pickle;f=open("/var/cache/univention-config/cache");f.readline();d=pickle.load(f);print [_.module for _ in d["^webweaver/"]]'
['univention-digionline-webweaver']

# ucr register univention-digionline-webweaver
# python -c 'import pickle;f=open("/var/cache/univention-config/cache");f.readline();d=pickle.load(f);print [_.module for _ in d["^webweaver/"]]'
['univention-digionline-webweaver', 'univention-digionline-webweaver']
Comment 1 Philipp Hahn univentionstaff 2014-07-10 12:27:22 CEST
Created attachment 5988 [details]
Fix hashing to prevent double registration

May breaks if a script and/or module and/or file handler exists with the same name.
Comment 2 Florian Best univentionstaff 2017-02-10 10:32:57 CET
*** Bug 39443 has been marked as a duplicate of this bug. ***
Comment 3 Philipp Hahn univentionstaff 2018-06-28 12:57:56 CEST
Still happens with UCS-4.3-1, noticed during QA for Bug #47260
Comment 4 Jannik Ahlers univentionstaff 2018-11-12 11:02:34 CET
Successful build
Package: univention-config-registry
Version: 13.0.0-6A~4.3.0.201811121038
Branch: ucs_4.3-0
Scope: errata4.3-2

Successful build
Package: ucs-test
Version: 8.0.28-224A~4.3.0.201811121052
Branch: ucs_4.3-0
Scope: errata4.3-2

-------------------

univention-config-registry (13.0.0-6)
e063d03f8e2d | Bug #35239: Merge branch 'jahlers/35239-ucr-handler-double-registr2' into 4.3-2
c72358089a0c | Bug #35239: fix double registration of ucr modules

ucs-test (8.0.28-223)
f6db8f23d1c9 | Bug #35239: fix test header
e063d03f8e2d | Bug #35239: Merge branch 'jahlers/35239-ucr-handler-double-registr2' into 4.3-2
d2377693ce7b | Bug #35239: test double registration of ucr modules

ucs-test (8.0.28-224)
9350e164dd91 | Bug #35239: ucs-test changelog

univention-config-registry.yaml
f69be95deb78 | Bug #35239: yaml

------------------

I added __hash__, __eq__ and __ne__ functions to the file, script and module confighandler classes.
I didn't use __cmp__ methods as suggested by philipp as they will get removed with python 3.

> May breaks if a script and/or module and/or file handler exists with the same name.

This can, but shouldn't happen:
- ConfigHandlerDiverting.to_file stores a path to a config file
- ConfigHandlerModule.module stores a module name
- ConfigHandlerScript.script stores a path to a script

Those should normally never be the same, except if someone uses the config file module to replace variables in a script, and then run it. This should never be neccessary as you can easily access ucr variables in a script anyway.
(Has this ever happened? Do we need a test case for this?)
Comment 5 Arvid Requate univentionstaff 2018-12-03 15:51:12 CET
Verified:
* Code review
* Test with updated package
* Advisory

c7cba1d254 | Advisory: small wording adjustment
Comment 6 Arvid Requate univentionstaff 2018-12-05 14:38:56 CET
<http://errata.software-univention.de/ucs/4.3/358.html>