Bug 28815 - ErrorLog piped command doesn't handle redirections
Summary: ErrorLog piped command doesn't handle redirections
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.0.49
Hardware: All other
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
: 16391 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-06 18:20 UTC by Russell Miller
Modified: 2006-10-03 11:59 UTC (History)
1 user (show)



Attachments
run piped loggers via shell (1.03 KB, patch)
2004-05-06 19:19 UTC, Jeff Trawick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Russell Miller 2004-05-06 18:20:22 UTC
In apache 1.3 if you use a command as such: 
 
ErrorLog "|command >> filename" 
 
It will work, as there is an implicit passthrough to a shell. 
 
In 2.0.49, this behavior is still documented, but it doesn't appear to work.  
Replacing it with: 
 
ErrorLog "|/bin/sh -c \"command >> filename\"" 
 
does work. 
 
On looking at the code, it appears that there is an APR_SHELLCMD procattr, 
which must be set upon calling apr_create_proc if you want it to pass the child 
process through /bin/sh.  This is not set in the code that opens the error log 
child process. 
 
I'm 100% certain that there is a bug - The question is whether it is in the 
documentation or in the core.  I leave it to you to make that determination. 
 
Thanks. 
 
--Russell
Comment 1 Jeff Trawick 2004-05-06 19:18:29 UTC
Try the patch I'll attach in a sec.
Comment 2 Jeff Trawick 2004-05-06 19:19:04 UTC
Created attachment 11450 [details]
run piped loggers via shell
Comment 3 Russell Miller 2004-05-06 19:28:08 UTC
Thanks.  I will try this and get back to you when I have results. 
 
--Russell 
Comment 4 Joe Orton 2004-06-03 22:04:54 UTC
*** Bug 16391 has been marked as a duplicate of this bug. ***
Comment 5 Jeff Trawick 2004-06-23 12:44:11 UTC
This is now resolved in httpd 2.1-dev.

There are two issues w.r.t. putting the fix in 2.0.next:

(a) there are some NetWare problems to resolve with changing the way
    piped loggers are invoked (actively being worked on)
(b) a new feature was added to APR to allow both
    i. starting piped loggers via the shell (fixing one 1.3 regression)
    ii. passing same environment variables to piped loggers (fixing another
        regression)
    we'll have to work out how to use the new APR feature when available and
    not use the new feature otherwise, as there is a desire to make
    Apache httpd 2.0.new work with the latest official APR 0.9.x release,
    not just the level of APR bundled with Apache httpd; maybe a new APR
    0.9.x release will be distributed before we reach this point

In the meantime, keep using the patch posted here.
Comment 6 Joe Orton 2006-10-03 11:59:28 UTC
Marking fixed since this feature is available in 2.2.x releases now.