Package: devscripts
Version: 2.10.63
Severity: important
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Since today's upgrade uscan fails:

$ uscan -verbose -report
- -- Scanning for watchfiles in .
- -- Found watchfile in ./debian
Use of uninitialized value $package in exists at /usr/bin/uscan line 579.
[..]

I suspected that this is related to the changes with versort and
debversort (cf. #577043 and commits around this subject).

A little digging around:

* @debdirs in uscan, beforeline line 559:

$VAR1 = [
          '0.03-1',
          '.',
          'libmemoize-memcached-perl',
          '0.03'
        ];

* @debdirs afterwards:
$VAR1 = [
          '0.03-1',
          '.'
        ];

That explains why $package is not initialized in line 579 :)

So the problem is in Devscripts::Versort::deb_versort().


The _versort() sub with the map/sort/map combination gave me a bit of
a headache, so I tried to analyze it step by step (see attached
uscan.pl).

After transfering back the final result, which just maps all 4
elements, to Devscripts/Versort.pm uscan works for me in my quick
tests. Patch attached.


Cheers,
gregor

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBCAAGBQJLxJWxAAoJELs6aAGGSaoGNKgQAIqd9QMcL7RL0PbsBujmw3By
I46TriysRsOx0NhrxFOkHlpspxdUwtdPD7iaurMd7fLVsVzDFja9u7iKvG3LLqRj
K9FfF5RqG5HqvJyLvutW1+SLAwwrseQ0fLdhqz1OaC+rV6pDcuMawVMzIs8pLNrQ
ohPRB9/sa6/5x2A6KUz3VUjuAOu+iOSrg6EkoG+3/2tTOMxfP5NcH0sLL6ectEgP
rIsNkKy2swbVpF+btV4642SyvBeeFegXD7pB9SIm/k+ob3pLEZ3fhwWHFZO1SW18
e4NI/KdEqAgHF4O/jb4ZGNUj7nagrkkHz2+jcq6GpGvx7OBF214rtc4iJzyBKFJg
+g/VGjf/aw9LzMCN+iEm6YTB+/enE5VWHhMNf/iv767J/NQMpVqrfgwkzxzEt575
1cfcqaKFQAjlO5ygfVnpJAfu4CWPIiQ4uRlEfY9AEaVwJlE66Hep4kLl3LXK9Nv0
DFR8Xo3q83BRiHJ351G0RKwPJbrijDKMGsBizX7MrZ6QfnOdygeuEC562bTdkjTe
VrpxNOVk+PSEPwKa9h4AzvhHMlB65LMcqavsaCZ/YmfZAlZEFTP6iCp5cPaJ9nqk
0e0K5PDbd2Vypdi1HlpWjahrhryVvIObsbrxFYFw6De6nghC4y14Wisdedqv63lN
hjyMR2ztjDIOv8x/ckzv
=9Qil
-----END PGP SIGNATURE-----
#!/usr/bin/perl

use Dpkg::Version;
use Data::Dumper;

# status of @debdirs in uscan, 565
@namever_pairs = [ '0.03-1', '.', 'libmemoize-memcached-perl', '0.03' ];

print Dumper @namever_pairs;

my $check = 0;

# from Devscripts::Versort, sub _versort
my @sorted = map { [$_->[0], $_->[1]] }
             sort { $a->[2] <=> $b->[2] }
             map { [$_->[0], $_->[1], Dpkg::Version->new($_->[0], check => $check)] }
             @namever_pairs;

print Dumper @sorted;

# let's split it up            
my @checked = map { [$_->[0], $_->[1], Dpkg::Version->new($_->[0], check => $check)] }
              @namever_pairs;

print Dumper @checked;

# hm, at that point the package is lost, let's save it
my @checked2 = map { [$_->[0], $_->[1], $_->[2], Dpkg::Version->new($_->[0], check => $check)] }
               @namever_pairs;

print Dumper @checked2;

# and now the sort, this time with [3]
my @sorted2 = map { [$_->[0], $_->[1], $_->[2]] }
              sort { $a->[3] <=> $b->[3] }
              @checked2;

print Dumper @sorted2;

# better, stick it together
my @sortednew = map { [$_->[0], $_->[1], $_->[2]] }
                sort { $a->[3] <=> $b->[3] }
                map { [$_->[0], $_->[1], $_->[2], Dpkg::Version->new($_->[0], check => $check)] }
                @namever_pairs;

print Dumper @sortednew;

# ok, uversion is missing, maybe we need it later?
my @sortednew2 = map { [$_->[0], $_->[1], $_->[2], $_->[3]] }
                sort { $a->[4] <=> $b->[4] }
                map { [$_->[0], $_->[1], $_->[2], $_->[3], Dpkg::Version->new($_->[0], check => $check)] }
                @namever_pairs;

print Dumper @sortednew2;

# good, now it looks like at the beginning
--- Versort.pm.orig     2010-04-13 17:37:35.000000000 +0200
+++ Versort.pm  2010-04-13 17:48:03.000000000 +0200
@@ -40,9 +40,9 @@
 {
     my ($check, @namever_pairs) = @_;
 
-    my @sorted = map { [$_->[0], $_->[1]] }
-                 sort { $a->[2] <=> $b->[2] }
-                 map { [$_->[0], $_->[1], Dpkg::Version->new($_->[0], check => 
$check)] }
+    my @sorted = map { [$_->[0], $_->[1], $_->[2], $_->[3]] }
+                 sort { $a->[4] <=> $b->[4] }
+                 map { [$_->[0], $_->[1], , $_->[2], $_->[3], 
Dpkg::Version->new($_->[0], check => $check)] }
                  @namever_pairs;
 
     return reverse @sorted;

Reply via email to