From grdetil@scrc.umanitoba.ca Thu Aug 17 18:31:17 2000
Date: Thu, 17 Aug 2000 17:17:30 -0500 (CDT)
From: Gilles Detillieux <grdetil@scrc.umanitoba.ca>
To: Geoff Hutchison <ghutchis@wso.williams.edu>
Cc: abel deuring <a.deuring@satzbau-gmbh.de>, htdig3-dev@htdig.org
Subject: Re: [htdig3-dev] some bugs in htsearch 3.2b3

According to me:
> According to Geoff Hutchison:
> > At 12:02 PM +0200 8/17/00, abel deuring wrote:
> > >5. If two config files specified (for searches in in two databases, or
> > >accidentally by the bug mentioned above), and if the second config file
> > >contains an "include" statement, the lines following this include
> > >statement are not used.
> > 
> > Hmm, I'll try to reproduce that, though it may take some additional 
> > sleuthing to find the culprit code in the flex/bison code.
> > 
> > Thanks again for your patch (and sorry that the snapshots were broken).
> 
> The flex code uses a stack to keep track of open config files for
> includes.  My guess is that code gets confused by multiple config files
> in the collection support.  The includes in the new flex code are also
> broken in that include file names are now interpreted relative to the
> current directory of the process, rather than the parent directory of
> the current config file.  The stack should also keep track of file names
> and the code should be fixed to use them.  In short, that code seems to
> need a lot of debugging and testing.

Well, I think I found the cause of the bug Abel reported, just by looking
at the code.  It turns out that after it hits EOF on the first top-level
(i.e. not included) config file, the stack pointer gets decremented
once too often, so it's at the wrong value when it parses the second
top-level file.

I think this is the fix, but I don't have time to test it, and I'm not
even sure I have the right tools to rebuild the needed files from the flex
source, so I'll just submit it as a patch for someone else to commit.
Hope that's OK.  The file name stacking for proper interpretation of
relative file names will take a bit more work, so I'll leave that for
later (or for someone else).  Here's my patch:

Index: htcommon/conf_lexer.lxx
===================================================================
RCS file: /opt/htdig/cvs/htdig3/htcommon/conf_lexer.lxx,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 conf_lexer.lxx
--- htcommon/conf_lexer.lxx	2000/05/06 20:46:37	1.1.2.8
+++ htcommon/conf_lexer.lxx	2000/08/17 22:07:40
@@ -131,13 +131,13 @@ include[ \t]*:		BEGIN(incl);
 		        }
 
 <<EOF>> 		{
-		        if ( --include_stack_ptr < 0 )
+		        if ( include_stack_ptr <= 0 )
 		            yyterminate();
 		        else
 		            {
 		            yy_delete_buffer( YY_CURRENT_BUFFER );
 		            yy_switch_to_buffer(
-		                 include_stack[include_stack_ptr] );
+		                 include_stack[--include_stack_ptr] );
 		            }
 		        }
 


-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
htdig3-dev-unsubscribe@htdig.org 
You will receive a message to confirm this. 


