--version vs. -v weirdness

Get help with all aspects of 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: 948
Joined: February 7th, 2008, 12:45 pm

--version vs. -v weirdness

Post by jcfp »

I'll just let the facts speak for themselves. The following 100% reproducible issue is observed with both 0.3.0 and 0.3.1rc1, python source release, on Ubuntu Gutsy/7.10:

[[email protected]] /tmp/SABnzbd-0.3.1rc1
$ ./SABnzbd.py -v
SABnzbd.py-0.3.1rc1
[[email protected]] /tmp/SABnzbd-0.3.1rc1
$ ./SABnzbd.py --version

Usage: SABnzbd.py [-f ]

Options marked are stored in the config file

Options:
  -f  --config-file   Location of config file
  -s  --server   Listen on server:port
  -t  --templates   Template directory

  -l  --logging     Set logging level (0= least, 2= most)
  -w  --weblogging   Set cherrypy logging (0= off, 1= on)

  -b  --browser     Auto browser launch (0= off, 1= on)
  -d  --daemon            Fork daemon process
      --permissions        Set the chmod mode (e.g. o=rwx,g=rwx)

      --force              Discard web-port timeout (see Wiki!)
  -h  --help              Print this message
  -v  --version            Print version information
  -c  --clean              Remove queue, cache and logs
  -p  --pause              Start in paused mode
(all occurences of [ * ] were removed from above output because they interfered with the forum layout)

That last output is the --help reply (that one also gets when using any random --foobar), even though it really is being asked for --version. Looking at the source code in SABnzbd.py, I can't find anything strange in the handling of the command line argument, so I'm hesitant to file this as a bug. The following is around line 316, and looks perfectly sane to me:

        if o in ('-v', '--version'):
            print_version()
            ExitSab(0)
I checked with another user who confirmed seeing this too. The program works perfectly fine otherwise, including other long options that I tested like --daemon. Ideas?

User avatar
shypike
Administrator
Administrator
Posts: 21043
Joined: January 18th, 2008, 12:49 pm

Re: --version vs. -v weirdness

Post by shypike »

It's not so weird if you look at this code:

    opts, args = getopt.getopt(sys.argv[1:], "phdvncu:w:l:s:f:t:b:",
                      ['pause', 'help', 'daemon', 'nobrowser', 'clean', 'logging=', \
                      'weblogging=', 'umask=', 'server=', 'templates', 'permissions=', \
                      'browser=', 'config-file=', 'delay=', 'force'])

Here --version is missing from the long option list.

Will be repaired in 0.3.1 Final (along with the last bits of licensing trouble).

Thanks for your patience  ;)

Post Reply