#1148761 uscan: Metacpan template returning nonexistent version, and other issues

Package:
devscripts
Source:
devscripts
Description:
scripts to make the life of a Debian Package maintainer easier
Submitter:
Sébastien Villemot
Date:
2026-09-23 09:15:02 UTC
Severity:
normal
#1148761#5
Date:
2026-09-23 09:13:17 UTC
From:
To:
Dear Maintainer,

I’ve tried to use the Metacpan template for the libfinance-quote-perl package,
using the following minimal debian/watch:


Version: 5

Template: Metacpan
Dist: Finance::Quote


But uscan then returns an incorrect (and nonexistent) version. Here is an exceprt:

uscan info: Scan watch files in .
uscan info: Check debian/watch and debian/changelog in .
uscan info: package="libfinance-quote-perl" version="1.71-1" (as seen in debian/changelog)
uscan info: package="libfinance-quote-perl" version="1.71" (no epoch/revision)
uscan info: ./debian/changelog sets package="libfinance-quote-perl" version="1.71"
uscan info: Process watch file at: debian/watch
    package = libfinance-quote-perl
    version = 1.71
    pkg_dir = .
uscan info: Parsing mode: metacpan
uscan info: Parsing pgpmode: none
uscan info: Parsing uversionmangle: s/\d\K[_.+-]?((?i)dev|pre|alpha|beta|rc)[.-]?/~$1/
uscan info: Parsing versiontype: (?:[-_]?[Vv]?(\d[\-+\.:\~\da-zA-Z]*))
uscan info: Last orig.tar.* tarball version (from debian/changelog): 1.71
uscan info: Last orig.tar.* tarball version (dversionmangled): 1.71
uscan info: Searching versions of Finance-Quote
uscan info: Found the following matching files on the web page (newest first):
https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.5402.tar.gz (1.5402) index=1.5402-1
https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.5401.tar.gz (1.5401) index=1.5401-1
https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.5301.tar.gz (1.5301) index=1.5301-1
https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.71.tar.gz (1.71) index=1.71-1
https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.70.tar.gz (1.70) index=1.70-1
https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.69.tar.gz (1.69) index=1.69-1
https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.68.tar.gz (1.68) index=1.68-1
[…]
https://cpan.metacpan.org/authors/id/P/PJ/PJF/Finance-Quote-1.04.tar.gz (1.04) index=1.04-1
uscan info: uscan parser results:
    $base               = Finance-Quote
    $filepattern        = https://cpan.metacpan.org/.*Finance-Quote-(?:[-_]?[Vv]?(\d[\-+\.:\~\da-zA-Z]*))(?i)(?:\.(?:tar\.xz|tar\.bz2|tar\.gz|tar\.zstd?|zip|tgz|tbz|txz))
    $newfile            = https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.5402.tar.gz
    $mangled_newversion = 1.5402
    $newversion         = 1.5402
    $lastversion        = 1.71
uscan info: Upstream URL(+tag) to download is identified as    https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.5402.tar.gz
uscan info: Filename (filenamemangled) for downloaded file: Finance-Quote-1.5402.tar.gz
Newest version of libfinance-quote-perl on remote site is 1.5402, local version is 1.71
 => Newer package available from:
        => https://cpan.metacpan.org/authors/id/B/BP/BPSCHUCK/Finance-Quote-1.5402.tar.gz
uscan info: Scan finished


As you can see, it detects 1.5402 as being the most recent version, instead of
the correct 1.71 (since 1.5402 > 1.71 using standard version ordering rules).

I reported this problem to upstream and to CPAN people, see this GitHub issue:
https://github.com/metacpan/metacpan-web/issues/3735

Apparently this is related to a so-called Backpan directory, which keeps old
deleted versions. Several suggestions were made in the GitHub issue on how to
fix this in uscan, and some additional unrelated issues were also reported. I
copy the relevant comments here for completeness:

Thanks for your work,