Bug#457295: analysis + patch for people.pl bug
tag 457295 + patch
Hi,
the problem is that cron/people_scritps/people.pl makes incorrect assumptions
about the ordering of fields in a record returned by ldapsearch.
Attached patch fixes the problem.
Kind regards
T.
--
Thomas Viehmann, http://thomas.viehmann.net/
Index: people.pl
===================================================================
RCS file: /org/cvs.debian.org/cvs/webwml/cron/people_scripts/people.pl,v
retrieving revision 1.21
diff -u -r1.21 people.pl
--- people.pl 23 May 2007 14:27:02 -0000 1.21
+++ people.pl 21 Dec 2007 15:14:40 -0000
@@ -484,7 +484,7 @@
my $filename = @_;
my (%uid, %page, $name);
- my ($ldap_cn, $ldap_sn);
+ my ($ldap_cn, $ldap_sn, $ldap_labeledURI);
# get the stuff from the LDAP database
foreach (`ldapsearch -x -h db.debian.org -b dc=debian,dc=org uid=\* cn mn sn labeledURI`) {
@@ -505,9 +505,14 @@
# warn "had to decode: $worddata\n";
}
elsif ($line =~ /^labeledURI(=|: )(.+)$/) {
- my $homepageurl = $2;
+ $ldap_labeledURI = $2;
+ }
+ elsif ($line =~ /^((version|search|result):|#)/) { next; }
+ elsif ($line eq "") {
+ # empty line terminates record
+ if ($ldap_labeledURI and ($ldap_cn ne "Debian BTS")) {
+ my $homepageurl = $ldap_labeledURI;
$homepageurl =~ s,^www,http://www,;
- # warn $ldap_cn." ".$ldap_sn." ".$homepageurl."\n";
my $has_package = 0;
foreach my $person (keys %People) {
if ($person =~ /(.*):(.*)/) {
@@ -523,17 +528,17 @@
}
}
if (!$has_package) {
- # for some reason, the debbugs user is in the LDAP database, and we don't need it
- next if ($ldap_cn eq "Debian BTS");
-
# they don't seem to have any packages, but add them anyway
my $person = "$ldap_sn:$ldap_cn";
$People{$person}{email} = "";
$People{$person}{homepage} = $homepageurl;
# warn "Adding $person even though they don't have any packages\n";
}
+ }
+ undef $ldap_labeledURI;
+ undef $ldap_sn;
+ undef $ldap_cn;
}
- elsif ($line eq "" or $line =~ /^((version|search|result):|#)/) { next; }
else { die "Error: unknown format on line $.:\n$_\n"; }
}
Reply to: