You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jk...@apache.org on 2014/09/23 13:14:10 UTC

svn commit: r1626978 - in /httpd/httpd/trunk: docs/log-message-tags/next-number modules/generators/mod_cgi.c

Author: jkaluza
Date: Tue Sep 23 11:14:09 2014
New Revision: 1626978

URL: http://svn.apache.org/r1626978
Log:
mod_cgi: log cgi script stderr to ScriptLog, use APLOGNO for log_scripterror
errors.

Modified:
    httpd/httpd/trunk/docs/log-message-tags/next-number
    httpd/httpd/trunk/modules/generators/mod_cgi.c

Modified: httpd/httpd/trunk/docs/log-message-tags/next-number
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/next-number?rev=1626978&r1=1626977&r2=1626978&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
+++ httpd/httpd/trunk/docs/log-message-tags/next-number Tue Sep 23 11:14:09 2014
@@ -1 +1 @@
-2809
+2814

Modified: httpd/httpd/trunk/modules/generators/mod_cgi.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgi.c?rev=1626978&r1=1626977&r2=1626978&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_cgi.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_cgi.c Tue Sep 23 11:14:09 2014
@@ -162,7 +162,7 @@ AP_INIT_TAKE1("ScriptLogBuffer", set_scr
 };
 
 static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret,
-                           apr_status_t rv, char *error)
+                           apr_status_t rv, char *logno, char *error)
 {
     apr_file_t *f = NULL;
     apr_finfo_t finfo;
@@ -170,7 +170,7 @@ static int log_scripterror(request_rec *
     int log_flags = rv ? APLOG_ERR : APLOG_ERR;
 
     ap_log_rerror(APLOG_MARK, log_flags, rv, r,
-                  "%s: %s", error, r->filename);
+                  "%s%s: %s", logno ? logno : "", error, r->filename);
 
     /* XXX Very expensive mainline case! Open, then getfileinfo! */
     if (!conf->logname ||
@@ -203,6 +203,7 @@ static apr_status_t log_script_err(reque
     char argsbuffer[HUGE_STRING_LEN];
     char *newline;
     apr_status_t rv;
+    cgi_server_conf *conf = ap_get_module_config(r->server->module_config, &cgi_module);
 
     while ((rv = apr_file_gets(argsbuffer, HUGE_STRING_LEN,
                                script_err)) == APR_SUCCESS) {
@@ -210,8 +211,7 @@ static apr_status_t log_script_err(reque
         if (newline) {
             *newline = '\0';
         }
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01215)
-                      "%s", argsbuffer);
+        log_scripterror(r, conf, r->status, 0, APLOGNO(01215), argsbuffer);
     }
 
     return rv;
@@ -774,24 +774,24 @@ static int cgi_handler(request_rec *r)
     conf = ap_get_module_config(r->server->module_config, &cgi_module);
 
     if (!(ap_allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r))
-        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0,
+        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, APLOGNO(02809),
                                "Options ExecCGI is off in this directory");
     if (nph && is_included)
-        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0,
+        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, APLOGNO(02810),
                                "attempt to include NPH CGI script");
 
     if (r->finfo.filetype == APR_NOFILE)
-        return log_scripterror(r, conf, HTTP_NOT_FOUND, 0,
+        return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, APLOGNO(02811),
                                "script not found or unable to stat");
     if (r->finfo.filetype == APR_DIR)
