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

journalctl -r -n flags incorrectly processed #1596

Open
ceecko opened this Issue Oct 17, 2015 · 0 comments

Comments

2 participants
@ceecko
Copy link

ceecko commented Oct 17, 2015

I'm running version 208 - unfortunately I can't install the latest version but the issues seems to be present in the master as well as of writing.

journalctl --version
systemd 208
+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ

Consider the following log entries:

2015-01-01 log1
2015-02-02 log2
2015-03-03 log3
2015-04-04 log4

Issuing journalctl -n 2 properly shows this:

2015-03-03 log3
2015-04-04 log4

However issuing journalctl -r -n 2 shows this:

2015-02-02 log2
2015-01-01 log1

This is because in journalctl.c line 2087 skips journal by arg_lines but doesn't take into account arg_reverse. Consequently on line 2153 the journal is read from arg_lines backwards which ultimately skips first arg_lines lines.

The expected output of journalctl -r -n 2 is:

2015-04-04 log4
2015-03-03 log3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.