Bug 979487 - sd_journal_seek_tail doesn't go to end
sd_journal_seek_tail doesn't go to end
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-28 12:19 EDT by Frank Ch. Eigler
Modified: 2015-10-20 08:59 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-10-20 08:59:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Frank Ch. Eigler 2013-06-28 12:19:37 EDT
On systemd 201 (f18) and 204 (rawhide), the attached toy program loops for quite a while, consuming journald entries immediately after it did an sd_journal_seek_tail(), to go to the last entry.  It's as though the tail sought is not the real final entry (systemwide), though not the head either.


% cat sample.c
#include <systemd/sd-journal.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>


void main(int argc, char *argv[]) {
  sd_journal* journald_context;
  int count;
  int rc;

  rc = sd_journal_open(& journald_context, 0);
  assert (rc == 0);
  if (argc == 2 && !strcmp(argv[1],"tail"))
    rc = sd_journal_seek_tail(journald_context);
  else if (argc == 2 && !strcmp(argv[1],"head"))
    rc = sd_journal_seek_head(journald_context);
  else
    rc = 0;
  assert (rc == 0);

  for (count=0 ; ; count++) {
    char *cursor;
    rc = sd_journal_next(journald_context);
    assert (rc >= 0);
    if (rc == 0) break;
    rc = sd_journal_get_cursor(journald_context, &cursor);
    assert (rc == 0);
    printf ("#%d: cursor %s\n", count, cursor);
    free (cursor);
  }
}

% gcc sample.c -lsystemd-journal
% a.out head | wc -l
--- expecting this to be a large number; on my f18 workstation, 189350
% a.out tail | wc -l
--- expecting this to be near-zero; on my f18 workstation, 188492
Comment 1 Fedora End Of Life 2013-09-16 10:17:49 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle.
Changing version to '20'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20
Comment 2 Frank Ch. Eigler 2013-10-03 10:29:11 EDT
I found that adding a sd_journal_previous_skip (..., 1) call after
the sd_journal_seek_tail (like journalctl -f does) makes things work.
It would be nice if this workaround were not necessary (or else
documented).
Comment 3 Jakub Filak 2014-06-30 11:23:01 EDT
The sd_journal_seek_tail() works as expected with systemd-208-11.el7.x86_64,
but does not work with systemd-208-19.fc20.x86_64 and systemd-214-4.fc21.x86_64.
Comment 4 Fedora End Of Life 2015-05-29 05:08:30 EDT
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 5 Fedora End Of Life 2015-06-29 08:01:58 EDT
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 6 Jan Kurik 2015-07-15 10:47:18 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
Comment 7 Jan Synacek 2015-10-20 08:59:50 EDT
This is fixed on F23.

$ ./a.out head | wc -l
809933

$ ./a.out tail | wc -l
56

$ rpm -q systemd
systemd-222-7.fc23.x86_64

Note You need to log in before you can comment on or make changes to this bug.