This file is indexed.

/usr/share/kernel-package/scripts/kpkg-vercheck is in kernel-package 13.014+nmu1.

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
#! /usr/bin/perl -w
#                              -*- Mode: Perl -*- 
# kpkg-vercheck --- 
# Author           : Manoj Srivastava ( srivasta@tiamat.datasync.com ) 
# Created On       : Fri Nov  7 13:14:25 1997
# Created On Node  : tiamat.datasync.com
# Last Modified By : Manoj Srivastava
# Last Modified On : Sun Aug 20 20:27:50 2006
# Last Machine Used: glaurung.internal.golden-gryphon.com
# Update Count     : 24
# Status           : Unknown, Use with caution!
# HISTORY          : 
# Description      : 
# 
# 
require 5.002;

use strict;
use diagnostics;
use vars qw($MYNAME $Author $AuthorMail $Version);

=head1 NAME

kpkg-vercheck - Test if a package version is valid

=cut

($MYNAME     = $main::0) =~ s|.*/||;
$Author      = "Manoj Srivastava";
$AuthorMail  = "srivasta\@debian.org";
$Version     = '$Revision: 1.3 $';

=head1 SYNOPSIS

 usage: kpkg-vercheck version-number 

=cut

=head1 DESCRIPTION

This manual page explains the  Debian  B<kpkg-vercheck>  utility,
which  is  used  to check whether a package version follows the
directives in chapter 5 of the Debian packaging manual

=cut

=head1 Version numbering

Every package has a version number, in its Version control file field.
dpkg imposes an ordering on version numbers, so that it can tell
whether packages are being up- or downgraded and so that dselect can
tell whether a package it finds available is newer than the one
installed on the system. The version number format has the most
significant parts (as far as comparison is concerned) at the
beginning.

The version number format is: [epoch:]upstream-version[-debian-revision].

=cut
  
sub main {
  my $version = $ARGV[0];
  my $have_epochs = 0;
  my $have_debrev = 0;
  my $upstream_pat = "";
  
=head2 epoch

This is a single unsigned integer, which should usually be small. It
may be omitted, in which case zero is assumed. If it is omitted then
the upstream-version may not contain any colons.

=cut

  warn "nothing to work on --- version is empty [$version]" unless $version;

  # Test if we have epochs
  if ($version =~ m/\:/og) {
    $have_epochs = 1;
    # The epoch is a single unsigned integer
    if ($version =~ m/\s*\d+:(\S+)/o) {
      $version = $1;		# remove the epoch
    } 
    else {
      #This is an error.
      print "The epoch should be a simple integer in $version.\n";
      exit 1;
    }
  }

=head2 debian-revision

This part of the version represents the version of the modifications
that were made to the package to make it a Debian binary package. It
is optional; if it is not present then the upstream-version may not
contain a hyphen. This format represents the case where a piece of
software was written specifically to be turned into a Debian binary
package, and so there is only one "debianization" of it and therefore
no revision indication is required.

dpkg will break the upstream-version and debian-revision apart
at the last hyphen in the string. 

The debian-revision may contain only alphanumerics and the
characters + and . (plus and full stop).

=cut

  # Test and remove the debian revision
  if ($version =~ m/\-/o) {
    $have_debrev = 1;
    if ($version =~ m/(.*)-[A-Za-z0-9\~\+\.]+$/o) {
      $version = $1;		# remove the debian version
    }
    else {
      #This is an error.
      print "The Debian revision fails to match (.*)-[A-Za-z0-9\\~\\+\\.]+\$ in $version.\n";
      exit 1;
    }
  }

=head2 upstream-version

This is the main part of the version. It is usually version number of
the original (``upstream'') package of which the .deb file has been
made, if this is applicable. The upstream-version portion of the
version number is mandatory.

The upstream-version may contain only alphanumerics and the characters
+ . - : (full stop, plus, hyphen, colon) and should start with a
digit. If there is no debian-revision then hyphens are not allowed; if
there is no epoch then colons are not allowed.

=cut

  #Check out the main version
  if ($have_epochs) {
    if ($have_debrev) {
      $upstream_pat = '^[A-Za-z0-9\~\.\+\:\-]+$'; # Note the : and the -
    }
    else {
      $upstream_pat = '^[A-Za-z0-9\~\.\+\:]+$'; # Note the : 
    }
  }
  else {
    if ($have_debrev) {
      $upstream_pat = '^[A-Za-z0-9\~\.\+\-]+$'; # Note the -
    }
    else {
      $upstream_pat = '^[A-Za-z0-9\~\.\+\-]+$';
    }
  }

  if ($version =~ m/$upstream_pat/o) {
    if ($version =~ m/[0-9]+/o) {
      print "YES\n";
      exit 0;
    }
    else {
      print "The upstream version $version does not contain a digit\n";
      exit 1;
    }
  }
  else {
    #This is an error.
    print "The upstream version fails to match $upstream_pat in $version\n";
    exit 1;
  }
  # Not-reached
}


## Now just call main
&main();


=head1 B<SEE ALSO>

B<dpkg>(5), B<dpkg-deb>(1), B<dpkg-source>(1),  B<dpkg-parsechangelogs>(1),
B<The Debian Packaging manual>.

=cut


=head1 BUGS

None Known so far.

=cut

=head1 AUTHOR

This  was  written by Manoj Srivastava <srivasta@debian.org>, for the
Debian GNU/Linux system. 

=cut


exit 0;
__END__