Ticket #719 (closed defect: fixed)

Opened 14 years ago

Last modified 13 years ago

Passing invalid arguments to printing-config wrappers causes traceback

Reported by: jdreed Owned by:
Priority: normal Milestone: Natty Beta
Component: -- Keywords:
Cc: Fixed in version:
Upstream bug:

Description

(See sipb,lprm,* from 16:38 on Tuesday for context)

If I pass an invalid argument (say, "-u", which CUPS and LPRng have never supported), I get a traceback as shown below. I should get a usage argument instead. I suspect this is probably as simple as putting parse_args in a try block, but testing is required.

jdreed@INFINITE-LOOP:~$ lprm -Pmark-the-great -u foo
Traceback (most recent call last):
  File "/usr/bin/lprm", line 9, in <module>
    load_entry_point('debathena.printing==1.23.2-ubuntu10.04', 'console_scripts', 'lprm.debathena')()
  File "/usr/lib/pymodules/python2.6/debathena/printing/lprm.py", line 29, in main
    sys.exit(_main(sys.argv)) # pragma: nocover
  File "/usr/lib/pymodules/python2.6/debathena/printing/lprm.py", line 25, in _main
    return simple.simple('lprm', opts, queue_opt, args)
  File "/usr/lib/pymodules/python2.6/debathena/printing/simple.py", line 22, in simple
    argstyle, options, arguments = common.parse_args(args, optinfo)
TypeError: 'NoneType' object is not iterable

Change History

comment:1 Changed 13 years ago by jdreed

  • Priority changed from low to normal
  • Milestone changed from IAP 2011 to Natty Alpha

While LPROPT is a common cause of this, the fact is, a command should not give a traceback on a syntax error.

comment:2 Changed 13 years ago by kaduk

It should also tell you what piece of input it thought was a syntax error.

comment:3 Changed 13 years ago by jdreed

  • Status changed from new to committed

Fixed stupidly in r25135. Telling us exactly what piece of input it barfed on is hard, because of the way parse_args works. This will be easier once we can stop honoring lprng queues.

comment:4 Changed 13 years ago by jdreed

  • Status changed from committed to development

ACK'd, built and uploaded in printing-config 1.23.3

comment:5 Changed 13 years ago by geofft

I'm not sure I believe this?

w20-575-2:~ geofft$ lpr -o sides=two-sided-long-edge -Zduplex
Traceback (most recent call last):
  File "/usr/bin/lpr", line 9, in <module>
    load_entry_point('debathena.printing==1.23.3-ubuntu10.04', 'console_scripts', 'lpr.debathena')()
  File "/usr/lib/pymodules/python2.6/debathena/printing/lpr.py", line 123, in main
    sys.exit(_main(sys.argv)) # pragma: nocover
  File "/usr/lib/pymodules/python2.6/debathena/printing/lpr.py", line 73, in _main
    argstyle, options, arguments = common.parse_args(args, optinfos)
TypeError: 'NoneType' object is not iterable

I think you need to make this change in more than just simple.py.

comment:6 Changed 13 years ago by jdreed

  • Status changed from development to committed

lpq and lpr call common.parse_args twice, first to get the queue. Sigh. Fixed in r25172.

comment:7 Changed 13 years ago by jdreed

  • Status changed from committed to development

TTL expired. 1.23.4 to -dev (+r25228)

comment:8 Changed 13 years ago by jdreed

  • Status changed from development to proposed

comment:9 Changed 13 years ago by jdreed

  • Status changed from proposed to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.