Package: devscripts
Version: 2.20.3
Severity: minor

Hi,

while working on another problem, I noticed something weird in the code.

See 
https://salsa.debian.org/debian/devscripts/-/blob/master/lib/Devscripts/Uscan/FindFiles.pm#L167-193

There is a comment there, that says:

    # Now process the watch files in order.  If a directory d has
    # subdirectories d/sd1/debian and d/sd2/debian, which each contain watch
    # files corresponding to the same package, then we only process the watch
    # file in the package with the latest version number.

This seems to be implemented by sorting the watch files on version, and then
once you see a package that was previously already processed, skip it. However,
that skipping is implemented like this:


    if (exists $donepkgs{$parentdir}{$package}) {
        uscan_warn "Skipping $dir/debian/watch\n   as this package has already 
been found";
        next;
    }

IOW, it skips if a package was already processed that has both the same
$parentdir (e.g. the `foo-1.2.3` directory that contains the `debian` dir),
*and* the same $package (i.e. the package name parsed from `debian/changelog`).

This seems weird to me, I would think that just the same package name
should be enough. However, I could not find this behaviour mentioned in
the manpage at all, so I'm not exactly sure what the intended behaviour
is exactly.

To show this happens:

$ mkdir -p uscantest/test-1.2.3/debian
$ mkdir -p uscantest/test-2.0.0/debian
$ cd uscantest/
uscantest$ (cd test-1.2.3; dch --create --package test --newversion 1.2.3-1)
uscantest$ (cd test-2.0.0; dch --create --package test --newversion 2.0.0-1)
uscantest$ touch test-1.2.3/debian/watch test-2.0.0/debian/watch
uscantest$ uscan --report-status
uscan info: uscan (version 2.20.4~1.gbp0dd0c3) See uscan(1) for help
uscan info: Scan watch files in .
uscan info: Check debian/watch and debian/changelog in ./test-1.2.3
uscan info: package="test" version="1.2.3-1" (as seen in debian/changelog)
uscan info: package="test" version="1.2.3" (no epoch/revision)
uscan info: Check debian/watch and debian/changelog in ./test-2.0.0
uscan info: package="test" version="2.0.0-1" (as seen in debian/changelog)
uscan info: package="test" version="2.0.0" (no epoch/revision)
uscan info: ./test-2.0.0/debian/changelog sets package="test" version="2.0.0"
uscan info: ./test-1.2.3/debian/changelog sets package="test" version="1.2.3"
uscan info: Process watch file at: debian/watch
    package = test
    version = 2.0.0
    pkg_dir = ./test-2.0.0
uscan info: Process watch file at: debian/watch
    package = test
    version = 1.2.3
    pkg_dir = ./test-1.2.3
uscan info: Scan finished

It indeed processes the packages in descending version order, but does not skip
the lower version of the same package as the comment implies should happen.

I've tested this with current git master, so I used the most recently released
version number in the bug metadata.

Gr.

Matthijs

Reply via email to