Bug 34642 - umc-command returns ill-defined exit status
umc-command returns ill-defined exit status
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 5.0
Other Linux
: P1 normal (vote)
: UCS 5.0
Assigned To: Arvid Requate
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-24 19:07 CEST by Arvid Requate
Modified: 2021-05-25 16:02 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):
Max CVSS v3 score:
best: Patch_Available+


Attachments
fail.log (2.22 KB, text/plain)
2014-04-24 19:07 CEST, Arvid Requate
Details
fix_umc_command_returncode.patch (1.13 KB, patch)
2014-04-24 19:17 CEST, Arvid Requate
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Requate univentionstaff 2014-04-24 19:07:59 CEST
Created attachment 5886 [details]
fail.log

The univention-management-console-client (aka umc_command) doesn't return exit codes properly. In case a UMC Module e.g. raises a UMC_CommandError, the UMC client recieves a RESULT status of 400 and then exits with sys.exit(0).

During tests for Bug 34097 I discovered that a Windows-Client can be joined into an UCS@school Samba4 DC Slave even though the umc command selectiveudm/create_windows_computer failed in my case. This is because the Samba4 LDB module univention_samaccountname_ldap_check relies on the exit status.
Comment 1 Arvid Requate univentionstaff 2014-04-24 19:17:51 CEST
Created attachment 5887 [details]
fix_umc_command_returncode.patch

This problem seems to be caused by umc_command effectively returning

  rc = (response.status - 200)
  if rc == 200:
      sys.exit(0)
  else:
      sys.exit(rc)

Apart from the singularity for response.status = 400 this also could cause problems for cases where ((rc % 256) == 0). Currently UMC doesn't seem to use a status code of 456 though.
Comment 2 Arvid Requate univentionstaff 2014-04-24 19:25:10 CEST
This is the commit that introduced the returncode mapping:

--------------------------------------------------------------------------------
r30100 | <id> | 2011-12-28 15:11:43 +0100 (Mi, 28. Dez 2011) | 1 Zeile

increase stability of UMC server when receiving invalid messages and sockets are closed by the client unexpectedly; Bug #25231, Bug #25237 ; umc-client: add option to close connection directyl after sending request, support different MIME types, set exit code to UMCP response status - 200 
--------------------------------------------------------------------------------
Comment 3 Arvid Requate univentionstaff 2014-05-23 10:02:24 CEST
Just faced this yesterday again:

UMC status: 590
umc-command return status: 134   = (590-200)%256
Comment 4 Arvid Requate univentionstaff 2020-07-06 17:33:36 CEST
6a03eec589 | Fix exit status of univention-management-console-client
Comment 5 Florian Best univentionstaff 2020-07-08 00:48:12 CEST
OK: exit code fixed
OK: changelog entry
Comment 6 Florian Best univentionstaff 2021-05-25 16:02:06 CEST
UCS 5.0 has been released:
 https://docs.software-univention.de/release-notes-5.0-0-en.html
 https://docs.software-univention.de/release-notes-5.0-0-de.html

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