Package: apt-listchanges
Version: 4.8.1
Severity: normal

The seen database expires entries after approximately 18 minutes instead of the 
intended three years.

In apt_listchanges/ALCSeenDb.py, the DbStore.expire_old() method contains:

three_years_ago = int(time.time() - 365.25 * 3)

According to the Python documentation, time.time() returns seconds since the 
Unix epoch. However, 365.25 * 3 evaluates to 1095.75, so this expression 
subtracts approximately 18 minutes and 16 seconds rather than three years.

Consequently, each time SeenDb.apply_changes() runs, previously recorded 
entries older than approximately 18 minutes are discarded. This results in 
repeated changelog notifications for entries that have already been seen.

I reproduced the issue using a copy of the seen database and the installed 
Python module, without invoking APT or installing packages.

Before adding a test package and calling apply_changes():

- Packages: 1873
- Exact checksums: 25901
- Similar checksums: 25899
- Oldest timestamp: 2026-11-26 00:10:41
- Newest timestamp: 2026-11-26 00:14:12

After adding one test package and calling apply_changes():

- Packages: 1
- Exact checksums: 0
- Similar checksums: 0
- Oldest timestamp: 2026-11-26 15:22:40
- Newest timestamp: 2026-11-26 15:22:40

All existing records were less than a day old and should have been retained.

I believe the intended calculation is:

three_years_ago = int(time.time() - 365.25 * 3 * 86400)

This may also explain symptoms described in Debian bugs #1085722 and #1109062, 
although I have not established that they share the same root cause.

The issue was reproduced on Ubuntu using apt-listchanges 4.8.1.

Reply via email to