Subject: 27.1.91; (gnus-agent-expire) leaves the last article per group

From: Teemu Likonen <[email-masked]>
Date: Mon, 15 Feb 2021 15:45:07 +0200

Gnus mail and news client has "agent" feature for caching articles
locally. The local cache can be expired by command "M-x
gnus-agent-expire".

However, the expiry does not always expire all cached articles. It seems
that the expiry mechanism leaves one article file if there are not any
newer articles in the same group.

For example, currently in my system all article files older than
2021-02-08 have been expired. Yet one older file remains:

    $ cd "$HOME/News/agent/nntp"
    $ find . -type f -regex '.*/[0-9]+$' -print0 | \
        xargs -0r ls -gGltu | tail -n3

    -rw-r--r-- 1   1104 2021-02-08 08:10:18 ./september/alt/os/linux/69718
    -rw-r--r-- 1   5350 2021-02-08 08:10:04 ./gmane/gmane/emacs/gnus/user/19400
    -rw-r--r-- 1   5394 2021-02-05 19:41:11 ./gmane/gmane/ietf/openpgp/9871

There is one file with access time ("ls -ltu") 2021-02-05. It should
have been removed already but it is the last article in its group so it
remains. I think I have seen such articles expire after new article
arrives in the same group.

There is not any easy recipe for reproducing the behaviour. You have to
set up Gnus agent and make Gnus cache some articles. Here's a start:

    ;; Expire everything before today.
    (setq gnus-agent-expire-days 0)

    ;; Fetch all selected articles.
    (add-hook 'gnus-select-article-hook 'gnus-agent-fetch-selected-article)

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450