Hi g.b,

On Tue, Aug 26, 2025 at 02:22:42PM +0200, [email protected] wrote:
> On Tue, Aug 26, 2025 at 08:36:54AM +0100, Andrew Bower wrote:
> > [...]
> > >   Maybe it suffices to add "renamecopy" to prevent any possible problem.
[...]
> Granted, if wtmpdb used /var/log/wtmp.db instead of /var/lib/wtmpdb/wtmp.db
> the rest of the world would be much simpler.
> 
> The path is hardcoded in include/wtmpdb.h, although a debian patch could
> override that.  A symlink would do too.

I have thought this all over many times. There are so many ways in which
wtmpdb makes a slightly unfortunate decision that's hard to get around
without breaking or extending the library ABI, which upstream is really
resistant to touch (even with backwards-compatible extensions). I fear
that changing that header file will not be welcome. We'd certainly have
to be careful how it were done anyway. And the fact that the library API
is so limiting might lead people to treat the database as the point of
integration.

Really I think there should be a new libwtmpdb1 with an improved
interface design but it seems libwtmpdb0 has ossified. It would have
helped if wtmpdb had run in parallel with wtmp tools checked to use
glibc 2.40's unsigned seconds field for one OS release cycle while we
learnt what was good and what was bad but we have missed that
opportunity!

My conclusion is that your symlink idea is the best. But even that would
take some care to get right at the package level.

What I have decided to do is to leave the current log where it is, at
least for now, and rely on logrotate's 'renamecopy' mode doing a
satisfactory job.

I have patched wtmpdb to accept an empty file without error and
therefore have the same semantics as the classic 'last' command, as it
should do. This means the 'create' option in logrotate works perfectly
and even preserving mode and owner, solving #1076308 for us at the same
time and not requiring any postrotate script.

I am pretty happy with this solution and intend to upload this to
the 'experimental' suite soon.

Thank you for your suggestions, reviews, etc. This solution is much
better for your input. Let me know if and how you would like to be
credited in the changelog as you appear to be going by pseudonym! :-)

With much apprecation for your insight,

Andrew

Reply via email to