-        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0,
+        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, APLOGNO(02812),
                                "attempt to invoke directory as script");
 
     if ((r->used_path_info == AP_REQ_REJECT_PATH_INFO) &&
         r->path_info && *r->path_info)
     {
         /* default to accept */
-        return log_scripterror(r, conf, HTTP_NOT_FOUND, 0,
+        return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, APLOGNO(02813),
                                "AcceptPathInfo off disallows user's path");
     }
 /*



Re: svn commit: r1626978 - in /httpd/httpd/trunk: docs/log-message-tags/next-number modules/generators/mod_cgi.c

Posted by olli hauer <oh...@gmx.de>.
On 2015-01-17 14:44, Rainer Jung wrote:
> Am 17.01.2015 um 05:45 schrieb Rainer Jung:
>> Hi Jan,
>>
>> Am 23.09.2014 um 13:14 schrieb jkaluza@apache.org:
>>> Author: jkaluza
>>> Date: Tue Sep 23 11:14:09 2014
>>> New Revision: 1626978
>>>
>>> URL: http://svn.apache.org/r1626978
>>> Log:
>>> mod_cgi: log cgi script stderr to ScriptLog, use APLOGNO for
>>> log_scripterror
>>> errors.
>>>
>>> Modified:
>>>      httpd/httpd/trunk/docs/log-message-tags/next-number
>>>      httpd/httpd/trunk/modules/generators/mod_cgi.c
>>>
>> ...
>>> Modified: httpd/httpd/trunk/modules/generators/mod_cgi.c
>>> URL:
>>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgi.c?rev=1626978&r1=1626977&r2=1626978&view=diff
>>>
>>> ==============================================================================
>>>
>>> --- httpd/httpd/trunk/modules/generators/mod_cgi.c (original)
>>> +++ httpd/httpd/trunk/modules/generators/mod_cgi.c Tue Sep 23 11:14:09
>>> 2014
>> ...
>>> @@ -210,8 +211,7 @@ static apr_status_t log_script_err(reque
>>>           if (newline) {
>>>               *newline = '\0';
>>>           }
>>> -        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01215)
>>> -                      "%s", argsbuffer);
>>> +        log_scripterror(r, conf, r->status, 0, APLOGNO(01215),
>>> argsbuffer);
>>>       }
>>>
>>>       return rv;
>>
>> This fix and its backport to 2.4 seems to be incomplete. I can see the
>> STDERR output of nph-stderr.pl in the test framework now going to the
>> ScriptLog (after this patch, e.g. for 2.4.11) but only for some
>> platforms. On my Solaris 10 Sparc system it works, but on Solaris 8
>> Sparc or RHEL 6 the STDERR output still goes to the normal error log. I
>> don't expect it to be a real platform issue, but more a timing issue or
>> similar.
> 
> The problem does not occur for mod_cgi but only for mod_cgid.
> 
> If both are being build and installed, then the test framework will load both. It seems that for some reason my Solaris 10 Sparc system is the only one, on which the requests are then actually executed by mod_cgi, on all other platforms they are being executed by mod_cgid, which does not write stderr output to the ScriptLog but instead to STDERR which is captured by the error log.
> 
> So the fix to mod_cgi is *not* incomplete, but we should also fix it for mod_cgid.
> 
> Regards,
> 
> Rainer


Perhaps the patch could be from interest on the solaris platform
https://issues.apache.org/bugzilla/show_bug.cgi?id=57379

Haven't looked into other platforms then *NIX, and therefore no Idea what expression can be used for e.g MS.

Re: svn commit: r1626978 - in /httpd/httpd/trunk: docs/log-message-tags/next-number modules/generators/mod_cgi.c

Posted by Rainer Jung <ra...@kippdata.de>.
Am 17.01.2015 um 05:45 schrieb Rainer Jung:
> Hi Jan,
>
> Am 23.09.2014 um 13:14 schrieb jkaluza@apache.org:
>> Author: jkaluza
>> Date: Tue Sep 23 11:14:09 2014
>> New Revision: 1626978
>>
>> URL: http://svn.apache.org/r1626978
>> Log:
>> mod_cgi: log cgi script stderr to ScriptLog, use APLOGNO for
>> log_scripterror
>> errors.
>>
>> Modified:
>>      httpd/httpd/trunk/docs/log-message-tags/next-number
>>      httpd/httpd/trunk/modules/generators/mod_cgi.c
>>
> ...
>> Modified: httpd/httpd/trunk/modules/generators/mod_cgi.c
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgi.c?rev=1626978&r1=1626977&r2=1626978&view=diff
>>
>> ==============================================================================
>>
>> --- httpd/httpd/trunk/modules/generators/mod_cgi.c (original)
>> +++ httpd/httpd/trunk/modules/generators/mod_cgi.c Tue Sep 23 11:14:09
>> 2014
> ...
>> @@ -210,8 +211,7 @@ static apr_status_t log_script_err(reque
>>           if (newline) {
>>               *newline = '\0';
>>           }
>> -        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01215)
>> -                      "%s", argsbuffer);
>> +        log_scripterror(r, conf, r->status, 0, APLOGNO(01215),
>> argsbuffer);
>>       }
>>
>>       return rv;
>
> This fix and its backport to 2.4 seems to be incomplete. I can see the
> STDERR output of nph-stderr.pl in the test framework now going to the
> ScriptLog (after this patch, e.g. for 2.4.11) but only for some
> platforms. On my Solaris 10 Sparc system it works, but on Solaris 8
> Sparc or RHEL 6 the STDERR output still goes to the normal error log. I
> don't expect it to be a real platform issue, but more a timing issue or
> similar.

The problem does not occur for mod_cgi but only for mod_cgid.

If both are being build and installed, then the test framework will load 
both. It seems that for some reason my Solaris 10 Sparc system is the 
only one, on which the requests are then actually executed by mod_cgi, 
on all other platforms they are being executed by mod_cgid, which does 
not write stderr output to the ScriptLog but instead to STDERR which is 
captured by the error log.

So the fix to mod_cgi is *not* incomplete, but we should also fix it for 
mod_cgid.

Regards,

Rainer

Re: svn commit: r1626978 - in /httpd/httpd/trunk: docs/log-message-tags/next-number modules/generators/mod_cgi.c

Posted by Rainer Jung <ra...@kippdata.de>.
Hi Jan,

Am 23.09.2014 um 13:14 schrieb jkaluza@apache.org:
> Author: jkaluza
> Date: Tue Sep 23 11:14:09 2014
> New Revision: 1626978
>
> URL: http://svn.apache.org/r1626978
> Log:
> mod_cgi: log cgi script stderr to ScriptLog, use APLOGNO for log_scripterror
> errors.
>
> Modified:
>      httpd/httpd/trunk/docs/log-message-tags/next-number
>      httpd/httpd/trunk/modules/generators/mod_cgi.c
>
...
> Modified: httpd/httpd/trunk/modules/generators/mod_cgi.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgi.c?rev=1626978&r1=1626977&r2=1626978&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/generators/mod_cgi.c (original)
> +++ httpd/httpd/trunk/modules/generators/mod_cgi.c Tue Sep 23 11:14:09 2014
...
> @@ -210,8 +211,7 @@ static apr_status_t log_script_err(reque
>           if (newline) {
>               *newline = '\0';
>           }
> -        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01215)
> -                      "%s", argsbuffer);
> +        log_scripterror(r, conf, r->status, 0, APLOGNO(01215), argsbuffer);
>       }
>
>       return rv;

This fix and its backport to 2.4 seems to be incomplete. I can see the 
STDERR output of nph-stderr.pl in the test framework now going to the 
ScriptLog (after this patch, e.g. for 2.4.11) but only for some 
platforms. On my Solaris 10 Sparc system it works, but on Solaris 8 
Sparc or RHEL 6 the STDERR output still goes to the normal error log. I 
don't expect it to be a real platform issue, but more a timing issue or 
similar.

Regards,

Rainer