Bug 32107 - Handle unexpected join script file names more gracefully
Handle unexpected join script file names more gracefully
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Domain join
UCS 3.1
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Florian Best
Johannes Keiser
: interim-1
Depends on:
Blocks: 32136
  Show dependency treegraph
 
Reported: 2013-07-29 09:28 CEST by Ingo Steuwer
Modified: 2017-11-29 12:56 CET (History)
8 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2017112321000688, 2016093021000341, 2016101021000438, 2016110421000564, 2016112421000428, 2016122821000268
Bug group (optional): Error handling, External feedback
Max CVSS v3 score:
best: Patch_Available+


Attachments
example ucc join script (1.94 KB, text/plain)
2013-07-31 08:32 CEST, Ingo Steuwer
Details
32107.patch (768 bytes, patch)
2013-10-08 11:28 CEST, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Steuwer univentionstaff 2013-07-29 09:28:46 CEST
Seen on UCS 3.1-1 Errata130, seen on DC Slave

The UMC module for calling join scripts throws a traceback if a join script from a customer generated UCC image lays under /usr/lib/univention-install (as recommended by UCC documentation). Calling the script with "univention-run-joinscripts" works fine but doesn't resolv the traceback in the UMC module -- the UMC module can't be used as long as the join script isn't removed.

------------------------------------------------------------------------
Die Ausführung des Kommandos join/scripts/query ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 282, in _response
    result = _multi_response(self, request)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 384, in _response
    for res in function(self, iterator, *nones):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 266, in _fake_func
    yield function(self, *args)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/join/__init__.py", line 288, in query
    files[name]['configured'] = False
KeyError: '/usr/lib/univention-install/ucc-1.0-rev2-thinclient-image-lts-quantal.img'
------------------------------------------------------------------------
Comment 1 Alexander Kläser univentionstaff 2013-07-30 16:06:36 CEST
Could you please attach/paste the /var/univention-join/status file when this failure happens.
Comment 2 Ingo Steuwer univentionstaff 2013-07-31 08:32:02 CEST
Created attachment 5341 [details]
example ucc join script

I thin the status file is not helpfull here, because the error occures directly afer copying the new join script to /usr/lib/univention-install/ (there is no information about this script yet in the status file).

Attached is a typical ucc join script to reproduce the message. Remember to make it executable (chmod u+x).
Comment 3 Alexander Kläser univentionstaff 2013-07-31 11:34:16 CEST
The problem is the name of the join script ending on .img. The join module reads in all join scripts ending on .inst or .uinst. The exact regexp is:

  ^(?P<script>(?P<prio>\d+)(?P<name>.+))\.(inst|uinst)$

Now the UCC join script has already been executed and its name appears in /var/univention-join/status. As the file name does not appear in the list of the afore read file names, a key error is thrown.

(a) This is a problem of the UMC join module as it should not throw a traceback.

