Page 1 of 1

--version vs. -v weirdness

Posted: February 11th, 2008, 7:38 pm
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:

[jcfp@asterion] /tmp/SABnzbd-0.3.1rc1
$ ./SABnzbd.py -v
SABnzbd.py-0.3.1rc1
[jcfp@asterion] /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?

Re: --version vs. -v weirdness

Posted: February 12th, 2008, 10:33 am
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  ;)