[CentOS] Odd failure of smbd to start from init.d - CentOS 5.4

Tue May 25 23:11:49 UTC 2010
Whit Blauvelt <whit at transpect.com>

Hi Brian,

I've been all over the environment comparisons before, I think. The question
currently is:

What can be the difference between 

"/home/smb restart" - which works, and
"/etc/init.d/smb restart" - which fails

when a diff between the two smb files shows no difference? 

This is with both of them run from the same (bash) root shell, by hand.
Those should have _exactly_ the same environments aside from the PWD envar,
right? - unless there's something magical about how init.d scripts run just
if they find themselves run from /etc/init.d rather than elsewhere. Maybe
there is.

The smb file sources /etc/init.d/functions, but I can't find anything there
that obviously cares whether the smb file sourcing it is run from
/etc/init.d. Am I missing something? Also sourced are /etc/sysconfig/samba -
which is the same in any case, and the same on working RH systems; and
/etc/sysconfig/network - which differs in machine name, and in that ipv6 is
set "on" for CentOS but not RH - but that shouldn't make a script care if
it's started from /etc/init.d or elsewhere. 

Best,
Whit

On Tue, May 25, 2010 at 06:24:43PM -0400, Brunner, Brian T. wrote:
> WTE?
> do
> printenv > dot.slash.env 
> add to /etc/init.d/smb
> printenv > ~/init.d.smb.env
> then execute /etc/init.d/smb
> 
> There has got to be a difference between the two environments causing
> identical scripts to behave differently depending on how they're
> executed.
> 
> unless
> 
> PATH searches . before other directories, *and* there is a file in
> /etc/init.d or ~ that causes different behavior.
> 
> (hint, make sure . is last in your PATH, if it's there at all.  Security
> breach can exploit a misplaced PATH . )