[Bug 1978487] Re: attach_journal_errors is causing a ValueError crash
Benjamin Drung
1978487 at bugs.launchpad.net
Mon Jun 20 16:55:19 UTC 2022
I tried to reproduce this failure with following python snippet in a
kinetic schroot:
```python
#!/usr/bin/python3
import datetime
date = 'Sun Jun 12 19:52:55 2022'
print(datetime.datetime.strptime(date, '%a %b %d %H:%M:%S %Y'))
```
Regardless how I call this script, it always succeeds to parse the date
string. Example:
```
$ env -i LANGUAGE=nb_NO:nb:no_NO:no:nn_NO:nn:en LANG=nb_NO.UTF-8 ./test.py
2022-06-12 19:52:55
$ env -i LANGUAGE=C LANG=C.UTF-8 ./test.py
2022-06-12 19:52:55
$ env -i ./test.py
2022-06-12 19:52:55
```
Python's _strptime checks that the provided data_string is an instance
of str. passing a wrong type to strptime can be ruled out as well.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/1978487
Title:
attach_journal_errors is causing a ValueError crash
Status in Apport:
New
Status in apport package in Ubuntu:
New
Bug description:
As seen in https://bugs.launchpad.net/ubuntu/+source/obs-
studio/+bug/1978414 with ApportVersion: 2.21.0-0ubuntu2.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport/report.py", line 205, in _run_hook
symb['add_info'](report, ui)
File "/usr/share/apport/general-hooks/generic.py", line 94, in add_info
apport.hookutils.attach_journal_errors(report)
File "/usr/lib/python3/dist-packages/apport/hookutils.py", line 740, in attach_journal_errors
crash_time = report.get_date()
File "/usr/lib/python3/dist-packages/problem_report.py", line 268, in get_date
return datetime.datetime.strptime(self['Date'], '%a %b %d %H:%M:%S %Y')
File "/usr/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/lib/python3.10/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data 'Sun Jun 12 19:52:55 2022' does not match format '%a %b %d %H:%M:%S %Y'
To manage notifications about this bug go to:
https://bugs.launchpad.net/apport/+bug/1978487/+subscriptions
More information about the foundations-bugs
mailing list