httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <>
Subject RE: PR3715 NT piped TransferLog bug (was logged, guess I didn't need to)
Date Fri, 04 Feb 2000 05:42:45 GMT
Any NT advocate here to help a newbie contributor???


  PR #3715 Can't pipe TransferLog (in Win32)

  In fact, cannot pipe TransferLog, CustomLog or ErrorLog.


  The path to the shell is required by spawnl (as it is by Unix as well).
The SHELL_PATH value of "CMD.EXE" is insufficient.  The full path and file
spec of the Win32 machine's shell path is retrieved by getenv("COMSPEC").
This returns "C:\WinNT\System32\CMD.EXE" or "C:\Windows\Command\COMMAND.COM"
as configured.  If the admin has mucked this up, it's their own problem.


  Attached fix is relative to CVS 1.83 (included CSS patch!)

  The fixups of piped_log_child() and error_log_child() in http_log.c are
required, as I proposed last night.  I changed just the 'if (!shellcmd)'
result to do something (rather than nothing) - even though it is unlikely to
help the admin at that point.  Nothing more is required - I tested the
solution below in an NT4 SP4 VC5 build.

  The other notes about rotatelogs.c below are easy to implement.

  I am not proposing a fix to piped_log_spawn() (not pulled into the Win32
build).  For that behavior, the async fork emulation is best saved for the
2.0 release.

  This is a platform specific fix (not a change to the global codebase) - so
I am wondering if someone could be so kind as to submit it and close PR3715.
Feedback to the original post would be appreciated as well.

  Also - While you are at it, close PR3741 'custom install does not set up
conf directory'.  The start/stop apache icons in 1.3.11 work quite nicely,
thank you!

  As for PR1643 'making the server console hideable' and PR3594 'Please add
an Apache icon to the systray instead of a DOS window' I will look at the
requests (they are really related, with the later being more of an external
app staring at the hidden console window.)  I will look at PR 2208 'Is there
anyway to get Apache to work as a Windows 95 service' but I don't expect to
report much <g>.


note - the fix below is depreciated - rather than return(-1) for missing
COMSPEC, my proposed diff takes SHELL_PATH, not that it will do much good

> Question of coding practice after forcing rotatelogs.c to work on NT:
> my fixup of http_log.c for both piped_log_child() and error_log_child():
> {
> ...
> #if defined(WIN32)
>     char *shellcmd;
> #endif
> ...
> #elif defined(WIN32)
>     shellcmd = getenv("COMSPEC");
>     if (!shellcmd)
>         shellcmd = "C:\COMMAND.COM";
>     child_pid = spawnl(_P_NOWAIT, shellcmd, shellcmd, "/c", (char *)cmd,
> ...
> samewise fixup perhaps is needed in piped_log_spawn(), etc (though
> not where we have recoded with the CreateProcess fixup, wonder if
> 1/2 that issue wasn't the lack of path info)...
> this fixup is perhaps ugly, but resolves CMD.EXE vs. COMMAND.COM and
> other discrepancies in Win32.
> There must be a 'more proper' way of maintaining the
> necessity of a dynamic
> command shell value vs. the static Unix macro to "/bin/sh".
> 1) Would an ap_shell_path() to a char* be acceptable?  As far
> as I can tell,
> SHELL_PATH is used infrequently so it might be overkill.
> 2) Is the getenv() acceptable for host environment access, or
> could you
> point me at an internal cache of the environment that is more
> appropriate?
> 3) What about wrapping the entire junk in an
> ap_spawn_shell(arg0, [arg1,
> [,...]] NULL) wrapper?

> Oh, I came across this issue in rotatelogs.c as well; can we strike
> #define MAX_PATH	1024
> and replace with _MAX_PATH in the char buf2[MAX_PATH] declaration?
> (Everyone has _MAX_PATH, right???  At least I tracked one down in msvc
> stdlib.h, which is not so standard, I know <g>.  If not, some
> define in
> ap_config.h et. al. would be good.)  The only other compiler
> warning came
> from no return(0); close (not that it returns <g>).

>> That reminds me (thanks) that if we get rotatelogs.exe functioning under
>> NT - the config notes MUST state that blanks in names (or quoted names)
>> NOT work - they must use the tilde'd (8.3) equiv for the path and file
>> (not too much of a hardship - it's the admin we are talking about, not
>> html author or user!)

>> (ie. C:\Progra~1\Apache~1\Apache\logs\logfilenamemaybelongjustnospaces)

>> It would be nice to throw an .exe of rotatelogs at them, since most won't
>> have a compiler (some days that wintel world seems just kinda nuts).

> I'm more than happy to submit a diff'd fixup, if someone
> would first comment
> on my 3 Q's.  Any suggestions on a diff for WinNT?

View raw message