Skip to Content.
Sympa Menu

devel - List::_load_users_include() bug

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Sergiy Zhuk <address@concealed>
  • To: address@concealed
  • Subject: List::_load_users_include() bug
  • Date: Thu, 10 Jan 2002 21:07:24 -0800 (PST)

hi

There's a bug in List.pm _load_users_include() which can corrupt the
subscriber database and also remove the digests for the list since sympa
will think the list doesn't exist.
When the data source is set to "include" and you either change the config file
('touch config' will do) or remove subscribers.db, this will trigger the "no
cache" update, which always fails.
It creates the subscribers.db, but can't open the database to actually read
imported subscribers because it was closed incorrectly, so the next "tie"
call fails.
It's easy to reproduce.
Choose a list with the 'include' data source, go to 'list info'.
Then update config and reload the info page.
It will tell you the list doesn't exist and will remove all digests:

sympa[81713]: (use cache) Could not tie to DB_File
/home/sympa/expl/blah/subsribers.db
sympa[81713]: Unknown list, deleting digest file /home/sympa/spool/digest/blah

If you reload the info page once again, the list will re-appear, although
you've lost your digests by now.
It's especially bad, when you have another list including the one you've
just updated.
It won't be able to include it and will lose its subscribers till the next
update which depends on ttl.

As far as I understand the DB API, perl won't close the database until you
undef the database handle and untie the array.

The fix is attached.

thanks

--
rgds,
serge
Index: List.pm
===================================================================
RCS file: /CVSROOT/yahoo/network/email/sympa/bin/List.pm,v
retrieving revision 1.12
diff -u -r1.12 List.pm
--- List.pm 2002/01/09 22:44:44 1.12
+++ List.pm 2002/01/11 04:41:52
@@ -5148,7 +5148,7 @@

unless ($use_cache) {
unless ($ref = tie %users, 'DB_File', $db_file, O_CREAT|O_RDWR, 0600,
$btree) {
- &do_log('err', 'Could not tie to DB_File');
+ &do_log('err', '(no cache) Could not tie to DB_File %s',$db_file);
return undef;
}

@@ -5202,15 +5202,16 @@
}

## Unlock
+ $ref->sync;
flock(DB_FH,LOCK_UN);
&do_log('debug2', 'Release lock on %s', $db_file);
- close DB_FH;
-
+ undef $ref;
untie %users;
+ close DB_FH;
}

unless ($ref = tie %users, 'DB_File', $db_file, O_CREAT|O_RDWR, 0600,
$btree) {
- &do_log('err', 'Could not tie to DB_File');
+ &do_log('err', '(use cache) Could not tie to DB_File %s',$db_file);
return undef;
}

@@ -5232,10 +5233,12 @@
## Unlock DB_file
flock(DB_FH,LOCK_UN);
&do_log('debug2', 'Release lock on %s', $db_file);
- close DB_FH;

## Inclusion failed, clear cache
unless (defined $total) {
+ undef $ref;
+ untie %users;
+ close DB_FH;
unlink $db_file;
return undef;
}
@@ -5246,6 +5249,9 @@
$l->{'total'} = $total
if $total;

+ undef $ref;
+ untie %users;
+ close DB_FH;
$l;
}




Archive powered by MHonArc 2.6.19+.

Top of Page