Subject: Re: /etc/daily fubar if daily.local changes FWD
To: Hubert Feyrer <hubert@feyrer.de>
From: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
List: tech-userlevel
Date: 12/14/2006 09:37:04
Hi,
On Tue, Dec 12, 2006 at 02:12:31AM +0100, Hubert Feyrer wrote:
> trying to do some filtering with /var/log/messages, I've found that
> /etc/daily breaks if /etc/daily.local changes the current working
> directory. Paraphrasing /etc/daily:
>
> line1: cd $somedir
> line2: TMP=relative_path
> line3: . /etc/daily.local >$TMP
> line4: if [ -s $TMP ]; then ...
>
> In the above example, line3 creates creates $somedir/relative_path,
> but if daily.local uses 'cd' to change the current working directory, the
> if-test in line4 will fail.
>
> To solve this, I suggest running daily.local in a subshell:
>
> ( . /etc/daily.local ) >$TMP 2>&1
>
> Does that make sense? Do I miss something substantial here?
> Any comments about (not) committing the patch below?
What happens to non-exported variables in ( ) - sub-shells? Do we have
any in /etc/daily{,.conf} that a daily.local would want to use?
Regards,
-is