Return value zero when aborting startup

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Return value zero when aborting startup

Post by jcfp »

The program exits with a return value of zero despite hitting a serious problem with the log dir setting causing it to abort startup. As a result, an init script or any other program trying to start the program as a daemon will wrongly indicate a successful startup.

Offending code is here (from SABnzbd.py):

Code: Select all

    if fork and not my_logdir:
        print "Error:"
        print "I refuse to fork without a log directory!"
        sys.exit()
Should be trivial to fix.
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Return value zero when aborting startup

Post by switch »

Filed as ticket #216. Would it be useful to return an error message in the exit return code as to why sabnzbd needed to quit? (But still just 0 on a planned exit).
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Return value zero when aborting startup

Post by jcfp »

switch wrote: Filed as ticket #216. Would it be useful to return an error message in the exit return code as to why sabnzbd needed to quit? (But still just 0 on a planned exit).
Thanks. The main issue is to be able to determine that this exit is not what the user intended and expected (i.e. a successful program start), thus the exit status should always be non-zero irrespective of the mode of failure. This specific condition with the log dir when forking is the only example I know of where the program doesn't do that. See jrebeiro's posts on the ubuntu repository thread for the background of this bug report.

As for passing the error message as part of the actual exit (rather than printing it separately as is): only useful for consistency if that's the way it's done all over sabnzbd already, for init scripts etc all that really matters to distinguish success from failure is the return value.
Post Reply