This file is indexed.

/usr/bin/dd-list is in devscripts 2.17.12ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#!/usr/bin/perl
#
# dd-list: Generate a list of maintainers of packages.
#
# Written by Joey Hess <joeyh@debian.org>
# Modifications by James McCoy <jamessan@debian.org>
# Based on a python implementation by Lars Wirzenius.
# Copyright 2005 Lars Wirzenius, Joey Hess
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

use strict;
use warnings;
use FileHandle;
use Getopt::Long qw(:config bundling permute no_getopt_compat);
use Dpkg::Version;
use Dpkg::IPC;

my $uncompress;

BEGIN {
    $uncompress = eval {
	require IO::Uncompress::AnyUncompress;
	IO::Uncompress::AnyUncompress->import('$AnyUncompressError');
	1;
    };
}

my $version='2.17.12ubuntu1';

sub normalize_package {
    my $name = shift;
    # Remove any arch-qualifier
    $name =~ s/:.*//;
    return lc($name);
}

sub sort_developers {
    return map { $_->[0] }
	   sort { $a->[1] cmp $b->[1] }
	   map { [$_, uc] } @_;
}

sub help {
	print <<"EOF"
Usage: dd-list [options] [package ...]

    -h, --help
        Print this help text.

    -i, --stdin
        Read package names from the standard input.

    -d, --dctrl
        Read package list in Debian control data from standard input.

    -z, --uncompress
        Try to uncompress the --dctrl input before parsing.  Supported
        compression formats are gz, bzip2 and xz.

    -s, --sources SOURCES_FILE
        Read package information from given SOURCES_FILE instead of all files
        matching /var/lib/apt/lists/*_source_Sources.  Can be specified
        multiple times.  The files can be gz, bzip2 or xz compressed.

    -u, --uploaders
        Also list Uploaders of packages, not only the listed Maintainers
        (this is the default behaviour, use --nouploaders to prevent this).

    -nou, --nouploaders
        Only list package Maintainers, do not list Uploaders.

    -b, --print-binary
        If binary package names are given as input, print these names
        in the output instead of corresponding source packages.

    -V, --version
        Print version (it\'s $version by the way).
EOF
}

my $use_stdin=0;
my $use_dctrl=0;
my $source_files=[];
my $show_uploaders=1;
my $opt_uncompress=0;
my $print_binary=0;
GetOptions(
    "help|h" => sub { help(); exit },
    "stdin|i" => \$use_stdin,
    "dctrl|d" => \$use_dctrl,
    "sources|s=s@" => \$source_files,
    "uploaders|u!" => \$show_uploaders,
    'z|uncompress' => \$opt_uncompress,
    "print-binary|b" => \$print_binary,
    "version" => sub { print "dd-list version $version\n" })
or do {
    help();
    exit(1);
};

if ($opt_uncompress && !$uncompress) {
    warn "You must have the libio-compress-perl package installed to use the -z option.\n";
    exit 1;
}

my %dict;
my $errors=0;
my %package_name;

sub parsefh
{
    my ($fh, $fname, $check_package) = @_;
    local $/="\n\n";
    my $package_names;
    if ($check_package) {
	$package_names = sprintf '(?:^| )(%s)(?:,|$)',
				 join '|',
				 map { "\Q$_\E" }
				 keys %package_name;
    }
    my %sources;
    while (<$fh>) {
	my ($package, $source, $binaries, $maintainer, @uploaders);

	# These source packages are only kept around because of stale binaries
	# on old archs or due to Built-Using relationships.
	if (/^Extra-Source-Only:\s+yes/m) {
	    next;
	}

	# Binary is shown in _source_Sources and contains all binaries produced by
	# that source package
	if (/^Binary:\s+(.*(?:\n .*)*)$/m) {
	    $binaries = $1;
	    $binaries =~ s/\n//;
	}
	# Package is shown both in _source_Sources and _binary-*.  It is the
	# name of the package, source or binary respectively, being described
	# in that control stanza
	if (/^Package:\s+(.*)$/m) {
	    $package=$1;
	}
	# Source is shown in _binary-* and specifies the source package which
	# produced the binary being described
	if (/^Source:\s+(.*)$/m) {
	    $source=$1;
	}
	if (/^Maintainer:\s+(.*)$/m) {
	    $maintainer=$1;
	}
	if (/^Uploaders:\s+(.*(?:\n .*)*)$/m) {
	    my $matches=$1;
	    $matches =~ s/\n//g;
	    @uploaders = split /(?<=>)\s*,\s*/, $matches;
	}
	my $version = '0~0~0';
	if (/^Version:\s+(.*)$/m) {
	    $version = $1;
	}

	if (defined $maintainer
	    && (defined $package || defined $source || defined $binaries)) {
	    $source ||= $package;
	    $binaries ||= $package;
	    my @names;
	    if ($check_package) {
		my @pkgs;
		if (@pkgs = ($binaries =~ m/$package_names/g)) {
		    $sources{$source}{$version}{binaries} = [@pkgs];
		}
		elsif ($source !~ m/$package_names/) {
		    next;
		}
	    }
	    else {
		$sources{$source}{$version}{binaries} = [$binaries];
	    }
	    $sources{$source}{$version}{maintainer} = $maintainer;
	    $sources{$source}{$version}{uploaders} = [@uploaders];
	}
	else {
	    warn "E: parse error in stanza $. of $fname\n";
	    $errors=1;
	}
    }

    for my $source (keys %sources) {
	my @versions = sort map { Dpkg::Version->new($_) } keys %{$sources{$source}};
	my $version = $versions[-1];
	my $srcinfo = $sources{$source}{$version};
	my @names;
	if ($check_package) {
	    $package_name{$source}--;
	    $package_name{$_}-- for @{$srcinfo->{binaries}};
	}
	@names = $print_binary ? @{$srcinfo->{binaries}} : $source;
	push @{$dict{$srcinfo->{maintainer}}}, @names;
	if ($show_uploaders && @{$srcinfo->{uploaders}}) {
	    foreach my $uploader (@{$srcinfo->{uploaders}}) {
		push @{$dict{$uploader}}, map "$_ (U)", @names;
	    }
	}
    }
}

