Hi,
I tried to compile subversion trunk with httpd trunk code. make fails
with the attached error.
Then I got that there is a macro APLOG_MARK which expands differently in
httpd-2.2.x and httpd-2.3-dev.
From httpd-2.2.x,
#define APLOG_MARK __FILE__,__LINE__
From httpd-2.3-dev,
#define APLOG_MARK __FILE__,__LINE__,APLOG_MODULE_INDEX
The method
"subversion/mod_authz_svn/mod_authz_svn.c:log_access_verdict()" is being
called with the argument APLOG_MARK in few places. As it is getting
expanded to three arguments in httpd-2.3-dev, but the orginal
implementation of log_access_verdict accepts only two arguments(file and
line), make fails with "error: too many arguments to function
‘log_access_verdict’".
Attaching the patch that works for httpd-trunk as well as older versions.
Thanks & Regards,
Vijayaguru
/home/vijayaguru/svn-sandbox/svn-trunk/vpath_for_apache/apr/libtool --tag=CC
--silent --mode=compile gcc -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE
-D_LARGEFILE64_SOURCE -Wno-system-headers -Wold-style-definition
-Werror=declaration-after-statement -Wpointer-arith -Wwrite-strings -Wshadow
-ansi -Wall -Wformat=2 -Wunused -Waggregate-return -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wno-multichar -Wredundant-decls
-Wnested-externs -Wunreachable-code -Winline -Wno-long-long -g -g -Wall
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread
-D_LARGEFILE64_SOURCE -DNE_LFS -Werror=implicit-function-declaration
-DSVN_DEBUG -DAP_DEBUG -I/home/vijayaguru/svn-sandbox/httpd-trunk/include
-I../subversion/include -I./subversion
-I/home/vijayaguru/svn-sandbox/svn-trunk/vpath_for_apache/apr/include
-I/home/vijayaguru/svn-sandbox/svn-trunk/apr/include
-I/home/vijayaguru/svn-sandbox/svn-trunk/vpath_for_apache/apr-util/include
-I/home/vijayaguru/svn-sandbox/svn-trunk/apr-util/include
-I/home/vijayaguru/svn-sandbox/neon-0.29.3/include/neon
-I/home/vijayaguru/svn-sandbox/serf-0.7.1/include/serf-0
-I/home/vijayaguru/svn-sandbox/sqlite-3.6.20/include -o
subversion/mod_authz_svn/mod_authz_svn.lo -c
../subversion/mod_authz_svn/mod_authz_svn.c
../subversion/mod_authz_svn/mod_authz_svn.c: In function
âlog_access_verdictâ:
../subversion/mod_authz_svn/mod_authz_svn.c:539: warning: passing argument 5 of
âap_log_rerror_â makes integer from pointer without a cast
/home/vijayaguru/svn-sandbox/httpd-trunk/include/http_log.h:435: note: expected
âapr_status_tâ but argument is of type âconst struct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:539: warning: passing argument 6 of
âap_log_rerror_â from incompatible pointer type
/home/vijayaguru/svn-sandbox/httpd-trunk/include/http_log.h:435: note: expected
âconst struct request_rec *â but argument is of type âconst char *â
../subversion/mod_authz_svn/mod_authz_svn.c:539: warning: format not a string
literal, argument types not checked
../subversion/mod_authz_svn/mod_authz_svn.c:543: warning: passing argument 5 of
âap_log_rerror_â makes integer from pointer without a cast
/home/vijayaguru/svn-sandbox/httpd-trunk/include/http_log.h:435: note: expected
âapr_status_tâ but argument is of type âconst struct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:543: warning: passing argument 6 of
âap_log_rerror_â from incompatible pointer type
/home/vijayaguru/svn-sandbox/httpd-trunk/include/http_log.h:435: note: expected
âconst struct request_rec *â but argument is of type âconst char *â
../subversion/mod_authz_svn/mod_authz_svn.c:543: warning: format not a string
literal, argument types not checked
../subversion/mod_authz_svn/mod_authz_svn.c:550: warning: passing argument 5 of
âap_log_rerror_â makes integer from pointer without a cast
/home/vijayaguru/svn-sandbox/httpd-trunk/include/http_log.h:435: note: expected
âapr_status_tâ but argument is of type âconst struct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:550: warning: passing argument 6 of
âap_log_rerror_â from incompatible pointer type
/home/vijayaguru/svn-sandbox/httpd-trunk/include/http_log.h:435: note: expected
âconst struct request_rec *â but argument is of type âconst char *â
../subversion/mod_authz_svn/mod_authz_svn.c:550: warning: format not a string
literal, argument types not checked
../subversion/mod_authz_svn/mod_authz_svn.c:554: warning: passing argument 5 of
âap_log_rerror_â makes integer from pointer without a cast
/home/vijayaguru/svn-sandbox/httpd-trunk/include/http_log.h:435: note: expected
âapr_status_tâ but argument is of type âconst struct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:554: warning: passing argument 6 of
âap_log_rerror_â from incompatible pointer type
/home/vijayaguru/svn-sandbox/httpd-trunk/include/http_log.h:435: note: expected
âconst struct request_rec *â but argument is of type âconst char *â
../subversion/mod_authz_svn/mod_authz_svn.c:554: warning: format not a string
literal, argument types not checked
../subversion/mod_authz_svn/mod_authz_svn.c: In function âsubreq_bypassâ:
../subversion/mod_authz_svn/mod_authz_svn.c:583: warning: passing argument 3 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst struct
request_rec *â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:583: warning: passing argument 4 of
âlog_access_verdictâ makes integer from pointer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âintâ but
argument is of type âstruct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:583: error: too many arguments to
function âlog_access_verdictâ
../subversion/mod_authz_svn/mod_authz_svn.c:621: warning: passing argument 3 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst struct
request_rec *â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:621: warning: passing argument 4 of
âlog_access_verdictâ makes integer from pointer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âintâ but
argument is of type âstruct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:621: error: too many arguments to
function âlog_access_verdictâ
../subversion/mod_authz_svn/mod_authz_svn.c:626: warning: passing argument 3 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst struct
request_rec *â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:626: warning: passing argument 4 of
âlog_access_verdictâ makes integer from pointer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âintâ but
argument is of type âstruct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:626: warning: passing argument 5 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst char
*â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:626: error: too many arguments to
function âlog_access_verdictâ
../subversion/mod_authz_svn/mod_authz_svn.c: In function âaccess_checkerâ:
../subversion/mod_authz_svn/mod_authz_svn.c:680: warning: passing argument 3 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst struct
request_rec *â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:680: warning: passing argument 4 of
âlog_access_verdictâ makes integer from pointer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âintâ but
argument is of type âstruct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:680: error: too many arguments to
function âlog_access_verdictâ
../subversion/mod_authz_svn/mod_authz_svn.c:688: warning: passing argument 3 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst struct
request_rec *â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:688: warning: passing argument 4 of
âlog_access_verdictâ makes integer from pointer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âintâ but
argument is of type âstruct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:688: warning: passing argument 5 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst char
*â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:688: error: too many arguments to
function âlog_access_verdictâ
../subversion/mod_authz_svn/mod_authz_svn.c: In function âcheck_user_idâ:
../subversion/mod_authz_svn/mod_authz_svn.c:715: warning: passing argument 3 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst struct
request_rec *â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:715: warning: passing argument 4 of
âlog_access_verdictâ makes integer from pointer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âintâ but
argument is of type âstruct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:715: warning: passing argument 5 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst char
*â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:715: error: too many arguments to
function âlog_access_verdictâ
../subversion/mod_authz_svn/mod_authz_svn.c: In function âauth_checkerâ:
../subversion/mod_authz_svn/mod_authz_svn.c:745: warning: passing argument 3 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst struct
request_rec *â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:745: warning: passing argument 4 of
âlog_access_verdictâ makes integer from pointer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âintâ but
argument is of type âstruct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:745: error: too many arguments to
function âlog_access_verdictâ
../subversion/mod_authz_svn/mod_authz_svn.c:755: warning: passing argument 3 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst struct
request_rec *â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:755: warning: passing argument 4 of
âlog_access_verdictâ makes integer from pointer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âintâ but
argument is of type âstruct request_rec *â
../subversion/mod_authz_svn/mod_authz_svn.c:755: warning: passing argument 5 of
âlog_access_verdictâ makes pointer from integer without a cast
../subversion/mod_authz_svn/mod_authz_svn.c:527: note: expected âconst char
*â but argument is of type âintâ
../subversion/mod_authz_svn/mod_authz_svn.c:755: error: too many arguments to
function âlog_access_verdictâ
make: *** [subversion/mod_authz_svn/mod_authz_svn.lo] Error 1
[[[
Update log_access_verdict to make it work with httpd trunk as well as older
versions. The function is being called with APLOG_MACRO in few places.
The macro APLOG_MARK expands to 2 arguments till httpd-2.2.x but 3
arguments in httpd-2.3-dev, which causes failure while compiling with
httpd-2.3-dev. So we need to handle both the cases.
* subversion/mod_authz_svn/mod_authz_svn.c
(log_access_verdict): Modify the signature.
Patch by: Vijayaguru G <vijay{_AT_}collab.net>
Suggested by: Kameshj
]]]
Index: subversion/mod_authz_svn/mod_authz_svn.c
===================================================================
--- subversion/mod_authz_svn/mod_authz_svn.c (revision 1075316)
+++ subversion/mod_authz_svn/mod_authz_svn.c (working copy)
@@ -32,6 +32,7 @@
#include <http_log.h>
#include <ap_config.h>
#include <ap_provider.h>
+#include <ap_release.h>
#include <apr_uri.h>
#include <apr_lib.h>
#include <mod_dav.h>
@@ -519,12 +520,20 @@
return OK;
}
+#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER == 3
+#define LOG_ARGS_SIGNATURE const char *file, int line, int module_index
+#define LOG_ARGS_CASCADE file, line, module_index
+#else
+#define LOG_ARGS_SIGNATURE const char *file, int line
+#define LOG_ARGS_CASCADE file, line
+#endif
/* Log a message indicating the access control decision made about a
- * request. FILE and LINE should be supplied via the APLOG_MARK macro.
- * ALLOWED is boolean. REPOS_PATH and DEST_REPOS_PATH are information
+ * request. LOG_ARGS_SIGNATURE should be supplied via the APLOG_MARK macro
+ * with respect to Apache version. ALLOWED is boolean.
+ * REPOS_PATH and DEST_REPOS_PATH are information
* about the request. DEST_REPOS_PATH may be NULL. */
static void
-log_access_verdict(const char *file, int line,
+log_access_verdict(LOG_ARGS_SIGNATURE,
const request_rec *r, int allowed,
const char *repos_path, const char *dest_repos_path)
{
@@ -534,22 +543,22 @@
if (r->user)
{
if (dest_repos_path)
- ap_log_rerror(file, line, level, 0, r,
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
"Access %s: '%s' %s %s %s", verdict, r->user,
r->method, repos_path, dest_repos_path);
else
- ap_log_rerror(file, line, level, 0, r,
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
"Access %s: '%s' %s %s", verdict, r->user,
r->method, repos_path);
}
else
{
if (dest_repos_path)
- ap_log_rerror(file, line, level, 0, r,
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
"Access %s: - %s %s %s", verdict,
r->method, repos_path, dest_repos_path);
else
- ap_log_rerror(file, line, level, 0, r,
+ ap_log_rerror(LOG_ARGS_CASCADE, level, 0, r,
"Access %s: - %s %s", verdict,
r->method, repos_path);
}