[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#374203: First patch



Package: www.debian.org
Followup-For: Bug #374203

I have made a patch which _seems_ to at least make the situation better.
However, I'm not sure how to make the tests (I have tried a couple of things
in gluck, but I haven't been able to get the page published in
w.d.o/devel/people with the CVS version), so I don't know what will the
patched script output, when given the correct arguments.

How can I find out how to call the script, so I get the published output and
start doing real tests?

Meanwhile, can you review the patch or make any comments?

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-686
Locale: LANG=es_ES@euro, LC_CTYPE=ISO_8859_1 (charmap=ISO-8859-15) (ignored: LC_ALL set to es_ES@euro)
--- people.pl.orig	2006-08-21 07:31:07.000000000 -0600
+++ people.pl	2006-08-21 07:58:42.000000000 -0600
@@ -483,11 +483,13 @@
 sub process_homepages {
   my $filename = @_;
 
-  my (%uid, %page, $name);
+  my (%uid, %page, $name, $homepageurl);
   my ($ldap_cn, $ldap_sn);
 
   # get the stuff from the LDAP database
+  my $line_n = 0;
   foreach (`ldapsearch -x -h db.debian.org -b dc=debian,dc=org uid=\* cn mn sn labeledURI`) {
+    $line_n++;
     chomp; my $line = $_;
     if ($line =~ /^(dn: )?uid=(.+),.+$/) { $name = $2; }
     elsif ($line =~ /^cn(=|: )(.+)$/) { $ldap_cn = from_utf8_or_iso88591_to_sgml($2); }
@@ -505,9 +507,15 @@
 #      warn "had to decode: $worddata\n";
     }
     elsif ($line =~ /^labeledURI(=|: )(.+)$/) {
-	my $homepageurl = $2;
+	$homepageurl = $2;
 	$homepageurl =~ s,^www,http://www,;
+    }
+    elsif ($line eq "" or $line =~ /^((version|search|result):|#)/) {
 	# warn $ldap_cn." ".$ldap_sn." ".$homepageurl."\n";
+	unless (defined $ldap_cn) {
+	    print STDERR "Skipping data, as cn appears to be empty (line $line_n)\n";
+	    next;
+	}
 	my $has_package = 0;
 	foreach my $person (keys %People) {
 		if ($person =~ /(.*):(.*)/) {
@@ -532,8 +540,9 @@
 		$People{$person}{homepage} = $homepageurl;
 		# warn "Adding $person even though they don't have any packages\n";
 	}
+
+	$homepageurl = $name = $ldap_cn = $ldap_sn = "";		# Reset data
     }
-    elsif ($line eq "" or $line =~ /^((version|search|result):|#)/) { next; }
     else { die "Error: unknown format on line $.:\n$_\n"; }
   }
 

Reply to: