my @directory = File::Spec::Unix->splitdir($directory);
my $package_name = $directory[0];
- # Quote this once here to avoid recompiling the pattern for each line of
- # the maintainers.bypkg file; the \Q and \E are probably not needed,
- # since package names should not contain regex metacharacters but are an
- # extra protection measure, in case a package name contains "+" or so.
- my $package_name_re = qr/^\Q$package_name\E\s+-\s+/;
-
- my %addresses;
my @email_files = directory_configuration_files('email', $directory);
END
unless -f File::Spec->catfile($package_config_base, $package_name, 'email');
+ my @addresses;
+
foreach my $file (@email_files) {
open EMAIL_FILE, '<', $file or ftp_abort("open($file) failed: $!");
while (<EMAIL_FILE>) {
chomp;
- $addresses{$1}++
+ push @addresses, $1
if m/^([[:graph:]]+[@][[:graph:]]+)$/; # simple sanity check and untaint
}
close EMAIL_FILE or ftp_warn("close($file) failed: $!");
}
# Now also look for all maintainer addresses in the maintainers.bypkg file
+ my $needle = $package_name.' - ';
+ my $nlen = length $needle;
open EMAIL_FILE, '<', $maintainers_bypkg
or ftp_abort("open($maintainers_bypkg) failed: $!");
while (<EMAIL_FILE>) {
chomp;
- next unless m/$package_name_re/g; # find the line for this package
+ next unless $needle eq substr $_,0,$nlen; # find the line for this package
# crawl through it, collecting email addresses
- $addresses{$1}++ while m/\G[^<]*<([^@]+[@][^>]+)>/g;
+ pos = $nlen;
+ push @addresses, $1 while m/\G[^<]*<([^@]+[@][^>]+)>/g;
}
close EMAIL_FILE or ftp_warn("close($maintainers_bypkg) failed: $!");
- return keys %addresses;
+ return @addresses;
}
\f