Bug 63277 - journalctl -b doesn't do what is expected when there are explicit disjunctions
Summary: journalctl -b doesn't do what is expected when there are explicit disjunctions
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-08 17:47 UTC by Marius Vollmer
Modified: 2013-05-06 19:18 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Possible fix (2.46 KB, patch)
2013-04-08 18:05 UTC, Marius Vollmer
Details | Splinter Review

Description Marius Vollmer 2013-04-08 17:47:58 UTC
I expect "-b" to never output entries that don't belong to the current boot, but when there are explicit disjunctions in the match expression, it gets confused.

This is correct:

   # journalctl -b -o verbose | grep _BOOT_ID | sort | uniq
	_BOOT_ID=e2e2a996e7da4fb28d56f12a9c8a5261

(only one boot id)

but this isn't:

   # journalctl -b -o verbose _PID=2 + _PID=1 | grep _BOOT_ID | sort | uniq
	_BOOT_ID=1e128df28b734458a797870d84a806ee
	_BOOT_ID=361717ded01e4a3d896f52f3bbd9cde7
	_BOOT_ID=6805fcfa65334dd188c78e54962c2f2e
	_BOOT_ID=7af680e2259a4af0b81a948950d3046b
	_BOOT_ID=91283683ba8b4164b8bde31498f85d4e
	_BOOT_ID=e2e2a996e7da4fb28d56f12a9c8a5261

(many boot ids)

I guess this happens because "-b" just adds a single "_BOOT_ID=..." match which results in an effective match expression of 

  (_BOOT_ID=... && _PID=2) || (_PID=1)

in the last case.

To fix this, the _BOOT_ID_... match needs to _also_ be added after each call to sd_journal_add_disjunction, I think.  Patch with pleasure on request.
Comment 1 Marius Vollmer 2013-04-08 17:48:20 UTC
(The "-p" option might have the same problem.)
Comment 2 Marius Vollmer 2013-04-08 18:05:01 UTC
Created attachment 77624 [details] [review]
Possible fix

Here is a quick patch.  I haven't tested this much, but it does help with the example in this bug report.
Comment 4 Lennart Poettering 2013-05-06 19:18:22 UTC
Fixed in git.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.