[asterisk-commits] murf: trunk r109357 - in /trunk: ./ include/asterisk/ pbx/ael/ael-test/ pbx/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 18 09:09:51 CDT 2008


Author: murf
Date: Tue Mar 18 09:09:50 2008
New Revision: 109357

URL: http://svn.digium.com/view/asterisk?view=rev&rev=109357
Log:
Merged revisions 109309 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r109309 | murf | 2008-03-18 00:37:15 -0600 (Tue, 18 Mar 2008) | 17 lines

(closes issue #11903)
Reported by: atis

Many thanks to atis for spotting this problem and reporting it.
The fix was to straighten out how items are placed on and removed
from the file stack. Regressions as well as the provided test case
helped to straighten out all code paths. valgrind was used to make
sure all memory allocated was freed.

Sorry for not solving this earlier. I got distracted.

Added the ntest23 regression test, which is mainly a copy of ntest22, 
but with a few juicy errors thrown in, to replicate the kind of 
error that atis spotted.



........

Added:
    trunk/pbx/ael/ael-test/ael-ntest23/
      - copied from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/
    trunk/pbx/ael/ael-test/ael-ntest23/extensions.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/extensions.ael
    trunk/pbx/ael/ael-test/ael-ntest23/qq.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/qq.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t1/
      - copied from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t1/
    trunk/pbx/ael/ael-test/ael-ntest23/t1/a.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t1/a.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t1/b.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t1/b.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t1/c.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t1/c.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t2/
      - copied from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t2/
    trunk/pbx/ael/ael-test/ael-ntest23/t2/d.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t2/d.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t2/e.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t2/e.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t2/f.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t2/f.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t3/
      - copied from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t3/
    trunk/pbx/ael/ael-test/ael-ntest23/t3/g.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t3/g.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t3/h.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t3/h.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t3/i.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t3/i.ael
    trunk/pbx/ael/ael-test/ael-ntest23/t3/j.ael
      - copied unchanged from r109309, branches/1.4/pbx/ael/ael-test/ael-ntest23/t3/j.ael
    trunk/pbx/ael/ael-test/ref.ael-ntest23
      - copied, changed from r109309, branches/1.4/pbx/ael/ael-test/ref.ael-ntest23
Modified:
    trunk/   (props changed)
    trunk/include/asterisk/extconf.h
    trunk/res/ael/ael.flex
    trunk/res/ael/ael_lex.c
    trunk/utils/ael_main.c
    trunk/utils/conf2ael.c
    trunk/utils/extconf.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/include/asterisk/extconf.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/extconf.h?view=diff&rev=109357&r1=109356&r2=109357
==============================================================================
--- trunk/include/asterisk/extconf.h (original)
+++ trunk/include/asterisk/extconf.h Tue Mar 18 09:09:50 2008
@@ -174,7 +174,7 @@
 void localized_context_destroy(struct ast_context *con, const char *registrar);
 int localized_pbx_load_module(void);
 
-struct ast_context *localized_context_create(struct ast_context **extcontexts, const char *name, const char *registrar);
+struct ast_context *localized_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar);
 int localized_pbx_builtin_setvar(struct ast_channel *chan, void *data);
 int localized_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar);
 int localized_context_add_switch2(struct ast_context *con, const char *value,
@@ -185,7 +185,7 @@
 							 int replace, const char *extension, int priority, const char *label, const char *callerid,
 							 const char *application, void *data, void (*datad)(void *),
 							 const char *registrar);
-void localized_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar);
+void localized_merge_contexts_and_delete(struct ast_context **extcontexts, void *tab, const char *registrar);
 int localized_context_verify_includes(struct ast_context *con);
 void localized_use_conf_dir(void);
 void localized_use_local_dir(void);

Copied: trunk/pbx/ael/ael-test/ref.ael-ntest23 (from r109309, branches/1.4/pbx/ael/ael-test/ref.ael-ntest23)
URL: http://svn.digium.com/view/asterisk/trunk/pbx/ael/ael-test/ref.ael-ntest23?view=diff&rev=109357&p1=branches/1.4/pbx/ael/ael-test/ref.ael-ntest23&r1=109309&p2=trunk/pbx/ael/ael-test/ref.ael-ntest23&r2=109357
==============================================================================
--- branches/1.4/pbx/ael/ael-test/ref.ael-ntest23 (original)
+++ trunk/pbx/ael/ael-test/ref.ael-ntest23 Tue Mar 18 09:09:50 2008
@@ -5,21 +5,20 @@
 
 
 (You can use the -w option to dump extensions.conf format to extensions.conf.aeldump)