(b) Probably the name of the UCC join script should be adjusted, otherwise it will not be displayed in the UMC join module.
Comment 4 Alexander Kläser univentionstaff 2013-07-31 11:36:21 CEST
I cloned the bug for UCC (→ Bug 32136).
Comment 5 Florian Best univentionstaff 2013-10-08 11:28:18 CEST
Created attachment 5503 [details]
32107.patch
Comment 6 Erik Damrose univentionstaff 2014-01-07 12:14:04 CET
(In reply to Alexander Kläser from comment #3)
> The problem is the name of the join script ending on .img. 

No, the joinscripts for ucc images end on .inst, but they do not by default contain a sequence number (_95_ucc-...inst), which is only added by ucc-image-download. -> Will be fixed at Bug 32136

The UMC join module encounters an error whenever a executable file with a (.inst|.uinst) ending and without a sequencenumber at the start of the filename resides in /usr/lib/univention-install. This bug is present in UCS 3.1 and UCS 3.2
Comment 8 Florian Best univentionstaff 2015-10-16 10:38:55 CEST
Die Ausführung des Kommandos join/scripts/query ist fehlgeschlagen:

Traceback (most recent call last):
  File "%PY2.6%/univention/management/console/modules/__init__.py", line 218, in execute
    func( request )
  File "%PY2.6%/univention/management/console/modules/decorators.py", line 305, in _response
    result = _multi_response(self, request)
  File "%PY2.6%/univention/management/console/modules/decorators.py", line 432, in _response
    for res in function(self, iterator, *nones):
  File "%PY2.6%/univention/management/console/modules/decorators.py", line 271, in _fake_func
    yield function(self, *args)
  File "%PY2.6%/univention/management/console/modules/join/__init__.py", line 303, in query
    files[name]['configured'] = False
KeyError: '95ucc-1.0-rev3-thinclient-image.img'
Comment 10 Florian Best univentionstaff 2016-08-15 15:06:28 CEST
Reported again:

Version: 3.2-8 errata445 (Borgfeld)

Remark: Only the file `/usr/lib/univention-install/9595ucc-2.0-lmz-desktop-efi-image.img.inst` is present on the server if that helps.

ls -l /usr/lib/univention-install/9595ucc-2.0-lmz-desktop-efi-image.img.inst
-rwxr-xr-x 1 root root 1938 14. Jun 15:21 /usr/lib/univention-install/9595ucc-2.0-lmz-desktop-efi-image.img.inst

Traceback(ac86ca401eb2091d4d04d10ffdbacae8):
Die Ausführung des Kommandos join/scripts/query ist fehlgeschlagen:

Traceback (most recent call last):
  File "%PY2.6%/univention/management/console/modules/__init__.py", line 218, in execute
    func( request )
  File "%PY2.6%/univention/management/console/modules/decorators.py", line 305, in _response
    result = _multi_response(self, request)
  File "%PY2.6%/univention/management/console/modules/decorators.py", line 432, in _response
    for res in function(self, iterator, *nones):
  File "%PY2.6%/univention/management/console/modules/decorators.py", line 271, in _fake_func
    yield function(self, *args)
  File "%PY2.6%/univention/management/console/modules/join/__init__.py", line 303, in query
    files[name]['configured'] = False
KeyError: '95ucc-2.0-lmz-desktop-efi-image.img'
Comment 11 Florian Best univentionstaff 2016-08-15 15:22:39 CEST
(In reply to Florian Best from comment #10)
> KeyError: '95ucc-2.0-lmz-desktop-efi-image.img'

We got this feedback from at least 4 different UCS@school customers.
Comment 12 Florian Best univentionstaff 2016-08-15 15:31:40 CEST
(In reply to Florian Best from comment #11)
> (In reply to Florian Best from comment #10)
> > KeyError: '95ucc-2.0-lmz-desktop-efi-image.img'
> 
> We got this feedback from at least 4 different UCS@school customers.
I merged every of this feedback to Ticket#2016081221000144.
Comment 13 Michael Salm 2016-08-17 15:54:22 CEST
Seen on paedML Linux 6.0 (UCS 3.2-8-errata445 DC Master)

In the directory /usr/lib/univention-install were two files named "9595ucc-2.0-lmz-desktop-efi-image.img" and "9595ucc-2.0-lmz-desktop-image.img". There were also these two files with single "95" in the name.

Deleting these two "9595" files led to the message "Joined successfully" in "univention-check-join-status".
Comment 14 Florian Best univentionstaff 2016-09-13 11:43:52 CEST
We received the KeyError: '95ucc-2.0-lmz-desktop-efi-image.img' again, 3.2-8 errata445 (Borgfeld).
Comment 15 Florian Best univentionstaff 2016-09-15 14:07:53 CEST
Reported again, 3.2-8 errata445 (Borgfeld)

KeyError: '95ucc-2.0-lmz-desktop-efi-image.img'
Comment 16 Florian Best univentionstaff 2016-10-04 12:34:48 CEST
Reported again, 3.2-8 errata447 (Borgfeld)
Comment 18 Florian Best univentionstaff 2016-10-10 11:12:56 CEST
Reported again, 3.2-8 errata448 (Borgfeld)
Comment 19 Florian Best univentionstaff 2016-10-10 12:50:10 CEST
Reproduce:

cat > /usr/lib/univention-install/9595foo.inst <<EOF
#!/bin/bash
VERSION=1
. /usr/share/univention-join/joinscripthelper.lib
joinscript_init
joinscript_save_current_version
exit 0
EOF

cp /usr/lib/univention-install/9595foo.inst /usr/lib/univention-install/bar.inst

The prefix of joinscripts must be [0-9][0-9]. This wasn't evaluated everywhere correctly. All the joinscript libs don't do real checks for the validity of the filenames, I didn't adjust this. Files without prefix/suffix are executed.

univention-join (9.0.0-3):
r73030 | Bug #32107: fix crash in UMC module during detection of joinscripts with invalid names

Patch is backportable to UCS 3, but seems not necessary due to comment #17.
Comment 20 Florian Best univentionstaff 2016-11-09 17:03:17 CET
Reported again, 3.2-8 errata451 (Borgfeld)
Comment 21 Florian Best univentionstaff 2016-12-09 17:15:54 CET
Reported again, 3.2-8 errata453 (Borgfeld)
Comment 22 Florian Best univentionstaff 2017-01-02 17:54:21 CET
Reported again, 3.2-8 errata455 (Borgfeld)
Comment 23 Johannes Keiser univentionstaff 2017-02-01 17:26:59 CET
Tested with UCS 4.2:

without patch:
/usr/lib/univention-install/9595foo.inst
 -> KeyError: '95foo'

/usr/lib/univention-install/bar.inst
 -> KeyError: '/usr/lib/univention-install/bar'

with patch:
/usr/lib/univention-install/9595foo.inst
 -> no error: script is listed in Domain join module

/usr/lib/univention-install/bar.inst
 -> no error: script is not listed in Domain join module

OK, verified
Comment 24 Stefan Gohmann univentionstaff 2017-04-04 18:29:01 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".
Comment 25 Johannes Keiser univentionstaff 2017-11-29 12:56:56 CET
Version: 3.3-1 errata44 (Osterholz)
Remark: Vor langer Zeit wollte ich gerne UCC-Clients auf Desktops verwenden und habe UCC-Images installiert. Zusammenhang?