Bug 5820 - traceback in thinlocal when option lacks a value
Summary: traceback in thinlocal when option lacks a value
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Printing (show other bugs)
Version: pre-1.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.6.0
Assignee: Pierre Ossman
URL:
Keywords: hean01_tester, prosaic
Depends on:
Blocks:
 
Reported: 2016-03-17 14:56 CET by Pierre Ossman
Modified: 2016-04-01 17:42 CEST (History)
2 users (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2016-03-17 14:56:54 CET
Most printer job options have an associated value, but not all. A lack of value should be interpreted as a boolean with a value of true. Our parser however explodes when this happens:

> Mar 17 14:51:02 dhcp-254-99.lkpg.cendio.se cupsd[1856]: argv[5]="InputSlot=Default PageSize=A4 noCollate Duplex=None Resolution=300dpi number-up=1 job-uuid=urn:uuid:b16ff36e-a989-3a1f-7cd9-c8bdbd0958d9 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1458222180 time-at-processing=1458222662"
> ...
> Mar 17 14:51:03 dhcp-254-99.lkpg.cendio.se cupsd[1856]: Traceback (most recent call last):
> Mar 17 14:51:03 dhcp-254-99.lkpg.cendio.se cupsd[1856]: File \"/usr/lib/cups/backend/thinlocal\", line 173, in <module>
> Mar 17 14:51:03 dhcp-254-99.lkpg.cendio.se cupsd[1856]: sys . exit ( Iiii111Ii11I1 ( ) )
> Mar 17 14:51:03 dhcp-254-99.lkpg.cendio.se cupsd[1856]: File \"/usr/lib/cups/backend/thinlocal\", line 38, in Iiii111Ii11I1
> Mar 17 14:51:03 dhcp-254-99.lkpg.cendio.se cupsd[1856]: I11 = dict ( nv . split ( \"=\" ) for nv in sys . argv [ CUPS_ARGUMENT_OPTIONS ] . split ( \" \" ) )
> Mar 17 14:51:03 dhcp-254-99.lkpg.cendio.se cupsd[1856]: ValueError: dictionary update sequence element #2 has length 1; 2 is required
> Mar 17 14:51:03 dhcp-254-99.lkpg.cendio.se cupsd[1856]: PID 2532 (/usr/lib/cups/backend/thinlocal) stopped with status 1.
> Mar 17 14:51:03 dhcp-254-99.lkpg.cendio.se cupsd[1856]: Backend returned status 1 (failed)
Comment 2 Henrik Andersson cendio 2016-03-18 12:06:51 CET
It does feel wrong that we in out backend interprets all options without values as booleans. Also if we want to pass those options on to the client side we probably want to pass as is without interfering with what default means.
 
Suggestion is to set those to None and when we in the backend needs to use them, apply logic for what default value to use based on datatype.
Comment 3 Henrik Andersson cendio 2016-03-18 12:07:49 CET
(In reply to comment #2)
> It does feel wrong that we in out backend interprets all options without values
> as booleans. Also if we want to pass those options on to the client side we
> probably want to pass as is without interfering with what default means.
> 
> Suggestion is to set those to None and when we in the backend needs to use
> them, apply logic for what default value to use based on datatype.

For example the option date-time-at-processing is an integer timestamp and should probably not default to true value.
Comment 6 Henrik Andersson cendio 2016-03-23 10:43:32 CET
Tested without and with the change. Works as expected.

Note You need to log in before you can comment on or make changes to this bug.