/usr/sbin/debbugs-dbhash is in debbugs 2.4.1.1.
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 | #! /usr/bin/perl -w
# Migrate an old-style database to the new hashed (db-h) form.
use strict;
use File::Copy;
if (@ARGV != 2) {
print <<EOF;
Usage: $0 old-db-directory new-db-directory
debbugs-dbhash converts an old-style flat debbugs database into a
new-style hashed-directory debbugs database.
The old database is simply copied, and otherwise left untouched.
The directory given for the new database must not already exist.
EOF
exit 0;
}
my ($db, $dbh) = @ARGV[0, 1];
opendir DB, $db or die "Can't opendir $db: $!";
mkdir $dbh or die "Can't mkdir $dbh: $!";
for my $i (0 .. 99) {
my $dir = sprintf '%s/%02d', $dbh, $i;
mkdir $dir or die "Can't mkdir $dir: $!";
}
while (defined(my $file = readdir DB)) {
next if $file =~ /^\.\.?$/;
my $oldfile = "$db/$file";
my $newfile;
if ($file =~ /(\d*)(\d\d)\.(.*)/) {
$newfile = "$dbh/$2/$1$2.$3";
} else {
warn "Not hashing $file.\n";
$newfile = "$dbh/$file";
}
copy $oldfile, $newfile or warn "Can't copy $oldfile to $newfile: $!";
}
closedir DB;
|