[Bug 723724] New: Samba initscript always returns success message on start (even on failure)
https://bugzilla.novell.com/show_bug.cgi?id=723724 https://bugzilla.novell.com/show_bug.cgi?id=723724#c0 Summary: Samba initscript always returns success message on start (even on failure) Classification: openSUSE Product: openSUSE 12.1 Version: Factory Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Samba AssignedTo: samba-maintainers@SuSE.de ReportedBy: suse-beta@cboltz.de QAContact: samba-maintainers@SuSE.de Found By: --- Blocker: --- While reading the samba initscript (/etc/init.d/smb) I noticed that it will always return a green "done" success message on "start", even if startproc fails. This is caused by the "unset" command between startproc and rc_status which resets $? to 0 (success). Here is the relevant part of the script: case "$1" in start) echo -n "Starting Samba SMB daemon " [...] export LC_ALL="$RC_LC_ALL" export LC_CTYPE="$RC_LC_CTYPE" export LANG="$RC_LANG" startproc -p ${PID_FILE} -W ${PID_FILE} ${SMBD_BIN} -D -s ${SMB_CONF} unset LC_ALL LC_CTYPE LANG # <---- resets $? to 0 (success) rc_status -v ;; The easiest solution is to remove the "unset LC_ALL LC_CTYPE LANG" command, but please check if this causes any side effects before doing it - there might be a reason why unset is called. OTOH the only commands/functions executed after the unset are - rc_status, which prints "done" or "failed" (without any translation) - rc_exit, which is basically a wrapper for "exit" Both functions are defined in /etc/rc.status. My understanding is that removing the unset command will not change anything except fixing this bug ;-) Another option would be something like LC_ALL="$RC_LC_ALL" LC_CTYPE="$RC_LC_CTYPE" LANG="$RC_LANG" startproc [...] This avoids the need for the unset command and still hands over the wanted variables to startproc. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723724
https://bugzilla.novell.com/show_bug.cgi?id=723724#c1
David Disseldorp
While reading the samba initscript (/etc/init.d/smb) I noticed that it will always return a green "done" success message on "start", even if startproc fails.
This is caused by the "unset" command between startproc and rc_status which resets $? to 0 (success).
..
My understanding is that removing the unset command will not change anything except fixing this bug ;-)
Agreed, but to keep it consistent we can just move the unset down one line. rc_status() will then output and retain the smbd exit status for return with rc_exit(). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723724
https://bugzilla.novell.com/show_bug.cgi?id=723724#c2
David Disseldorp
https://bugzilla.novell.com/show_bug.cgi?id=723724
https://bugzilla.novell.com/show_bug.cgi?id=723724#c3
--- Comment #3 from Bernhard Wiedemann
participants (1)
-
bugzilla_noreply@novell.com