Bug 20230 - syntax.py#date fehlerhaft - akzeptiert 31. Februar
syntax.py#date fehlerhaft - akzeptiert 31. Februar
Status: CLOSED WONTFIX
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 2.4
Other Linux
: P5 minor (vote)
: UCS 3.x
Assigned To: UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-01 19:31 CEST by Philipp Hahn
Modified: 2018-04-13 13:29 CEST (History)
2 users (show)

See Also:
What kind of report is it?: ---
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, Usability
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 2010-10-01 19:31:30 CEST
>>> import univention.admin.modules
>>> univention.admin.syntax.date().parse('01x02y02')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 625, in parse
    day, month, year = map(lambda(x): int(x), text.split('.'))
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 625, in <lambda>
    day, month, year = map(lambda(x): int(x), text.split('.'))
ValueError: invalid literal for int(): 01x02y02
>>> univention.admin.syntax.date().parse('01.02.00')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 628, in parse
    raise univention.admin.uexceptions.valueError,_("Not a valid Date")
univention.admin.uexceptions.valueError: Not a valid Date
>>> univention.admin.syntax.date().parse('01.02.99')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/univention/admin/syntax.py", line 628, in parse
    raise univention.admin.uexceptions.valueError,_("Not a valid Date")
univention.admin.uexceptions.valueError: Not a valid Date
>>> univention.admin.syntax.date().parse('31.02.01')
'31.02.01'
>>> univention.admin.syntax.date().parse('00.00.01')
'00.00.01'

ucs/management/univention-directory-manager-modules/modules/univentio
n/admin/syntax.py:821
- _re_de = re.compile('^[0-9]+.[0-9]+.[0-9]+$')
+ _re_de = re.compile('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$')

- if year > 1962 and year < 2100 and month < 13 and day < 32:
+ if 1962 < year < 2100 and 1 <= month <= 12 and 1 <= day <= 31:

- if year > 0 and year < 99 and month < 13 and day < 32:
+ if 0 <= year <= 99 and 1 <= month <= 12 and 1 <= day < 31:
Comment 1 Philipp Hahn univentionstaff 2012-08-21 14:14:37 CEST
Ein Großteil ist bereits mit Bug #18527 bzw. mit Bug #16262 korrigiert worden.
In branches/ucs-3.1/ucs/management/univention-directory-manager-modules/modules/univention/admin/syntax.py sind ensprechende doctest vorhanden, die besagte Fälle abdecken, aber ein Test geht auch mit UCS-3.1 weiterhin schief:

Failed example:
    date().parse('31.2.1') #doctest: +IGNORE_EXCEPTION_DETAIL
Expected:
    Traceback (most recent call last):
    ...
    valueError:
Got:
    '31.2.1'
Comment 2 Stefan Gohmann univentionstaff 2016-04-25 07:52:11 CEST
This issue has been filed against UCS 2.4.

UCS 2.4 is out of maintenance and many UCS components have vastly changed in
later releases. Thus, this issue is now being closed.

If this issue still occurs in newer UCS versions, please use "Clone this bug".
In this case please provide detailed information on how this issue is affecting
you.
Comment 3 Florian Best univentionstaff 2016-04-25 10:00:44 CEST
Bug #41108