Bug#2055: Mirror: two problems using files for associative arrays
Package: mirror
Version: 2.8
Revision: 0
I'm sending this as a debian problem report and to the mirror list.
The first, and less important issue is that due to a typo in the mirror.pl
file, mirror stores temporary files in / when using associative arrays to
store information about local and remote filesets.
The fix is simple: Look for the two instances of the string "$big_tmp"
and replace them with "$big_temp", which is the variable that should be
being used.
The second, and much more important issue, is that mirror doesn't always
correctly delete those dbm files.
Once #1 is corrected, mirror creates /var/tmp/(remote|local)_map.X using
dbmopen ( ). Unfortunately, when it goes to get rid of it, it assumes
that there will be two files, one *.pag and one *.dir. At least with my
copy of perl, this is an incorrect assumption --- the file name given is
the file name used (I think this means I'm using Berkeley db).
Here's a patch that should take care of both of these (though the patch
for problem #2 is still non-optimal, since it still assumes knowledge of
the file name, but I didn't see any other way to do it).
----->8-----
*** mirror.pl Tue Oct 31 15:31:30 1995
--- /usr/lib/mirror/mirror.pl Wed Dec 20 10:38:47 1995
***************
*** 3228,3234 ****
&msg( "creating assocs ...\n" ) if $debug > 2;
foreach $map ( @assocs ){
! eval "\$$map = \"\$big_tmp/$map.$$\"";
eval "dbmopen( $map, \$$map, 0644 )";
}
&msg( "creating assocs done\n" ) if $debug > 2;
--- 3228,3234 ----
&msg( "creating assocs ...\n" ) if $debug > 2;
foreach $map ( @assocs ){
! eval "\$$map = \"\$big_temp/$map.$$\"";
eval "dbmopen( $map, \$$map, 0644 )";
}
&msg( "creating assocs done\n" ) if $debug > 2;
***************
*** 3240,3246 ****
&msg( "deleting assocs ...\n" ) if $debug > 2;
foreach $map ( @assocs ){
! eval "\$$map = \"\$big_tmp/$map.$$\"";
eval "dbmclose( $map )";
&unlink_dbm( eval "\$$map" );
eval "\%$map = ()";
--- 3240,3246 ----
&msg( "deleting assocs ...\n" ) if $debug > 2;
foreach $map ( @assocs ){
! eval "\$$map = \"\$big_temp/$map.$$\"";
eval "dbmclose( $map )";
&unlink_dbm( eval "\$$map" );
eval "\%$map = ()";
***************
*** 3251,3258 ****
sub unlink_dbm
{
local( $file ) = @_;
! unlink "$file.pag";
! unlink "$file.dir";
}
# Chop the tmp file up
--- 3251,3259 ----
sub unlink_dbm
{
local( $file ) = @_;
! unlink "$file.pag" if -e "$file.pag";
! unlink "$file.dir" if -e "$file.dir";
! unlink "$file" if -e "$file";
}
# Chop the tmp file up
-----8<-----
Enjoy,
Mike.
--
"I'm a dinosaur. Somebody's digging my bones."
Reply to: