morituri icon indicating copy to clipboard operation
morituri copied to clipboard

Crash if no path specified for '-O' option

Open Hawke opened this issue 12 years ago • 6 comments

According to the help output: -O OUTPUT_DIRECTORY, --output-directory=OUTPUT_DIRECTORY output directory; will be included in file paths in result files (defaults to absolute path to current directory; set to empty if you want paths to be relative instead)

However, 'rip cd rip -O' will crash: File "…morituri/morituri/extern/command/command.py", line 114, in parse_args return optparse.OptionParser.parse_args(self, args, values) File "/usr/lib/python2.7/optparse.py", line 1399, in parse_args stop = self._process_args(largs, rargs, values) File "/usr/lib/python2.7/optparse.py", line 1443, in _process_args self._process_short_opts(rargs, values) File "/usr/lib/python2.7/optparse.py", line 1550, in _process_short_opts option.process(opt, value, values, self) UnboundLocalError: local variable 'value' referenced before assignment

You need to explicitly specify the value as "" or something before it will work. It would be better if this were not necessary.

Hawke avatar Feb 27 '13 16:02 Hawke

The bug really is in optparse. I'll see if I can work around it. The argument is not optional, so if explicitly you want relative paths, you need to set it to an empty value using ""

thomasvs avatar Jul 14 '13 07:07 thomasvs

Still crashes for me in current git…

Hawke avatar Jul 30 '13 15:07 Hawke

Works here: $ rip cd rip -O Usage: rip cd rip

rip: error: -O option requires an argument

what is your actual command line and what is the traceback?

thomasvs avatar Jul 30 '13 17:07 thomasvs

$ rip cd rip -O Usage: rip cd rip

rip: error: -O option requires an argument Traceback (most recent call last): File "/home/$USER/Documents/Source/git/morituri/bin/rip", line 39, in sys.exit(main.main(sys.argv[1:])) File "/home/$USER/Documents/Source/git/morituri/morituri/rip/main.py", line 45, in main ret = c.parse(argv) File "/home/$USER/Documents/Source/git/morituri/morituri/rip/main.py", line 123, in parse logcommand.LogCommand.parse(self, argv) File "/home/$USER/Documents/Source/git/morituri/morituri/extern/command/command.py", line 385, in parse return self.subCommands[command].parse(args[1:]) File "/home/$USER/Documents/Source/git/morituri/morituri/extern/command/command.py", line 385, in parse return self.subCommands[command].parse(args[1:]) File "/home/$USER/Documents/Source/git/morituri/morituri/extern/command/command.py", line 299, in parse self.options, args = self.parser.parse_args(argv) File "/home/$USER/Documents/Source/git/morituri/morituri/extern/command/command.py", line 114, in parse_args return optparse.OptionParser.parse_args(self, args, values) File "/usr/lib/python2.7/optparse.py", line 1399, in parse_args stop = self._process_args(largs, rargs, values) File "/usr/lib/python2.7/optparse.py", line 1443, in _process_args self._process_short_opts(rargs, values) File "/usr/lib/python2.7/optparse.py", line 1550, in _process_short_opts option.process(opt, value, values, self) UnboundLocalError: local variable 'value' referenced before assignment

Hawke avatar Jul 30 '13 18:07 Hawke

I don't see how this can be happening. Can you rerun the same command, with RIP_DEBUG=5 this time? Please make sure you run latest git master.

thomasvs avatar Aug 23 '13 23:08 thomasvs

I can't reproduce the issue. Are you still getting this @Hawke?

Freso avatar Jul 03 '14 13:07 Freso