-LOG: lev:2 file:pbx_ael.c  line:4094 func: pbx_load_module  Starting AEL load process.
-LOG: lev:2 file:pbx_ael.c  line:4101 func: pbx_load_module  AEL load process: calculated config file name './extensions.ael'.
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t1/a.ael, 41 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t1/b.ael, 42 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t1/c.ael, 110 chars
-LOG: lev:4 file:ael.y  line:756 func: ael_yyerror  ==== File: ./t1/c.ael, Line 3, Cols: 10-10: Error: syntax error, unexpected '(', expecting '{'
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t2/d.ael, 41 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t2/e.ael, 42 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t2/f.ael, 82 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./qq.ael, 45 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t3/g.ael, 41 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t3/h.ael, 42 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t3/i.ael, 41 chars
-LOG: lev:2 file:ael.flex  line:663 func: setup_filestack    --Read in included file ./t3/j.ael, 43 chars
-LOG: lev:4 file:ael.y  line:756 func: ael_yyerror  ==== File: ./t1/c.ael, Line 10, Cols: 10-10: Error: syntax error, unexpected '(', expecting '{'
-LOG: lev:2 file:pbx_ael.c  line:4109 func: pbx_load_module  AEL load process: parsed config file name './extensions.ael'.
-LOG: lev:4 file:pbx_ael.c  line:4122 func: pbx_load_module  Sorry, but 2 syntax errors and 0 semantic errors were detected. It doesn't make sense to compile.
-LOG: lev:4 file:ael2_parse  line:543 func: main  0 contexts, 0 extensions, 0 priorities
+LOG: lev:2 file:pbx_ael.c  line:116 func: pbx_load_module  Starting AEL load process.
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t1/a.ael, 41 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t1/b.ael, 42 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t1/c.ael, 110 chars
+LOG: lev:4 file:ael.y  line:774 func: ael_yyerror  ==== File: ././t1/c.ael, Line 3, Cols: 10-10: Error: syntax error, unexpected '(', expecting '{'
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t2/d.ael, 41 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t2/e.ael, 42 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t2/f.ael, 82 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././qq.ael, 45 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t3/g.ael, 41 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t3/h.ael, 42 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t3/i.ael, 41 chars
+LOG: lev:2 file:ael.flex  line:672 func: setup_filestack    --Read in included file ././t3/j.ael, 43 chars
+LOG: lev:4 file:ael.y  line:774 func: ael_yyerror  ==== File: ././t1/c.ael, Line 10, Cols: 10-10: Error: syntax error, unexpected '(', expecting '{'
+LOG: lev:2 file:pbx_ael.c  line:129 func: pbx_load_module  AEL load process: parsed config file name './extensions.ael'.
+LOG: lev:4 file:pbx_ael.c  line:145 func: pbx_load_module  Sorry, but 2 syntax errors and 0 semantic errors were detected. It doesn't make sense to compile.
+LOG: lev:4 file:ael2_parse  line:544 func: main  0 contexts, 0 extensions, 0 priorities

Modified: trunk/res/ael/ael.flex
URL: http://svn.digium.com/view/asterisk/trunk/res/ael/ael.flex?view=diff&rev=109357&r1=109356&r2=109357
==============================================================================
--- trunk/res/ael/ael.flex (original)
+++ trunk/res/ael/ael.flex Tue Mar 18 09:09:50 2008
@@ -447,8 +447,6 @@
 <<EOF>>		{
 		char fnamebuf[2048];
 		if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) {
-			free(my_file);
-			my_file = 0;
 			yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner );
 			include_stack[include_stack_index-1].globbuf_pos++;
 			setup_filestack(fnamebuf, sizeof(fnamebuf), &include_stack[include_stack_index-1].globbuf, include_stack[include_stack_index-1].globbuf_pos, yyscanner, 0);
