#1140236 devscripts: uscan creates wrong version if regex contains parentheses for grouping

Package:
devscripts
Source:
devscripts
Description:
scripts to make the life of a Debian Package maintainer easier
Submitter:
Christoph Martin
Date:
2026-06-18 15:05:03 UTC
Severity:
normal
#1140236#5
Date:
2026-06-17 13:58:25 UTC
From:
To:
if a debian/watch file contains parentheses for grouping in the
regex, uscan misinterpretes these parentheses for additional matches
for the upstream version number which results in wrong $newversion
value.

An example can be found in the cfengine3 package where the following
pattern should select only the minor versions which are devisible by
three:

(\d+\.([0369]|[147][0369]*([147][0369]*[258][0369]*)*([147][0369]*[147]|[258])|[258][0369]*([258][0369]*[147][0369]*)*([258][0369]*[258]|[147]))+\.\d+)

uscan outputs the following version:

     $newversion         = 3.27.1.27....7

instead of

     $newversion         = 3.27.1
--- /etc/devscripts.conf ---
Empty.
--- ~/.devscripts --- export DEBEMAIL=chrism@debian.org export DEBFULLNAME='Christoph Martin' export DEBSIGN_KEYID="4C8F 6B0D 121E B15F 076F EB17 04EE 131A E6D6 21BE" export DEBCOMMIT_SIGN_TAGS=yes
#1140236#10
Date:
2026-06-18 09:00:36 UTC
From:
To:
Seems that nested capturing groups are confusing uscan, I think it expects a
single capturing group with the version.

I am not an expert in advanced perl regex, but seems that making inner
groups non-capturing helps here,

Matching-Pattern: .*/(\d+\.(?:[0369]|[147][0369]*(?:[147][0369]*[258][0369]*)*(?:[147][0369]*[147]|[258])|[258][0369]*(?:[258][0369]*[147][0369]*)*(?:[258][0369]*[258]|[147]))+\.\d+)@ARCHIVE_EXT@

Just a blind guess, use with care.

Hope it helps,

#1140236#15
Date:
2026-06-18 15:04:52 UTC
From:
To:
Hi Agustin,

a very good hint. I didn't know about the ?: qualifier. But that did the
trick in the cfengine3 case.

Thanks
Christoph

Am 18.06.26 um 11:00 schrieb Agustin Martin: