Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 191647

Summary: net-fs/samba-3.0.25c init script doesn't work
Product: Gentoo Linux Reporter: Napoleon <napoleonb>
Component: New packagesAssignee: Gentoo's SAMBA Team <samba>
Status: RESOLVED FIXED    
Severity: normal CC: kristov, marek.bartosiewicz, nbensa, tomasz.chilinski
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Napoleon 2007-09-08 02:05:00 UTC
I just updated Samba from 3.0.24-r3 to 3.0.25c. After doing etc-update, I tried to restart Samba (/etc/init.d/samba restart) and nothing happened. I then tried stop, and start and nothing happened with any one of those two commands (no message, no [ok] or [!!]). Old processes (smbd and nmbd) were still running so I killed them manually. I can start both of the services manually by doing smbd -D and nmbd -D.

Reproducible: Always
Comment 1 Tomasz Chilinski 2007-09-08 07:09:53 UTC
Try to change code snippet in /etc/init.d/samba:
if [[ -n ${DAEMONNAME} ]] ; then
        daemon_list=${DAEMONNAME}
fi
to:
if [[ -z ${DAEMONNAME} ]] ; then
        daemon_list=${DAEMONNAME}
fi

Should resolve problem.

Bests, Tom.
Comment 2 Christoph Schulz 2007-09-08 09:20:22 UTC
Hello Tomasz,

you are right that your suggestion fixes the problem. However, it is not the right thing to do. As I understand it, the purpose of the code

DAEMONNAME="${SVCNAME##samba.}"
if [[ -n ${DAEMONNAME} ]] ; then
        daemon_list=${DAEMONNAME}
fi

is to determine if someone wants a specific service to be stopped/started/whatever, i.e., if you link /etc/init.d/samba.smbd --> /etc/init.d/samba and then you call "/etc/init.d/samba.smbd start", DAEMONNAME will be set to "smbd". As DAEMONNAME is not empty now, daemon_list is set to DAEMONNAME, ignoring the value inherited from /etc/conf.d/samba (which typically contains all samba services).

The problem is that DAEMONNAME is *not* empty if /etc/init.d/samba is called -- it is the string "samba" instead. So the expression [[ -n ${DAEMONNAME} ]] *always* evaluates to true (as "samba" is not an empty string), and daemon_list is *always* set to "samba". The result is that nothing happens when starting and stopping, as there are no "samba_start" or "samba_stop" variables set in /etc/conf.d/samba.

So in my opinion, the correct fix to the problem described would be to replace the expression
  [[ -n ${DAEMONNAME} ]]
by
  [[ ${DAEMONNAME} != "samba" ]]

(By the way, this works for me!)

Perhaps there is a possibility to change the bash expression "${SVCNAME##samba.}" such that the result is empty if "samba." is not found as prefix (instead of being the string "samba"), but a quick look into bash's man page did not reveal a solution. However, I'm not a bash expert.

Regards,
  Christoph
Comment 3 Tiziano Müller (RETIRED) gentoo-dev 2007-09-08 12:06:53 UTC
sorry, missed that one.
Fixed in CVS.