if ($use_dctrl) {
    my $fh;
    if ($uncompress) {
	$fh = IO::Uncompress::AnyUncompress->new('-')
	    or die "E: Unable to decompress STDIN: $AnyUncompressError\n";
    }
    else {
	$fh = \*STDIN;
    }
    parsefh($fh, 'STDIN');
}
else {
    my @packages;
    if ($use_stdin) {
	while (my $line = <STDIN>) {
	    chomp $line;
	    $line =~ s/^\s+|\s+$//g;
	    push @packages, split(' ', $line);
	}
    }
    else {
	@packages = @ARGV;
    }
    for my $name (@packages) {
	$package_name{normalize_package($name)} = 1;
    }

    my $apt_version;
    spawn(exec => ['dpkg-query', '-W', '-f', '${source:Version}', 'apt'],
	  to_string => \$apt_version,
	  wait_child => 1,
	  nocheck => 1);

    my $useAptHelper = 0;
    if (defined $apt_version)
    {
	$useAptHelper = version_compare_relation($apt_version, REL_GE, '1.1.8');
    }

    unless (@{$source_files}) {
	if ($useAptHelper)
	{
	    my ($sources, $err);
	    spawn(exec => ['apt-get', 'indextargets', '--format', '$(FILENAME)',
			   'Created-By: Sources'],
		  to_string => \$sources,
		  error_to_string => \$err,
		  wait_child => 1,
		  nocheck => 1);
	    if ($? >> 8)
	    {
		die "Unable to get list of Sources files from apt: $err\n";
	    }

	    $source_files = [split(/\n/, $sources)];
	}
	else
	{
	    $source_files = [glob('/var/lib/apt/lists/*_source_Sources')];
	}
    }

    foreach my $source (@{$source_files}) {
	my $fh;
	if ($useAptHelper)
	{
	    my $good = open($fh, '-|', '/usr/lib/apt/apt-helper', 'cat-file', $source);
	    if (!$good)
	    {
		warn "E: Couldn't run apt-helper to get contents of '$source': $!\n";
		$errors = 1;
		next;
	    }
	}
	else
	{
	    if ($opt_uncompress || ($uncompress && $source =~ m/\.(?:gz|bz2|xz)$/)) {
		$fh = IO::Uncompress::AnyUncompress->new($source);
	    }
	    else {
		$fh = FileHandle->new("<$source");
	    }
	    unless (defined $fh) {
		warn "E: Couldn't open $source\n";
		$errors = 1;
		next;
	    }
	}
	parsefh($fh, $source, 1);
	close $fh;
    }
}

foreach my $developer (sort_developers(keys %dict)) {
    print "$developer\n";
    my %seen;
    foreach my $package (sort @{$dict{$developer}}) {
	next if $seen{$package};
	$seen{$package}=1;
	print "   $package\n";
    }
    print "\n";
}

foreach my $package (grep { $package_name{$_} > 0 } keys %package_name) {
    warn "E: Unknown package: $package\n";
    $errors = 1;
}

exit($errors);