On Mon, Aug 25, 2025 at 05:08:09PM +0100, Andrew Bower wrote:
> How does the attached patch, following your suggestion, look to you?
>
> After rotation:
>
> $ last
> wtmpdb has no entries
Hi Andrew.
I'm not versed enough in DH to grasp all the details, but what I could
understand looks fine.
A couple of tiny points, bordering on paranoia:
- If I'm not wrong, there's a very small window for a race in the
postrotate action, that can be mitigated like this:
cp /usr/share/wtmpdb/empty.db $1.rnew
chown --reference=$2 $1.rnew
chmod --reference=$2 $1.rnew
ln $1.rnew $1 2>/dev/null || true
rm -f $1.rnew
- After reviewing the logrotate manpage, I'm a little uncomfortable
with this sentence in the olddir description: "The directory must be
on the same physical device as the log file being rotated, unless
copy, copytruncate or renamecopy option is used".
What happens if /var/lib/wtmpdb and /var/log belong to distinct
filesystems?
Maybe it suffices to add "renamecopy" to prevent any possible problem.
Best regards,
g.b.