Great Circle Associates Majordomo-Users
(January 1998)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Re: newconf*g failing
From: Dave Wolfe <dwolfe @ risc . sps . mot . com>
Date: Thu, 22 Jan 1998 10:53:40 -0600 (CST)
To: lawppw @ gsulaw . gsu . edu (Patrick Wiseman)
Cc: majordomo-workers @ greatcircle . com (Majordomo developer's mailing list), majordomo-users @ greatcircle . com (Majordomo user's mailing list), cwilson @ slurp . neu . sgi . com (Chan Wilson), majordomo-patches @ cloud . ccsf . cc . ca . us (Majordomo patches)
In-reply-to: <Pine.LNX.3.95.980113160135.5794B-100000@gsulaw.gsu.edu>

[ Patrick Wiseman writes: ]
> 
> As an administrator of a bunch of lists for courses, I wanted to set the
> default for restrict_post to the listname in each list's config file.  By
> analogy to other settings in config_parse.pl I did
> 
> restrict_post		`#! $list`
> 
> but, when submitting a newconfig got an error back from Majordomo saying
> that "restrict_post file /usr/local/majordomo/lists/LISTNAME.new does not
> exist," where, of course, LISTNAME = $list.  A writeconfig worked, but did
> _not_ set the restrict_post variable to the listname.  I poked around in
> the config_parse.pl code a bit and found that the grab_restrict_post
> routine was generating the error message, which means (I think) that by
> the time the $list variable is processed by the grab_restrict_post routine
> it is "$list.new"  instead of "$list".  In my view, that's a bug :) 

I think 'restrict_post' is unique in this instance because it's checking
for the existence of a file named in its arguments whereas other similar
defaults are simply accepting strings blindly. The '.new' gets appended
in 'newconfig' when do_newconfig() (in majordomo) calls get_config()
to parse the new config file to validate it at line 1025 (1.94.4):

    if ( &get_config($listdir, "$clean_list.new", "locked")) {

The actual config file name to be parsed is the concatenated list
directory and list name. Since the new config file hasn't been validated
yet, it can't safely replace the existing list config file, so the list
name is faked as "listname.new" and the replacement file is temporarily
written into "listname.new.config". While it might seem better to fake
the list directory, that won't work either because grab_restrict_post()
won't find the list file there.

Config_parse.pl actually addresses this situation in get_def() (get
defaults) by defining $baselist, which is the list name stripped of
".new", but it's not documented. If there's a bug, it's that get_def()
doesn't strip the $list variable of ".new" so that 'newconfig' will
have the same value for $list as when the grab_*() subroutines are
called in other situations. In any case, you can define the default for
'restrict_post' to be '#! $baselist' and get the value you need. Or
here's a patch to fix get_def():

--- config_parse.pl.orig	Wed Aug 27 09:41:32 1997
+++ config_parse.pl	Thu Jan 22 10:31:35 1998
@@ -98,7 +98,7 @@
 	'date_info',		'yes', # date the info file when installed
 	'date_intro',		'yes', # date the intro file when installed
 	'archive_dir',		'',
-# When it works use !$main\'filedir . "/" . $baselist',
+# When it works use '#!$main\'filedir . "/" . $list',
 # stuff for resend below
         'moderate',		'no',   # Is list moderated
         'moderator',		'',	# moderator instead of owner-list
@@ -1197,9 +1197,10 @@
 	local($digest) = undef;
 
 	# sometimes the list variable doesn't get overridden
-	$baselist = $list;
-	$baselist =~ s/.new$//; # chomp a .new extention to load
+	#$orig_list = $list;    # Does anyone ever need this?
+	$list =~ s/.new$//;     # chomp a .new extention to load
 				# a replacement file
+	$baselist = $list;      # Compatibility
 
 	&main'abort( "Improper number of args to get_def") unless defined $list;
 
@@ -1349,10 +1350,10 @@
 
 .TP 15
 default_value
-The default value for the string. Empty quotes muct be used if the
+The default value for the string. Empty quotes must be used if the
 value is to be null. If the default value starts with the characters
 '#!', the string is eval'led in the context of the config package. The
-function config'get_def performs the evaluation. Besides the gloabl
+function config'get_def performs the evaluation. Besides the global
 values, the name of the list is available in the variable "$list", and
 the current key name is available in the variable "$key".
 

-- 
 Dave Wolfe


References:
Indexed By Date Previous: RE: Archive list messages as HTML pages
From: Erica Zubkoff <erica@gsn.org>
Next: Re: DEC OS
From: Herve Choplin <choplin@delphi.phys.univ-tours.fr>
Indexed By Thread Previous: Re:Setting restrict_post default to list (was Re: My Fault)
From: David Smith <smithd@blkbox.com>
Next: aliasing/forwarding loop broken
From: Wade Williams <wwilliam@cisco.com>

Google
 
Search Internet Search www.greatcircle.com