<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - journalctl -b doesn't do what is expected when there are explicit disjunctions"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=63277">63277</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>journalctl -b doesn't do what is expected when there are explicit disjunctions
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>marius.vollmer@redhat.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>