@@ -459,13 +457,13 @@
 				free(include_stack[include_stack_index].fname);
 				include_stack[include_stack_index].fname = 0;
 			}
+			if (my_file) {
+				free(my_file);
+				my_file = 0;
+			}
 			if ( --include_stack_index < 0 ) {
 				yyterminate();
 			} else {
-				if (my_file) {
-					free(my_file);
-					my_file = 0;
-				}
 				globfree(&include_stack[include_stack_index].globbuf);
 				include_stack[include_stack_index].globbuf_pos = -1;
 				
@@ -672,12 +670,16 @@
 			buffer[stats.st_size] = 0;
 			ast_log(LOG_NOTICE,"  --Read in included file %s, %d chars\n",fnamebuf2, (int)stats.st_size);
 			fclose(in1);
+			if (include_stack[include_stack_index].fname) {
+			   	free(include_stack[include_stack_index].fname);
+				include_stack[include_stack_index].fname = 0;
+			}
+			include_stack[include_stack_index].fname = strdup(my_file);
+			include_stack[include_stack_index].lineno = my_lineno;
+			include_stack[include_stack_index].colno = my_col+yyleng;
 			if (my_file)
 				free(my_file);
 			my_file = strdup(fnamebuf2);
-			include_stack[include_stack_index].fname = strdup(my_file);
-			include_stack[include_stack_index].lineno = my_lineno;
-			include_stack[include_stack_index].colno = my_col+yyleng;
 			if (create)
 				include_stack[include_stack_index].globbuf = *globbuf;
 

Modified: trunk/res/ael/ael_lex.c
URL: http://svn.digium.com/view/asterisk/trunk/res/ael/ael_lex.c?view=diff&rev=109357&r1=109356&r2=109357
==============================================================================
--- trunk/res/ael/ael_lex.c (original)
+++ trunk/res/ael/ael_lex.c Tue Mar 18 09:09:50 2008
@@ -793,6 +793,7 @@
  * bison-locations is probably not needed.
  */
 #line 63 "ael.flex"
+#include "asterisk.h"
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include <sys/types.h>
@@ -1746,8 +1747,6 @@
 {
 		char fnamebuf[2048];
 		if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) {
-			free(my_file);
-			my_file = 0;
 			ael_yy_delete_buffer(YY_CURRENT_BUFFER,yyscanner );
 			include_stack[include_stack_index-1].globbuf_pos++;
 			setup_filestack(fnamebuf, sizeof(fnamebuf), &include_stack[include_stack_index-1].globbuf, include_stack[include_stack_index-1].globbuf_pos, yyscanner, 0);
@@ -1758,13 +1757,13 @@
 				free(include_stack[include_stack_index].fname);
 				include_stack[include_stack_index].fname = 0;
 			}
+			if (my_file) {
+				free(my_file);
+				my_file = 0;
+			}
 			if ( --include_stack_index < 0 ) {
 				yyterminate();
 			} else {
-				if (my_file) {
-					free(my_file);
-					my_file = 0;
-				}
 				globfree(&include_stack[include_stack_index].globbuf);
 				include_stack[include_stack_index].globbuf_pos = -1;
 				
@@ -1779,10 +1778,10 @@
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 481 "ael.flex"
+#line 479 "ael.flex"
 ECHO;
 	YY_BREAK
-#line 1786 "ael_lex.c"
+#line 1784 "ael_lex.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -2907,7 +2906,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 481 "ael.flex"
+#line 479 "ael.flex"
 
 
 
@@ -3103,12 +3102,16 @@
 			buffer[stats.st_size] = 0;
 			ast_log(LOG_NOTICE,"  --Read in included file %s, %d chars\n",fnamebuf2, (int)stats.st_size);
 			fclose(in1);
+			if (include_stack[include_stack_index].fname) {
+			   	free(include_stack[include_stack_index].fname);
+				include_stack[include_stack_index].fname = 0;
+			}
+			include_stack[include_stack_index].fname = strdup(my_file);
+			include_stack[include_stack_index].lineno = my_lineno;
+			include_stack[include_stack_index].colno = my_col+yyleng;
 			if (my_file)
 				free(my_file);
 			my_file = strdup(fnamebuf2);
-			include_stack[include_stack_index].fname = strdup(my_file);
-			include_stack[include_stack_index].lineno = my_lineno;
-			include_stack[include_stack_index].colno = my_col+yyleng;
 			if (create)
 				include_stack[include_stack_index].globbuf = *globbuf;
 

Modified: trunk/utils/ael_main.c
URL: http://svn.digium.com/view/asterisk/trunk/utils/ael_main.c?view=diff&rev=109357&r1=109356&r2=109357
==============================================================================
--- trunk/utils/ael_main.c (original)
+++ trunk/utils/ael_main.c Tue Mar 18 09:09:50 2008
@@ -97,7 +97,7 @@
 					   const char *registrar);
 void pbx_builtin_setvar(void *chan, void *data);
 struct ast_context * ast_context_create(void **extcontexts, const char *name, const char *registrar);
-struct ast_context * ast_context_find_or_create(void **extcontexts, const char *name, const char *registrar);
+struct ast_context * ast_context_find_or_create(void **extcontexts, void *tab, const char *name, const char *registrar);
 void ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar);
 void ast_context_add_include2(struct ast_context *con, const char *value, const char *registrar);
 void ast_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar);
