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

syslog_log file format fails to recognise journalctl output in non-english locale #1086

Open
symphorien opened this issue Nov 29, 2022 · 0 comments · May be fixed by #1344
Open

syslog_log file format fails to recognise journalctl output in non-english locale #1086

symphorien opened this issue Nov 29, 2022 · 0 comments · May be fixed by #1344
Labels

Comments

@symphorien
Copy link

lnav version
current master 9034bc2

Describe the bug
I am in a french locale (LANG=fr_FR.UTF-8)
with journalctl I get for example:

nov. 29 20:23:37 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
nov. 29 20:23:41 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
nov. 29 20:23:41 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
nov. 29 20:23:46 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
nov. 29 20:23:46 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
nov. 29 20:23:48 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
nov. 29 20:23:48 uqbar rtkit-daemon[2654]: Supersvising 0 threads of 0 processes of 0 users.
nov. 29 20:23:50 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
nov. 29 20:23:50 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.

running lnav on this file recognises it as plain text.
Now running LANG=C journalctl instead yields:

Nov 29 20:23:37 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:37 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:41 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:41 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:46 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:46 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:48 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:48 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:50 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.
Nov 29 20:23:50 uqbar rtkit-daemon[2654]: Supervising 0 threads of 0 processes of 0 users.

and lnav recognizes this as syslog_log

To Reproduce
put the above snippets in files and run lnav on them.

Additional notes
this was already reported in #533 which you kindly fixed in 26cccda

would you mind adding a regression test for this?

@symphorien symphorien added the bug label Nov 29, 2022
symphorien added a commit to symphorien/lnav that referenced this issue Nov 22, 2024
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
symphorien added a commit to symphorien/lnav that referenced this issue Nov 22, 2024
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant