This file is indexed.

/usr/lib/obs/server/bs_archivereq is in obs-server 2.7.4-2.

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
#!/usr/bin/perl

BEGIN {
  my ($wd) = $0 =~ m-(.*)/- ;
  $wd ||= '.';
  unshift @INC, "$wd/build";
  unshift @INC, "$wd";
}

use Date::Parse;
use Data::Dumper;

use XML::Structured ':bytes';

use BSConfig;
use BSDB;
use BSUtil;
use BSXML;

use strict;

BSUtil::drop_privs_to($BSConfig::bsuser, $BSConfig::bsgroup);

my $requestsdir = "$BSConfig::bsdir/requests";
my $oldrequestsdir = "$BSConfig::bsdir/requests.old";
my $reqindexdb = "$BSConfig::bsdir/db/request";

my $db = BSDB::opendb($reqindexdb, '');
$db->{'noindex'} = {'id' => 1};

my @r = sort {$a <=> $b} ls($requestsdir);

my %donestates = map {$_ => 1} qw{
  accept accepted deleted declined rejected revoked superseded
};

my $now = time;
my $cut = 366 * 24 * 3600;

mkdir_p($oldrequestsdir);
for my $id (@r) {
  next if $id =~ /^\./;
  print "- $id\n";
  my $req = readxml("$requestsdir/$id", $BSXML::request, 1);
  next unless $req && $req->{'state'};
  my $state = $req->{'state'}->{'name'};
  next unless $donestates{$state || ''};
  my $t = str2time($req->{'state'}->{'when'});
  next unless $t;
  next if $t + $cut > $now;
  print "state $state, ".localtime($t)."\n";
  $db->updateindex($id, $req, {});
  rename("$requestsdir/$id", "$oldrequestsdir/$id") || die("rename $requestsdir/$id $oldrequestsdir/$id: $!\n");
}