Re: [bug] attributes stuff in options_menu.c broken

Dennis Preiser <[email protected]> Mon, 3 Nov 2008 22:18:27 +0100
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
On 03.11.2008, at 20:50, Urs Janßen wrote:

> the change_config_file() code is mostly correct (IMHO it's lacking a
> write_attributes_file(local_attributes_file); in the GLOBAL_QUIT  
> case),
> but th rest of the code is not (e.g. the read_attributes_files() in  
> select
> is wrong (at least if we do not write out the attributes in
> change_config_file()) - if you check the contents of
> 	group->attribute->trim_article_body
> 	glob_attributes.trim_article_body
> 	and tinrc.trim_article_body
> in change_config_file() they are updated correct, dunno why gargabe is
> written out.

I guess the scope-specific attributes (local_attributes[]) needs to  
be updated too in change_config_file(). In  
attrib.c:write_attributes_file() we check only this scope-specific  
attributes against the default attributes build from the  
tinrc.VARIABLEs.

That seems to be the reason for the garbage written out. The  
tinrc.VARIABLE has changed but the scope-specific attribute is not up  
to date -> both are different and the 'old' scope-specific attribute  
is written out (for each scope).

I will have a look at this tomorrow.

Dennis

PS: The (wrong) read_attributes_files() in select.c let the reportet  
behavior disappear because it rebuilds local_attributes[] from the  
current tinrc.VARIABLEs. So if you:

Start tin -> enter a group -> hit 'M' and change a variable -> leave  
the menu and leave the group -> hit 'M' -> leave the menu and leave tin

no garbage is written out.