@@ -361,7 +361,7 @@
 	return x;
 }
 
-struct ast_context * ast_context_find_or_create(void **extcontexts, const char *name, const char *registrar)
+struct ast_context * ast_context_find_or_create(void **extcontexts, void *tab, const char *name, const char *registrar)
 {
 	struct ast_context *x = calloc(1, sizeof(*x));
 	if (!x)

Modified: trunk/utils/conf2ael.c
URL: http://svn.digium.com/view/asterisk/trunk/utils/conf2ael.c?view=diff&rev=109357&r1=109356&r2=109357
==============================================================================
--- trunk/utils/conf2ael.c (original)
+++ trunk/utils/conf2ael.c Tue Mar 18 09:09:50 2008
@@ -610,7 +610,7 @@
 {
 	printf("find/Creating context %s, registrar=%s\n", name, registrar);
 	
-	return localized_context_create(extcontexts, name, registrar);
+	return localized_context_find_or_create(extcontexts, exttable, name, registrar);
 }
 
 void ast_cli_register_multiple(void);
@@ -657,7 +657,7 @@
 
 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar)
 {
-	localized_merge_contexts_and_delete(extcontexts, registrar);
+	localized_merge_contexts_and_delete(extcontexts, exttable, registrar);
 }
 
 struct ast_exten *pbx_find_extension(struct ast_channel *chan,

Modified: trunk/utils/extconf.c
URL: http://svn.digium.com/view/asterisk/trunk/utils/extconf.c?view=diff&rev=109357&r1=109356&r2=109357
==============================================================================
--- trunk/utils/extconf.c (original)
+++ trunk/utils/extconf.c Tue Mar 18 09:09:50 2008
@@ -5520,18 +5520,16 @@
 	return pbx_extension_helper(c, con, NULL, exten, 0, label, callerid, E_FINDLABEL);
 }
 
-static struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+static struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar)
 {
 	return __ast_context_create(extcontexts, name, registrar, 1);
 }
 
-struct ast_context *localized_context_create(struct ast_context **extcontexts, const char *name, const char *registrar);
-
-struct ast_context *localized_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
-{
-	return __ast_context_create(extcontexts, name, registrar, 0);
-}
-
+struct ast_context *localized_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar);
+struct ast_context *localized_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar)
+{
+	return __ast_context_create(extcontexts, name, registrar, 1);
+}
 
 
 /* chopped this one off at the knees */
@@ -5916,7 +5914,7 @@
 		/* All categories but "general" or "globals" are considered contexts */
 		if (!strcasecmp(cxt, "general") || !strcasecmp(cxt, "globals"))
 			continue;
-		con=ast_context_find_or_create(&local_contexts,cxt, registrar);
+		con=ast_context_find_or_create(&local_contexts,NULL,cxt, registrar);
 		if (con == NULL)
 			continue;
 




More information about the asterisk-commits mailing list