ah yes, the attachment...
diff --git a/apt-show-versions b/apt-show-versions
index fd0dab4..9bfa3b0 100755
--- a/apt-show-versions
+++ b/apt-show-versions
@@ -36,6 +36,7 @@ use Storable qw(nstore retrieve);
my $apackagescachefile="/var/cache/apt-show-versions/apackages-multiarch";
my $ipackagescachefile="/var/cache/apt-show-versions/ipackages-multiarch";
my $filescachefile="/var/cache/apt-show-versions/files";
+my $cachefilemode=0644;
use AptPkg::Cache;
use AptPkg::Config '$_config';
@@ -195,6 +196,8 @@ if (!-e $filescachefile or -M $list_dir < -M $filescachefile or !ref($filesref))
@files = map { $list_dir . $_} grep /Packages$/, readdir(DIR);
($< == 0) and (nstore(\@files, $filescachefile) or
warn "Can't write $filescachefile\n");
+ ($< == 0) and (chmod($cachefilemode, $filescachefile) or
+ warn "Can't chmod $filescachefile\n");
closedir DIR ;
}
@@ -218,6 +221,8 @@ if (!-e $ipackagescachefile or -M $status_file < -M $ipackagescachefile or !ref(
($ipackages, undef) = parse_file ($status_file, 1);
($< == 0) and (nstore($ipackages, $ipackagescachefile) or
warn "Can't write $ipackagescachefile\n");
+ ($< == 0) and (chmod($cachefilemode, $ipackagescachefile) or
+ warn "Can't chmod $ipackagescachefile\n");
}
# Get available packages list from cache if possible
@@ -274,6 +279,8 @@ if (defined $Storable::recursion_limit_hash) {
# Store if we are root
($< == 0) and (nstore($apackages, $apackagescachefile) or
&die("Warning: Can't write to $apackagescachefile!\n"));
+($< == 0) and (chmod($cachefilemode, $apackagescachefile));
+
# Exit if we are root and using the -i option
($< == 0) and (exists $opts{'initialize'}) and exit;