On Sun, 31 Dec 2023 02:27:43 +0100 =?utf-8?B?0L3QsNCx?=
<[email protected]> wrote:
> Package: devscripts
> Version: 2.23.4+deb12u1
> Severity: normal
> File: /usr/bin/uscan
>
> Dear Maintainer,
>
> Given:
>   $ head debian/*
>   ==> debian/changelog <==
>   snappy-tools (0-1) unstable; urgency=low
>
>   ==> debian/watch <==
>   version=4
>   opts="pgpsigurlmangle=s:$:.asc:" \
>     https://git.sr.ht/~nabijaczleweli/snappy-tools/refs 
> .*/([0-9][0-9a-zA-Z]*)@ARCHIVE_EXT@
> (and an equivalent but fully-populated debian/,
>  with a fully-correct d/changelog and populated d/upstream/signing-key.asc)
> uscan gives me
>   $ uscan --download-current-version --force-download -v
>   uscan info: uscan (version 2.23.4+deb12u1) See uscan(1) for help
>   uscan info: Scan watch files in .
>   uscan info: Check debian/watch and debian/changelog in .
>   uscan: warning:     debian/changelog(l1): found end of file where expected 
> start of change data
>   uscan info: package="snappy-tools" version="0-1" (as seen in 
> debian/changelog)
>   uscan info: package="snappy-tools" version="0" (no epoch/revision)
>   uscan info: ./debian/changelog sets package="snappy-tools" version="0"
>   uscan info: Process watch file at: debian/watch
>       package = snappy-tools
>       version = 0
>       pkg_dir = .
...
>      https://git.sr.ht/~nabijaczleweli/snappy-tools/archive/0.tar.gz (0) 
> index=0-1 matched with the download version
>      https://git.sr.ht/~nabijaczleweli/snappy-tools/archive/0.tar.gz (0) 
> index=0-1 matched with the download version
>   uscan info: Scan finished
>
> I use the exact same d/watch for urlview (and other packages),
> and it works there.
>
> Actually, having just made a fake version 0a, I see that it /did/
> download that.
...
> Does uscan simply refuse to download version 0?
> Is this a bizarre perlism (version "0" => if version => false)?

Hi, thanks for pointing out this corner case.

It is indeed a perlism, if($version) will test false if $version is 0.

Attached patch should deal with this corner case by using defined. It
is a trivial patch (problem was to find where it was needed) and
should be safe. If no one objects or commits before I would like to
commit soon this change directly to devscripts repo.

Hope this helps,

-- 
Agustin
From 29d349eb3cc71985e21cfc23530a50ab4cc6dbb7 Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <[email protected]>
Date: Wed, 8 Apr 2026 23:59:19 +0200
Subject: [PATCH] Uscan/WatchSource.pm: Deal with "0" package version.

Packages may have version "0" in some corner cases. This
makes if($version) test result "false"  in that case,
causing package not downloaded even if expliticly told
to do so. Use "defined" to care of these corner cases.

Closes: #1059734
---
 lib/Devscripts/Uscan/WatchSource.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/Devscripts/Uscan/WatchSource.pm b/lib/Devscripts/Uscan/WatchSource.pm
index 2586e1ff..8e06c7cd 100644
--- a/lib/Devscripts/Uscan/WatchSource.pm
+++ b/lib/Devscripts/Uscan/WatchSource.pm
@@ -890,7 +890,9 @@ sub search {
     my ($self) = @_;
     uscan_debug "line: search()";
     my ($mangled_newversion, $newversion, $newfile) = $self->_do('search');
-    unless ($mangled_newversion and $newversion and $newfile) {
+    unless (defined $mangled_newversion
+        and defined $newversion
+        and defined $newfile) {
         return $self->status(1);
     }
     $self->status and return $self->status;
-- 
2.47.3

Reply via email to