On Sat, Sep 03, 2005 at 05:22:12PM -0400, Tom Metro wrote:
> Paul Martin wrote:
> >They did fix it for the shared scripts, but not for the single file 
> >case.
> >
> >I've written a patch to fix this, and it will be in 3.7.1-3.
> 
> Ah, thanks.

Actually, that's 3.7.1-2. I'd forgotten that it was a work-in-progress, 
and mentally bumped the revision number.

> >Difficult to fix that one, as that depends on the behaviour of the mail 
> >program.
> 
> Difficult (or ugly), yes, but it doesn't depend on what is being executed.
> 
> The classic approach would be to redirect output from the child 
> processes to a temp file, and then after the process exits, if the file 
> is non-zero, wrap it in context information before copying the contents 
> to STDERR and/or STDOUT. The cron code base probably has an 
> implementation of this.

We're trying to avoid tempfiles at the moment. One of the recent patches 
was to remove the use of tempfiles completely.

> If we presume logrotate now consistently provides context information if 
> a child process has a non-zero exit code, then the following POSIX shell 
> wrapper will trigger logrotate to provide that context.
> 
> TMPOUT=$TMP/lr$$ ; child > $TMPOUT 2>&1 ; EC=$? ; \
> [ ! -s $TMPOUT ] ; OUT=$? ; cat $TMPOUT; rm $TMPOUT ; \
> if [ $EC -gt 0 ]; then exit $EC; else exit $OUT; fi
> 
> where 'child' is the child command logrotate wants to run, and TMPOUT is 
> set appropriately to some process unique temporary file.

This is rather complex. How logrotate runs scripts at the moment is to 
pack them into a string which is then fed as an argument to "/bin/sh 
-c".

You're also assuming that stderr and stdout get handled identically.

This particular bug has been closed as the original problem has been 
solved. If you want to continue this in a new wishlist bug, feel free to 
do so.

-- 
Paul Martin <[EMAIL PROTECTED]>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to