You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2010/09/29 21:42:04 UTC
svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Author: sf
Date: Wed Sep 29 19:42:03 2010
New Revision: 1002824
URL: http://svn.apache.org/viewvc?rev=1002824&view=rev
Log:
Make the ssl expression parser thread-safe. It now requires bison instead of
yacc.
Also change the make file magic so that the real source file name is
embedded in the debug info.
The generated files have been created with flex 2.5.35/bison 2.4.1. The two
'no previous prototype' warnings are supposed to be fixed with the next flex
version.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/STATUS
httpd/httpd/trunk/modules/ssl/Makefile.in
httpd/httpd/trunk/modules/ssl/ssl_engine_config.c
httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
httpd/httpd/trunk/modules/ssl/ssl_expr.c
httpd/httpd/trunk/modules/ssl/ssl_expr.h
httpd/httpd/trunk/modules/ssl/ssl_expr_eval.c
httpd/httpd/trunk/modules/ssl/ssl_expr_parse.c
httpd/httpd/trunk/modules/ssl/ssl_expr_parse.h
httpd/httpd/trunk/modules/ssl/ssl_expr_parse.y
httpd/httpd/trunk/modules/ssl/ssl_expr_scan.c
httpd/httpd/trunk/modules/ssl/ssl_expr_scan.l
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1002824&r1=1002823&r2=1002824&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Sep 29 19:42:03 2010
@@ -2,6 +2,9 @@
Changes with Apache 2.3.9
+ *) mod_ssl: Make the ssl expression parser thread-safe. It now requires
+ bison instead of yacc. [Stefan Fritsch]
+
*) mod_disk_cache: Change on-disk header file format to support the
link of the device/inode of the data file to the matching header
file, and to support the option of not writing a data file when
Modified: httpd/httpd/trunk/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/STATUS?rev=1002824&r1=1002823&r2=1002824&view=diff
==============================================================================
--- httpd/httpd/trunk/STATUS (original)
+++ httpd/httpd/trunk/STATUS Wed Sep 29 19:42:03 2010
@@ -360,12 +360,6 @@ TODO ISSUES REMAINING IN MOD_SSL:
* Do we need SSL_set_read_ahead()?
- * the ssl_expr api is NOT THREAD SAFE. race conditions exist:
- -in ssl_expr_comp() if SSLRequire is used in .htaccess
- (ssl_expr_info is global)
- -is ssl_expr_eval() if there is an error
- (ssl_expr_error is global)
-
* SSLRequire directive (parsing of) leaks memory
* Diffie-Hellman-Parameters for temporary keys are hardcoded in
Modified: httpd/httpd/trunk/modules/ssl/Makefile.in
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/Makefile.in?rev=1002824&r1=1002823&r2=1002824&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/Makefile.in (original)
+++ httpd/httpd/trunk/modules/ssl/Makefile.in Wed Sep 29 19:42:03 2010
@@ -25,15 +25,13 @@ include $(top_srcdir)/build/special.mk
#
ssl_expr_scan.c: $(top_srcdir)/modules/ssl/ssl_expr_scan.l ssl_expr_parse.h
- flex -Pssl_expr_yy -s -B $(top_srcdir)/modules/ssl/ssl_expr_scan.l
- sed -e '/$$Header:/d' -e "s|\"`pwd`/|\"|g" <lex.ssl_expr_yy.c >ssl_expr_scan.c && rm -f lex.ssl_expr_yy.c
+ flex -Pssl_expr_yy -o ssl_expr_scan.c ssl_expr_scan.l
+ mv ssl_expr_scan.c ssl_expr_scan.c.tmp
+ sed -e "s|\"`pwd`/|\"|g" <ssl_expr_scan.c.tmp >ssl_expr_scan.c
+ rm -f ssl_expr_scan.c.tmp
ssl_expr_parse.c ssl_expr_parse.h: $(top_srcdir)/modules/ssl/ssl_expr_parse.y
- yacc -d $(top_srcdir)/modules/ssl/ssl_expr_parse.y
- sed -e 's;yy;ssl_expr_yy;g' \
- -e "s|\"`pwd`/|\"|g" \
- -e '/#if defined(c_plusplus) || defined(__cplusplus)/,/#endif/d' \
- <y.tab.c >ssl_expr_parse.c && rm -f y.tab.c
- sed -e 's;yy;ssl_expr_yy;g' \
- <y.tab.h >ssl_expr_parse.h && rm -f y.tab.h
-
+ bison -pssl_expr_yy --defines=ssl_expr_parse.h -o ssl_expr_parse.c ssl_expr_parse.y
+ mv ssl_expr_parse.c ssl_expr_parse.c.tmp
+ sed -e "s|\"`pwd`/|\"|g" < ssl_expr_parse.c.tmp > ssl_expr_parse.c
+ rm -f ssl_expr_parse.c.tmp
Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_config.c?rev=1002824&r1=1002823&r2=1002824&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_config.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_config.c Wed Sep 29 19:42:03 2010
@@ -1149,10 +1149,10 @@ const char *ssl_cmd_SSLRequire(cmd_parms
SSLDirConfigRec *dc = (SSLDirConfigRec *)dcfg;
ssl_expr *expr;
ssl_require_t *require;
+ const char *errstring;
- if (!(expr = ssl_expr_comp(cmd->pool, (char *)arg))) {
- return apr_pstrcat(cmd->pool, "SSLRequire: ",
- ssl_expr_get_error(), NULL);
+ if (!(expr = ssl_expr_comp(cmd->pool, (char *)arg, &errstring))) {
+ return apr_pstrcat(cmd->pool, "SSLRequire: ", errstring, NULL);
}
require = apr_array_push(dc->aRequirement);
Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c?rev=1002824&r1=1002823&r2=1002824&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c Wed Sep 29 19:42:03 2010
@@ -899,13 +899,14 @@ int ssl_hook_Access(request_rec *r)
for (i = 0; i < requires->nelts; i++) {
ssl_require_t *req = &ssl_requires[i];
- ok = ssl_expr_exec(r, req->mpExpr);
+ const char *errstring;
+ ok = ssl_expr_exec(r, req->mpExpr, &errstring);
if (ok < 0) {
cp = apr_psprintf(r->pool,
"Failed to execute "
"SSL requirement expression: %s",
- ssl_expr_get_error());
+ errstring);
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"access to %s failed, reason: %s",
Modified: httpd/httpd/trunk/modules/ssl/ssl_expr.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_expr.c?rev=1002824&r1=1002823&r2=1002824&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_expr.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_expr.c Wed Sep 29 19:42:03 2010
@@ -35,47 +35,50 @@
** _________________________________________________________________
*/
-ssl_expr_info_type ssl_expr_info;
-char *ssl_expr_error;
-ssl_expr *ssl_expr_comp(apr_pool_t *p, char *expr)
+ssl_expr *ssl_expr_comp(apr_pool_t *p, char *expr, const char **err)
{
- ssl_expr_info.pool = p;
- ssl_expr_info.inputbuf = expr;
- ssl_expr_info.inputlen = strlen(expr);
- ssl_expr_info.inputptr = ssl_expr_info.inputbuf;
- ssl_expr_info.expr = FALSE;
+ ssl_expr_info_type context;
+ int rc;
- ssl_expr_error = NULL;
- if (ssl_expr_yyparse())
+ context.pool = p;
+ context.inputbuf = expr;
+ context.inputlen = strlen(expr);
+ context.inputptr = context.inputbuf;
+ context.expr = FALSE;
+ context.error = NULL;
+
+ ssl_expr_yylex_init(&context.scanner);
+ ssl_expr_yyset_extra(&context, context.scanner);
+ rc = ssl_expr_yyparse(&context);
+ ssl_expr_yylex_destroy(context.scanner);
+ *err = context.error;
+
+ if (rc)
return NULL;
- return ssl_expr_info.expr;
-}
-char *ssl_expr_get_error(void)
-{
- if (ssl_expr_error == NULL)
- return "";
- return ssl_expr_error;
+ return context.expr;
}
-ssl_expr *ssl_expr_make(ssl_expr_node_op op, void *a1, void *a2)
+ssl_expr *ssl_expr_make(ssl_expr_node_op op, void *a1, void *a2,
+ ssl_expr_info_type *context)
{
ssl_expr *node;
- node = (ssl_expr *)apr_palloc(ssl_expr_info.pool, sizeof(ssl_expr));
+ node = (ssl_expr *)apr_palloc(context->pool, sizeof(ssl_expr));
node->node_op = op;
node->node_arg1 = (char *)a1;
node->node_arg2 = (char *)a2;
return node;
}
-int ssl_expr_exec(request_rec *r, ssl_expr *expr)
+int ssl_expr_exec(request_rec *r, ssl_expr *expr, const char **err)
{
BOOL rc;
- rc = ssl_expr_eval(r, expr);
- if (ssl_expr_error != NULL)
+ *err = NULL;
+ rc = ssl_expr_eval(r, expr, err);
+ if (*err != NULL)
return (-1);
else
return (rc ? 1 : 0);
Modified: httpd/httpd/trunk/modules/ssl/ssl_expr.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_expr.h?rev=1002824&r1=1002823&r2=1002824&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_expr.h (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_expr.h Wed Sep 29 19:42:03 2010
@@ -84,29 +84,26 @@ typedef struct {
typedef ssl_expr_node ssl_expr;
typedef struct {
- apr_pool_t *pool;
- char *inputbuf;
- int inputlen;
- char *inputptr;
- ssl_expr *expr;
+ apr_pool_t *pool;
+ char *inputbuf;
+ int inputlen;
+ char *inputptr;
+ ssl_expr *expr;
+ void *scanner;
+ char *error;
} ssl_expr_info_type;
-extern ssl_expr_info_type ssl_expr_info;
-extern char *ssl_expr_error;
-
-#define yylval ssl_expr_yylval
-#define yyerror ssl_expr_yyerror
-#define yyinput ssl_expr_yyinput
-
-extern int ssl_expr_yyparse(void);
-extern int ssl_expr_yyerror(char *);
-extern int ssl_expr_yylex(void);
-
-extern ssl_expr *ssl_expr_comp(apr_pool_t *, char *);
-extern int ssl_expr_exec(request_rec *, ssl_expr *);
-extern char *ssl_expr_get_error(void);
-extern ssl_expr *ssl_expr_make(ssl_expr_node_op, void *, void *);
-extern BOOL ssl_expr_eval(request_rec *, ssl_expr *);
+int ssl_expr_yyparse(ssl_expr_info_type *context);
+int ssl_expr_yyerror(ssl_expr_info_type *context, char *errstring);
+int ssl_expr_yylex_init(void **scanner);
+int ssl_expr_yylex_destroy(void *scanner);
+void ssl_expr_yyset_extra(ssl_expr_info_type *context, void *scanner);
+
+ssl_expr *ssl_expr_comp(apr_pool_t *p, char *exprstr, const char **err);
+int ssl_expr_exec(request_rec *r, ssl_expr *expr, const char **err);
+ssl_expr *ssl_expr_make(ssl_expr_node_op op, void *arg1, void *arg2,
+ ssl_expr_info_type *context);
+BOOL ssl_expr_eval(request_rec *r, ssl_expr *expr, const char **err);
#endif /* __SSL_EXPR_H__ */
/** @} */
Modified: httpd/httpd/trunk/modules/ssl/ssl_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_expr_eval.c?rev=1002824&r1=1002823&r2=1002824&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_expr_eval.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_expr_eval.c Wed Sep 29 19:42:03 2010
@@ -34,13 +34,14 @@
** _________________________________________________________________
*/
-static BOOL ssl_expr_eval_comp(request_rec *, ssl_expr *);
-static char *ssl_expr_eval_word(request_rec *, ssl_expr *);
-static BOOL ssl_expr_eval_oid(request_rec *r, const char *word, const char *oidstr);
-static char *ssl_expr_eval_func_file(request_rec *, char *);
-static int ssl_expr_eval_strcmplex(char *, char *);
+static BOOL ssl_expr_eval_comp(request_rec *, ssl_expr *, const char **err);
+static char *ssl_expr_eval_word(request_rec *, ssl_expr *, const char **err);
+static BOOL ssl_expr_eval_oid(request_rec *r, const char *word,
+ const char *oidstr, const char **err);
+static char *ssl_expr_eval_func_file(request_rec *, char *, const char **err);
+static int ssl_expr_eval_strcmplex(char *, char *, const char **err);
-BOOL ssl_expr_eval(request_rec *r, ssl_expr *node)
+BOOL ssl_expr_eval(request_rec *r, ssl_expr *node, const char **err)
{
switch (node->node_op) {
case op_True: {
@@ -51,67 +52,67 @@ BOOL ssl_expr_eval(request_rec *r, ssl_e
}
case op_Not: {
ssl_expr *e = (ssl_expr *)node->node_arg1;
- return (!ssl_expr_eval(r, e));
+ return (!ssl_expr_eval(r, e, err));
}
case op_Or: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
- return (ssl_expr_eval(r, e1) || ssl_expr_eval(r, e2));
+ return (ssl_expr_eval(r, e1, err) || ssl_expr_eval(r, e2, err));
}
case op_And: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
- return (ssl_expr_eval(r, e1) && ssl_expr_eval(r, e2));
+ return (ssl_expr_eval(r, e1, err) && ssl_expr_eval(r, e2, err));
}
case op_Comp: {
ssl_expr *e = (ssl_expr *)node->node_arg1;
- return ssl_expr_eval_comp(r, e);
+ return ssl_expr_eval_comp(r, e, err);
}
default: {
- ssl_expr_error = "Internal evaluation error: Unknown expression node";
+ *err = "Internal evaluation error: Unknown expression node";
return FALSE;
}
}
}
-static BOOL ssl_expr_eval_comp(request_rec *r, ssl_expr *node)
+static BOOL ssl_expr_eval_comp(request_rec *r, ssl_expr *node, const char **err)
{
switch (node->node_op) {
case op_EQ: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
- return (strcmp(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) == 0);
+ return (strcmp(ssl_expr_eval_word(r, e1, err), ssl_expr_eval_word(r, e2, err)) == 0);
}
case op_NE: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
- return (strcmp(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) != 0);
+ return (strcmp(ssl_expr_eval_word(r, e1, err), ssl_expr_eval_word(r, e2, err)) != 0);
}
case op_LT: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
- return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) < 0);
+ return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1, err), ssl_expr_eval_word(r, e2, err), err) < 0);
}
case op_LE: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
- return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) <= 0);
+ return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1, err), ssl_expr_eval_word(r, e2, err), err) <= 0);
}
case op_GT: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
- return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) > 0);
+ return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1, err), ssl_expr_eval_word(r, e2, err), err) > 0);
}
case op_GE: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
- return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1), ssl_expr_eval_word(r, e2)) >= 0);
+ return (ssl_expr_eval_strcmplex(ssl_expr_eval_word(r, e1, err), ssl_expr_eval_word(r, e2, err), err) >= 0);
}
case op_IN: {
ssl_expr *e1 = (ssl_expr *)node->node_arg1;
ssl_expr *e2 = (ssl_expr *)node->node_arg2;
ssl_expr *e3;
- char *w1 = ssl_expr_eval_word(r, e1);
+ char *w1 = ssl_expr_eval_word(r, e1, err);
BOOL found = FALSE;
do {
ssl_expr_node_op op = e2->node_op;
@@ -119,15 +120,15 @@ static BOOL ssl_expr_eval_comp(request_r
e2 = (ssl_expr *)e2->node_arg2;
if (op == op_PeerExtElement) {
- char *w3 = ssl_expr_eval_word(r, e3);
+ char *w3 = ssl_expr_eval_word(r, e3, err);
- found = ssl_expr_eval_oid(r, w1, w3);
+ found = ssl_expr_eval_oid(r, w1, w3, err);
/* There will be no more nodes on the list, so the result is authoritative */
break;
}
- if (strcmp(w1, ssl_expr_eval_word(r, e3)) == 0) {
+ if (strcmp(w1, ssl_expr_eval_word(r, e3, err)) == 0) {
found = TRUE;
break;
}
@@ -142,7 +143,7 @@ static BOOL ssl_expr_eval_comp(request_r
e1 = (ssl_expr *)node->node_arg1;
e2 = (ssl_expr *)node->node_arg2;
- word = ssl_expr_eval_word(r, e1);
+ word = ssl_expr_eval_word(r, e1, err);
regex = (ap_regex_t *)(e2->node_arg1);
return (ap_regexec(regex, word, 0, NULL, 0) == 0);
}
@@ -154,18 +155,18 @@ static BOOL ssl_expr_eval_comp(request_r
e1 = (ssl_expr *)node->node_arg1;
e2 = (ssl_expr *)node->node_arg2;
- word = ssl_expr_eval_word(r, e1);
+ word = ssl_expr_eval_word(r, e1, err);
regex = (ap_regex_t *)(e2->node_arg1);
return !(ap_regexec(regex, word, 0, NULL, 0) == 0);
}
default: {
- ssl_expr_error = "Internal evaluation error: Unknown expression node";
+ *err = "Internal evaluation error: Unknown expression node";
return FALSE;
}
}
}
-static char *ssl_expr_eval_word(request_rec *r, ssl_expr *node)
+static char *ssl_expr_eval_word(request_rec *r, ssl_expr *node, const char **err)
{
switch (node->node_op) {
case op_Digit: {
@@ -185,20 +186,21 @@ static char *ssl_expr_eval_word(request_
char *name = (char *)node->node_arg1;
ssl_expr *args = (ssl_expr *)node->node_arg2;
if (strEQ(name, "file"))
- return ssl_expr_eval_func_file(r, (char *)(args->node_arg1));
+ return ssl_expr_eval_func_file(r, (char *)(args->node_arg1), err);
else {
- ssl_expr_error = "Internal evaluation error: Unknown function name";
+ *err = "Internal evaluation error: Unknown function name";
return "";
}
}
default: {
- ssl_expr_error = "Internal evaluation error: Unknown expression node";
+ *err = "Internal evaluation error: Unknown expression node";
return FALSE;
}
}
}
-static BOOL ssl_expr_eval_oid(request_rec *r, const char *word, const char *oidstr)
+static BOOL ssl_expr_eval_oid(request_rec *r, const char *word,
+ const char *oidstr, const char **err)
{
int j;
BOOL result = FALSE;
@@ -220,7 +222,7 @@ static BOOL ssl_expr_eval_oid(request_re
}
-static char *ssl_expr_eval_func_file(request_rec *r, char *filename)
+static char *ssl_expr_eval_func_file(request_rec *r, char *filename, const char **err)
{
apr_file_t *fp;
char *buf;
@@ -230,12 +232,12 @@ static char *ssl_expr_eval_func_file(req
if (apr_file_open(&fp, filename, APR_READ|APR_BUFFERED,
APR_OS_DEFAULT, r->pool) != APR_SUCCESS) {
- ssl_expr_error = "Cannot open file";
+ *err = "Cannot open file";
return "";
}
apr_file_info_get(&finfo, APR_FINFO_SIZE, fp);
if ((finfo.size + 1) != ((apr_size_t)finfo.size + 1)) {
- ssl_expr_error = "Huge file cannot be read";
+ *err = "Huge file cannot be read";
apr_file_close(fp);
return "";
}
@@ -246,14 +248,14 @@ static char *ssl_expr_eval_func_file(req
}
else {
if ((buf = (char *)apr_palloc(r->pool, sizeof(char)*(len+1))) == NULL) {
- ssl_expr_error = "Cannot allocate memory";
+ *err = "Cannot allocate memory";
apr_file_close(fp);
return "";
}
offset = 0;
apr_file_seek(fp, APR_SET, &offset);
if (apr_file_read(fp, buf, &len) != APR_SUCCESS) {
- ssl_expr_error = "Cannot read from file";
+ *err = "Cannot read from file";
apr_file_close(fp);
return "";
}
@@ -264,7 +266,7 @@ static char *ssl_expr_eval_func_file(req
}
/* a variant of strcmp(3) which works correctly also for number strings */
-static int ssl_expr_eval_strcmplex(char *cpNum1, char *cpNum2)
+static int ssl_expr_eval_strcmplex(char *cpNum1, char *cpNum2, const char **err)
{
int i, n1, n2;
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Thursday 30 September 2010, William A. Rowe Jr. wrote:
>
> 2001-09-18 Marc Autret <au...@epita.fr>
>
> * src/getargs.c (longopts): Declare --defines and --graph as
> options with optional arguments.
>
> Seems we need to declare that bison must be rev 1.30 or later.
If you want to go that way: %lex-param and %parse-param need 1.75b or
later.
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 9/29/2010 4:51 PM, Stefan Fritsch wrote:
>
> Your version is a bit old:
>
> I am not really a bison/flex expert and have no idea which features
> have been introduced in which version.
2001-09-18 Marc Autret <au...@epita.fr>
* src/getargs.c (longopts): Declare --defines and --graph as options
with optional arguments.
Seems we need to declare that bison must be rev 1.30 or later.
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Thursday 30 September 2010, Rainer Jung wrote:
> On 30.09.2010 11:08, Stefan Fritsch wrote:
> > On Thursday 30 September 2010, Rainer Jung wrote:
> >> On 30.09.2010 10:24, Stefan Fritsch wrote:
> >>> On Thursday 30 September 2010, William A. Rowe Jr. wrote:
> >>>> On 9/29/2010 6:49 PM, Guenter Knauf wrote:
> >>>>> Am 30.09.2010 01:17, schrieb Guenter Knauf:
> >>>>>> a touch would probably do ... - if not I will face same for
> >>>>>> NetWare ...
> >>>>>
> >>>>> just checked, and beside some new prototype warnings:
> >>>>> Compiling ssl_expr_scan.c
> >>>>> ### mwccnlm Compiler:
> >>>>> # File: ssl_expr_scan.c
> >>>>> # ------------------------
> >>>>> # 2066: {
> >>>>> # Warning: ^
> >>>>> # function has no prototype
> >>>>> ### mwccnlm Compiler:
> >>>>> # 2142: {
> >>>>> # Warning: ^
> >>>>> # function has no prototype
> >>>
> >>> No, those are the ones I mentioned in the commit log. They
> >>> appear with gcc, too:
> >>>
> >>> ssl_expr_scan.c:2065: warning: no previous prototype for
> >>> 'ssl_expr_yyget_column'
> >>> ssl_expr_scan.c:2141: warning: no previous prototype for
> >>> 'ssl_expr_yyset_column'
> >>>
> >>> If someone has a the latest Fedora and can regenerate the file,
> >>> that would probably fix it. Otherwise it will have to wait
> >>> until the fixed flex is in Debian, I am too lazy to install a
> >>> new flex from source for just too warnings.
> >>
> >> Do you have a pointer to the flex source code you want to be
> >> used? I build the toolchain for myself on Solaris, so I can
> >> easily update from 2.5.35 to some custom version to do this
> >> test.
> >
> > That would be nice. There is no official release, yet, but this
> > bug report has a patch:
> >
> > http://sourceforge.net/tracker/?func=detail&aid=3029024&group_id=
> > 97492&atid=618177
> >
> > (I have read somewhere that Fedora has included the patch)
>
> I also get the warning (only when using "-Wmissing-prototypes", the
> flag "-Wall" didn't produce the warning) for the original file.
>
> I rebuilt flex with the above patch (original flex 2.5.35, no other
> patch) and regenerated the file. No more warning and two additional
> prototypes are there:
>
> +int ssl_expr_yyget_column (yyscan_t yyscanner );
> +
> +void ssl_expr_yyset_column (int column_no ,yyscan_t yyscanner );
> +
>
> The full diff is available at:
>
> http://people.apache.org/~rjung/patches/patched-flex-ssl_expr_scan_
> c.patch
>
> Unfortunately it looks like my flex plus one patch also changes
> other stuff, which looks more correct in your version, likely
> because your flex already contains other pathces (the original
> version 2.5.35 is already about 2 years old, but there is no more
> recent official release).
>
> So I'm not sure, what we should check in. I'd say leave as if, as
> results will vary depending on the system the RM uses and the
> missing prototype warnings are not too bad.
Thanks for trying. I agree that we should leave it as it is for the
time being.
> I also rebuild ssl_expr_parse.(c|h) with bison 2.4.2 I had at hand.
> Latest would be 2.4.3. The header file does not contain any
> relevant difference. The source files does have some differences
> in the macro use.
>
> Full diff here:
>
> http://people.apache.org/~rjung/patches/bison-2_4_2-ssl_expr_parse.
> patch
>
> Finally: I tweaked the Makefile a bit to allowe out of tree use of
> the flex and bison targets (r1003061). There is still an open
> point for me:
>
> at the moment when doing an out of tree build and when the
> timestamps are not right, the targets generate the new source and
> header files in the build directory, not the source directory. At
> least when I tested it, those win, so the compiled code uses the
> right ones without overriding the original ones. Is that like we
> want it, or do we actually want to regenerate in the source
> directory?
I think if one builds out of tree, one does not want the real source
directories to be modified. So the current behaviour seems fine to me.
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Rainer Jung <ra...@kippdata.de>.
On 30.09.2010 11:08, Stefan Fritsch wrote:
> On Thursday 30 September 2010, Rainer Jung wrote:
>> On 30.09.2010 10:24, Stefan Fritsch wrote:
>>> On Thursday 30 September 2010, William A. Rowe Jr. wrote:
>>>> On 9/29/2010 6:49 PM, Guenter Knauf wrote:
>>>>> Am 30.09.2010 01:17, schrieb Guenter Knauf:
>>>>>> a touch would probably do ... - if not I will face same for
>>>>>> NetWare ...
>>>>>
>>>>> just checked, and beside some new prototype warnings:
>>>>> Compiling ssl_expr_scan.c
>>>>> ### mwccnlm Compiler:
>>>>> # File: ssl_expr_scan.c
>>>>> # ------------------------
>>>>> # 2066: {
>>>>> # Warning: ^
>>>>> # function has no prototype
>>>>> ### mwccnlm Compiler:
>>>>> # 2142: {
>>>>> # Warning: ^
>>>>> # function has no prototype
>>>
>>> No, those are the ones I mentioned in the commit log. They appear
>>> with gcc, too:
>>>
>>> ssl_expr_scan.c:2065: warning: no previous prototype for
>>> 'ssl_expr_yyget_column'
>>> ssl_expr_scan.c:2141: warning: no previous prototype for
>>> 'ssl_expr_yyset_column'
>>>
>>> If someone has a the latest Fedora and can regenerate the file,
>>> that would probably fix it. Otherwise it will have to wait until
>>> the fixed flex is in Debian, I am too lazy to install a new flex
>>> from source for just too warnings.
>>
>> Do you have a pointer to the flex source code you want to be used?
>> I build the toolchain for myself on Solaris, so I can easily
>> update from 2.5.35 to some custom version to do this test.
>
> That would be nice. There is no official release, yet, but this bug
> report has a patch:
>
> http://sourceforge.net/tracker/?func=detail&aid=3029024&group_id=97492&atid=618177
>
> (I have read somewhere that Fedora has included the patch)
I also get the warning (only when using "-Wmissing-prototypes", the flag
"-Wall" didn't produce the warning) for the original file.
I rebuilt flex with the above patch (original flex 2.5.35, no other
patch) and regenerated the file. No more warning and two additional
prototypes are there:
+int ssl_expr_yyget_column (yyscan_t yyscanner );
+
+void ssl_expr_yyset_column (int column_no ,yyscan_t yyscanner );
+
The full diff is available at:
http://people.apache.org/~rjung/patches/patched-flex-ssl_expr_scan_c.patch
Unfortunately it looks like my flex plus one patch also changes other
stuff, which looks more correct in your version, likely because your
flex already contains other pathces (the original version 2.5.35 is
already about 2 years old, but there is no more recent official release).
So I'm not sure, what we should check in. I'd say leave as if, as
results will vary depending on the system the RM uses and the missing
prototype warnings are not too bad.
I also rebuild ssl_expr_parse.(c|h) with bison 2.4.2 I had at hand.
Latest would be 2.4.3. The header file does not contain any relevant
difference. The source files does have some differences in the macro use.
Full diff here:
http://people.apache.org/~rjung/patches/bison-2_4_2-ssl_expr_parse.patch
Finally: I tweaked the Makefile a bit to allowe out of tree use of the
flex and bison targets (r1003061). There is still an open point for me:
at the moment when doing an out of tree build and when the timestamps
are not right, the targets generate the new source and header files in
the build directory, not the source directory. At least when I tested
it, those win, so the compiled code uses the right ones without
overriding the original ones. Is that like we want it, or do we actually
want to regenerate in the source directory?
Regards,
Rainer
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Thursday 30 September 2010, Rainer Jung wrote:
> On 30.09.2010 10:24, Stefan Fritsch wrote:
> > On Thursday 30 September 2010, William A. Rowe Jr. wrote:
> >> On 9/29/2010 6:49 PM, Guenter Knauf wrote:
> >>> Am 30.09.2010 01:17, schrieb Guenter Knauf:
> >>>> a touch would probably do ... - if not I will face same for
> >>>> NetWare ...
> >>>
> >>> just checked, and beside some new prototype warnings:
> >>> Compiling ssl_expr_scan.c
> >>> ### mwccnlm Compiler:
> >>> # File: ssl_expr_scan.c
> >>> # ------------------------
> >>> # 2066: {
> >>> # Warning: ^
> >>> # function has no prototype
> >>> ### mwccnlm Compiler:
> >>> # 2142: {
> >>> # Warning: ^
> >>> # function has no prototype
> >
> > No, those are the ones I mentioned in the commit log. They appear
> > with gcc, too:
> >
> > ssl_expr_scan.c:2065: warning: no previous prototype for
> > 'ssl_expr_yyget_column'
> > ssl_expr_scan.c:2141: warning: no previous prototype for
> > 'ssl_expr_yyset_column'
> >
> > If someone has a the latest Fedora and can regenerate the file,
> > that would probably fix it. Otherwise it will have to wait until
> > the fixed flex is in Debian, I am too lazy to install a new flex
> > from source for just too warnings.
>
> Do you have a pointer to the flex source code you want to be used?
> I build the toolchain for myself on Solaris, so I can easily
> update from 2.5.35 to some custom version to do this test.
That would be nice. There is no official release, yet, but this bug
report has a patch:
http://sourceforge.net/tracker/?func=detail&aid=3029024&group_id=97492&atid=618177
(I have read somewhere that Fedora has included the patch)
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Rainer Jung <ra...@kippdata.de>.
On 30.09.2010 10:24, Stefan Fritsch wrote:
> On Thursday 30 September 2010, William A. Rowe Jr. wrote:
>> On 9/29/2010 6:49 PM, Guenter Knauf wrote:
>>> Am 30.09.2010 01:17, schrieb Guenter Knauf:
>>>> a touch would probably do ... - if not I will face same for
>>>> NetWare ...
>>>
>>> just checked, and beside some new prototype warnings:
>>> Compiling ssl_expr_scan.c
>>> ### mwccnlm Compiler:
>>> # File: ssl_expr_scan.c
>>> # ------------------------
>>> # 2066: {
>>> # Warning: ^
>>> # function has no prototype
>>> ### mwccnlm Compiler:
>>> # 2142: {
>>> # Warning: ^
>>> # function has no prototype
>
> No, those are the ones I mentioned in the commit log. They appear with
> gcc, too:
>
> ssl_expr_scan.c:2065: warning: no previous prototype for
> 'ssl_expr_yyget_column'
> ssl_expr_scan.c:2141: warning: no previous prototype for
> 'ssl_expr_yyset_column'
>
> If someone has a the latest Fedora and can regenerate the file, that
> would probably fix it. Otherwise it will have to wait until the fixed
> flex is in Debian, I am too lazy to install a new flex from source for
> just too warnings.
Do you have a pointer to the flex source code you want to be used? I
build the toolchain for myself on Solaris, so I can easily update from
2.5.35 to some custom version to do this test.
Regards,
Rainer
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Thursday 30 September 2010, William A. Rowe Jr. wrote:
> On 9/29/2010 6:49 PM, Guenter Knauf wrote:
> > Am 30.09.2010 01:17, schrieb Guenter Knauf:
> >> a touch would probably do ... - if not I will face same for
> >> NetWare ...
> >
> > just checked, and beside some new prototype warnings:
> > Compiling ssl_expr_scan.c
> > ### mwccnlm Compiler:
> > # File: ssl_expr_scan.c
> > # ------------------------
> > # 2066: {
> > # Warning: ^
> > # function has no prototype
> > ### mwccnlm Compiler:
> > # 2142: {
> > # Warning: ^
> > # function has no prototype
No, those are the ones I mentioned in the commit log. They appear with
gcc, too:
ssl_expr_scan.c:2065: warning: no previous prototype for
'ssl_expr_yyget_column'
ssl_expr_scan.c:2141: warning: no previous prototype for
'ssl_expr_yyset_column'
If someone has a the latest Fedora and can regenerate the file, that
would probably fix it. Otherwise it will have to wait until the fixed
flex is in Debian, I am too lazy to install a new flex from source for
just too warnings.
> Those are the malloc free namespace collisions?
Can you expand on this? It should be possible to rewrite
yyalloc/yyrealloc/yyfree in terms of apr_palloc, but I didn't think it
was worth the effort. Do you think that would help you?
> > it compiles fine for NetWare. We have this in our NWGNUmakefile:
> Cool - we are broken on Win32 by the include unistd.h, dunno about
> OS2.
There is a flex option for that. Please try if this patch helps:
http://people.apache.org/~sf/flex-no-unistd.diff
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Guenter Knauf <fu...@apache.org>.
Am 30.09.2010 02:06, schrieb William A. Rowe Jr.:
> Those are the malloc free namespace collisions?
not looked at yet.
> Cool - we are broken on Win32 by the include unistd.h, dunno about OS2.
AFAIK both native compile with Watcom as well as EMX have unistd.h.
Gün.
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 9/29/2010 6:49 PM, Guenter Knauf wrote:
> Am 30.09.2010 01:17, schrieb Guenter Knauf:
>> a touch would probably do ... - if not I will face same for NetWare ...
> just checked, and beside some new prototype warnings:
> Compiling ssl_expr_scan.c
> ### mwccnlm Compiler:
> # File: ssl_expr_scan.c
> # ------------------------
> # 2066: {
> # Warning: ^
> # function has no prototype
> ### mwccnlm Compiler:
> # 2142: {
> # Warning: ^
> # function has no prototype
Those are the malloc free namespace collisions?
> it compiles fine for NetWare. We have this in our NWGNUmakefile:
Cool - we are broken on Win32 by the include unistd.h, dunno about OS2.
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Guenter Knauf <fu...@apache.org>.
Am 30.09.2010 01:17, schrieb Guenter Knauf:
> a touch would probably do ... - if not I will face same for NetWare ...
just checked, and beside some new prototype warnings:
Compiling ssl_expr_scan.c
### mwccnlm Compiler:
# File: ssl_expr_scan.c
# ------------------------
# 2066: {
# Warning: ^
# function has no prototype
### mwccnlm Compiler:
# 2142: {
# Warning: ^
# function has no prototype
it compiles fine for NetWare. We have this in our NWGNUmakefile:
# Make sure that the build doesn't attempt to regenerate the shipping files.
# This requires a 'touch' utility. Can be downloaded from 'coreutils' at
# http://sourceforge.net/projects/gnuwin32/
ssl_expr_parse.h : ssl_expr_parse.y
touch ssl_expr_parse.h
ssl_expr_parse.c : ssl_expr_parse.y
touch ssl_expr_parse.c
ssl_expr_scan.c : ssl_expr_scan.l
touch ssl_expr_scan.c
Gün.
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Guenter Knauf <fu...@apache.org>.
Am 30.09.2010 00:15, schrieb William A. Rowe Jr.:
> On 9/29/2010 4:51 PM, Stefan Fritsch wrote:
>>
>> Maybe you just need to run buildconf once to fix the timestamps?
>
> on Win32? ;-P
a touch would probably do ... - if not I will face same for NetWare ...
Gün.
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 9/29/2010 4:51 PM, Stefan Fritsch wrote:
>
> Maybe you just need to run buildconf once to fix the timestamps?
on Win32? ;-P
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Wednesday 29 September 2010, William A. Rowe Jr. wrote:
> On 9/29/2010 4:31 PM, William A. Rowe Jr. wrote:
> > Working to catch up the win32 build change here...
I am not sure you need to care about that. See below
> > You just invalidated some arbitrary versions of bison (testing on
> > 1.28)... "option `--defines' doesn't allow an argument"
> >
> > Should we be testing for a baseline rev of bison which is
> > acceptable?
Your version is a bit old:
2001-09-07 Akim Demaille <ak...@epita.fr>
Version 1.29.
I am not really a bison/flex expert and have no idea which features
have been introduced in which version. I know it works with 2.4.1,
therefore I would say the required baseline is 2.4.0. And it should
not matter much, since ...
> For that matter... should we simply move this to buildconf?
... normally bison/flex is not executed at all during a build.
Buildconf (at least on unix) takes care that the timestamps are set so
that make thinks the files are up to date. And the generated files are
included in httpd. People who are not hacking on the .y/.l files
should not need to care about bison and flex.
Maybe you just need to run buildconf once to fix the timestamps?
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 9/29/2010 4:31 PM, William A. Rowe Jr. wrote:
> Working to catch up the win32 build change here...
>
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/Makefile.in?rev=1002824&r1=1002823&r2=1002824&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/ssl/Makefile.in (original)
>> +++ httpd/httpd/trunk/modules/ssl/Makefile.in Wed Sep 29 19:42:03 2010
>> @@ -25,15 +25,13 @@ include $(top_srcdir)/build/special.mk
>> #
>>
>> ssl_expr_scan.c: $(top_srcdir)/modules/ssl/ssl_expr_scan.l ssl_expr_parse.h
>> - flex -Pssl_expr_yy -s -B $(top_srcdir)/modules/ssl/ssl_expr_scan.l
>> - sed -e '/$$Header:/d' -e "s|\"`pwd`/|\"|g" <lex.ssl_expr_yy.c >ssl_expr_scan.c && rm -f lex.ssl_expr_yy.c
>> + flex -Pssl_expr_yy -o ssl_expr_scan.c ssl_expr_scan.l
>> + mv ssl_expr_scan.c ssl_expr_scan.c.tmp
>> + sed -e "s|\"`pwd`/|\"|g" <ssl_expr_scan.c.tmp >ssl_expr_scan.c
>> + rm -f ssl_expr_scan.c.tmp
>>
>> ssl_expr_parse.c ssl_expr_parse.h: $(top_srcdir)/modules/ssl/ssl_expr_parse.y
>> - yacc -d $(top_srcdir)/modules/ssl/ssl_expr_parse.y
>> - sed -e 's;yy;ssl_expr_yy;g' \
>> - -e "s|\"`pwd`/|\"|g" \
>> - -e '/#if defined(c_plusplus) || defined(__cplusplus)/,/#endif/d' \
>> - <y.tab.c >ssl_expr_parse.c && rm -f y.tab.c
>> - sed -e 's;yy;ssl_expr_yy;g' \
>> - <y.tab.h >ssl_expr_parse.h && rm -f y.tab.h
>> -
>> + bison -pssl_expr_yy --defines=ssl_expr_parse.h -o ssl_expr_parse.c ssl_expr_parse.y
>> + mv ssl_expr_parse.c ssl_expr_parse.c.tmp
>> + sed -e "s|\"`pwd`/|\"|g" < ssl_expr_parse.c.tmp > ssl_expr_parse.c
>> + rm -f ssl_expr_parse.c.tmp
>>
>
> You just invalidated some arbitrary versions of bison (testing on 1.28)...
> "option `--defines' doesn't allow an argument"
>
> Should we be testing for a baseline rev of bison which is acceptable?
For that matter... should we simply move this to buildconf?
Re: svn commit: r1002824 [1/4] - in /httpd/httpd/trunk: ./ modules/ssl/
Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
Working to catch up the win32 build change here...
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/Makefile.in?rev=1002824&r1=1002823&r2=1002824&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/ssl/Makefile.in (original)
> +++ httpd/httpd/trunk/modules/ssl/Makefile.in Wed Sep 29 19:42:03 2010
> @@ -25,15 +25,13 @@ include $(top_srcdir)/build/special.mk
> #
>
> ssl_expr_scan.c: $(top_srcdir)/modules/ssl/ssl_expr_scan.l ssl_expr_parse.h
> - flex -Pssl_expr_yy -s -B $(top_srcdir)/modules/ssl/ssl_expr_scan.l
> - sed -e '/$$Header:/d' -e "s|\"`pwd`/|\"|g" <lex.ssl_expr_yy.c >ssl_expr_scan.c && rm -f lex.ssl_expr_yy.c
> + flex -Pssl_expr_yy -o ssl_expr_scan.c ssl_expr_scan.l
> + mv ssl_expr_scan.c ssl_expr_scan.c.tmp
> + sed -e "s|\"`pwd`/|\"|g" <ssl_expr_scan.c.tmp >ssl_expr_scan.c
> + rm -f ssl_expr_scan.c.tmp
>
> ssl_expr_parse.c ssl_expr_parse.h: $(top_srcdir)/modules/ssl/ssl_expr_parse.y
> - yacc -d $(top_srcdir)/modules/ssl/ssl_expr_parse.y
> - sed -e 's;yy;ssl_expr_yy;g' \
> - -e "s|\"`pwd`/|\"|g" \
> - -e '/#if defined(c_plusplus) || defined(__cplusplus)/,/#endif/d' \
> - <y.tab.c >ssl_expr_parse.c && rm -f y.tab.c
> - sed -e 's;yy;ssl_expr_yy;g' \
> - <y.tab.h >ssl_expr_parse.h && rm -f y.tab.h
> -
> + bison -pssl_expr_yy --defines=ssl_expr_parse.h -o ssl_expr_parse.c ssl_expr_parse.y
> + mv ssl_expr_parse.c ssl_expr_parse.c.tmp
> + sed -e "s|\"`pwd`/|\"|g" < ssl_expr_parse.c.tmp > ssl_expr_parse.c
> + rm -f ssl_expr_parse.c.tmp
>
You just invalidated some arbitrary versions of bison (testing on 1.28)...
"option `--defines' doesn't allow an argument"
Should we be testing for a baseline rev of bison which is acceptable?