Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix parsing dates with months abbreviated in some locales #1344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

symphorien
Copy link

Current code first attempts to detect english abbreviations for %b and only if the string does not start with one of the months, tries the locale specific names.

This is incorrect for some locales.
For example in fr_FR %b for november is nov.. Parsing nov. 29 as %b %d would fail because we wrongly assume that the month is just nov and not nov.. Then we attempt to parse . 29 as %d.

The correct solution would be to try english and if later the string does not match to backtrack, but this does not match the existing flow of the code.

Instead this restricts the fast path to matching full words to the english locale, not only prefixes.

Fixes: #1086

Current code first attempts to detect english abbreviations for %b and
only if the string does not start with one of the months, tries
the locale specific names.

This is incorrect for some locales.
For example in fr_FR %b for november is `nov.`. Parsing `nov. 29` as `%b
%d` would fail because we wrongly assume that the month is just `nov`
and not `nov.`. Then we attempt to parse `. 29` as ` %d`.

The correct solution would be to try english and if later the string
does not match to backtrack, but this does not match the existing flow
of the code.

Instead this restricts the fast path to matching full words to the
english locale, no only prefixes.

Fixes: tstack#1086
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

syslog_log file format fails to recognise journalctl output in non-english locale
1 participant