This file is indexed.

/usr/share/kernel-wedge/commands/preprocess is in kernel-wedge 2.96ubuntu3.

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
#!/usr/bin/perl
use strict;
use warnings;
use File::Find ();

my $defconfigdir = $ENV{KW_DEFCONFIG_DIR};
if (!defined($defconfigdir)) {
	die "Required environment variable \$KW_DEFCONFIG_DIR is not defined";
}
my $sysdir="$defconfigdir/modules/";

my %modules;
my %loaded;

sub expandwildcards {
	my ($moddir, $line) = @_;
	my ($pattern, $checkdir);

	if ($line =~ /^(.*) [-?]$/) {
		($pattern, $checkdir) = ($1, 0);
	} else {
		($pattern, $checkdir) = ($line, 1);
	}

	# If pattern doesn't include a wildcard, return it unchanged, including
	# an optional-include suffix (but not an exclude suffix)
	if ($pattern !~ /[?*]/) {
		return $pattern . ($line =~ / \?$/ ? ' ?' : '');
	}

	# Find directory to start search at, and full pattern
	my ($searchdir, $fullpattern);
	if ($pattern =~ m|^([^?*]*)/(.*)|) {
		my $subdir = $1;
		if (! -d "$moddir/$subdir") {
			if (-d "$moddir/kernel/$subdir") {
				$subdir = "kernel/$subdir";
			} elsif ($checkdir) {
				die "pattern $pattern refers to nonexistent subdirectory";
			} else {
				return ();
			}
		}
		$searchdir = "$moddir/$subdir";
		$fullpattern = "$searchdir/$2";
	} else {
		$searchdir = $moddir;
		$fullpattern = $pattern;
	}

	# Convert to regexp syntax.  We handle '**' as a recursive
	# match-all.  We don't bother to handle '\' or '[...]'.
	my %glob_re = ('?'  => '[^/]',
		       '*'  => '[^/]*',
		       '**' => '.*',
		       ''   => '');
	$fullpattern =~ s/(.*?)(\*\*|[?*]|)/quotemeta($1) . $glob_re{$2}/eg;

	# Add module suffix; anchor at start and end of string
	$fullpattern = '^' . $fullpattern . '\.(?:ko|o)$';

	# We need to recurse only if the pattern contains '**' or a
	# directory separator after any wildcard.  We could optimise
	# this further, but it doesn't seem worthwhile.
	my $recurse = ($pattern =~ /\*\*/ || $pattern =~ m|[?*].*/|);

	my @modules;
	File::Find::find(
		sub {
			if (-d) {
				$File::Find::prune =
					($File::Find::name ne $searchdir &&
					 !$recurse);
			} elsif ($File::Find::name =~ /$fullpattern/) {
				# We yield just the basename, as usual
				s/\.(?:ko|o)$//;
				push @modules, $_;
			}
		},
		$searchdir);
	return @modules;
}

sub loadlist {
	my ($list, $moddir) = @_;
	
	if ($loaded{$list}) {
		die "include loop detected loading $list\n";
	}
	$loaded{$list}=1;
	
	my $fh;
	open ($fh, $list) || die "cannot read $list\n";
	while (<$fh>) {
		s/^\s*//;
		s/\s*$//;
		if (/^#include\s+<(.*)>$/) {
			my $basename=$1;
			loadlist($sysdir.$basename, $moddir);
		}
		elsif (/^#include\s+"(.*)"$/) {
			my $include=$1;
			my ($dirname)=$list=~m!(.*/).*!;
			loadlist($dirname.$include, $moddir);
		}
		elsif (/^$/) {
			next;
		}
		elsif (/^#/) {
			next;
		}
		elsif (/ -$/) {
			for (expandwildcards($moddir, $_)) {
				delete $modules{$_};
				delete $modules{"$_ ?"};
			}
		}
		else {
			# Support dash prefixing for backwards compatibility.
			s/^-(.*)/$1 ?/;

			for (expandwildcards($moddir, $_)) {
				$modules{$_}=1;
			}
		}
	}
	close $fh;
}

my $file=shift || die "no input file given";
my $moddir=shift || die "no module directory specified";
loadlist($file, $moddir);
foreach my $m (sort keys %modules) {
	print "$m\n";
}