Bug 54882 - univention-l10n crashes if called without arguments
univention-l10n crashes if called without arguments
Status: NEW
Product: UCS
Classification: Unclassified
Component: General
UCS 5.0
Other Linux
: P5 minor (vote)
: ---
Assigned To: Jaime Conde Segovia
Sönke Schwardt-Krummrich
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-06-20 14:34 CEST by Johannes Königer
Modified: 2022-07-18 08:56 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): bitesize
Max CVSS v3 score:
hahn: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Königer univentionstaff 2022-06-20 14:34:49 CEST
When univention-l10n is called from the command line without any arguments, the program crashes with the following output:

Traceback (most recent call last):
  File "/usr/bin/univention-l10n", line 11, in <module>
    load_entry_point('univention-l10n===7.0.1-3A-5.0.0.202201281923', 'console_scripts', 'univention-l10n')()
  File "/usr/lib/python3/dist-packages/univention/l10n/cmd.py", line 44, in main
    parse_args(cmd)
  File "/usr/lib/python3/dist-packages/univention/l10n/cmd.py", line 90, in parse_args
    args.func(args)
AttributeError: 'Namespace' object has no attribute 'func'

Expected Output: Program runs or provides a message which explains what the program does and what arguments can be provided.
Comment 1 Philipp Hahn univentionstaff 2022-06-20 16:23:38 CEST
See [argparse.ArgumentParser.add_subparsers(…, required=True)](https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_subparsers) was added with 3.7 and changed the default from `True` to `False`; there is already a comment in line 72 for that as we were still using python2.7 back than and it was overlooked when we switched to Python 3.

sed -re '/add_subparsers/s/\)  #( required=True)/,\1)/' -i packaging/univention-l10n/univention/l10n/cmd.py