Subject: misc/33461: daily doesn't call daily.local in a subshell
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <jdwhite@menelos.com>
List: netbsd-bugs
Date: 05/10/2006 21:20:00
>Number:         33461
>Category:       misc
>Synopsis:       daily.local can modify daily's environment causing unintended consequences
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed May 10 21:20:00 +0000 2006
>Originator:     Jason White
>Release:        NetBSD 3.0
>Organization:
Jason White <jdwhite@menelos.com>       Jabber: jdwhite(jabber.org)
http://www.menelos.com/~jdwhite                 jason.d.white(gmail.com)
PGP KeyID: 0x5290E477
>Environment:
System: NetBSD bender.menelos.com 3.0 NetBSD 3.0 (BENDER) #0: Thu Feb 2 17:13:01 CST 2006 jdwhite@smeghead:/usr/obj/i386/BENDER i386
Architecture: i386
Machine: i386
>Description:
/etc/daily does not invoke /etc/daily.local in a subshell like it does for 
/etc/security.  /etc/daily.local can modify the environment that /etc/daily 
runs in, causing unintened consequences.  When /etc/daily.local is invoked, 
the current working directory is $DAILYDIR.  If the current working dir is 
modified and not set back to $DAILYDIR before returing to /etc/daily, then 
the check for output from /etc/daily.local will fail since it looks for $TMP 
in the current working directory.
>How-To-Repeat:
Use 'cd' commands in /etc/daily.local to modify the current working 
directory, but not change it back to $DAILYDIR before exiting. 
/etc/daily.local must produce some output to stdout/stderr, which gets 
redirected to $TMP like the following:

/etc/daily.local:
-----------------
echo This text should be included in the daily report.
cd /tmp

>Fix:
Invoke /etc/daily.local in a subshell with the following change to 
/etc/daily:

289c289
<       sh /etc/daily.local > $TMP 2>&1
---
>       . /etc/daily.local > $TMP 2>&1