ModelData.__getitem__() does not check self.released_dat existence prior to reading it

Bug #1174736 reported by Jiri Popelka
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
HPLIP
New
Undecided
Unassigned
hplip (Fedora)
Won't Fix
Undecided

Bug Description

hplip-3.13.3
Traceback (most recent call last):
  File "/bin/hp-setup", line 318, in <module>
    device_uri, sane_uri, fax_uri = device.makeURI(param, jd_port)
  File "/usr/share/hplip/base/device.py", line 404, in makeURI
    mq = queryModelByURI(cups_uri)
  File "/usr/share/hplip/base/device.py", line 445, in queryModelByURI
    return queryModelByModel(model)
  File "/usr/share/hplip/base/device.py", line 434, in queryModelByModel
    return model_dat[model]
  File "/usr/share/hplip/base/models.py", line 514, in __getitem__
    if self.read_section(self.released_dat, model):
  File "/usr/share/hplip/base/models.py", line 424, in read_section
    fd = file(filename)
TypeError: coercing to Unicode: need string or buffer, NoneType found

Local variables in innermost frame:
in_section: False
is_include: False
section: 'hp_laserjet_professional_m1212nf_mfp'
cache: {}
filename: None
found: False
self: <base.models.ModelData instance at 0x145c638>

Revision history for this message
In , Michael (michael-redhat-bugs) wrote :

Version-Release number of selected component:
hplip-3.13.3-2.fc18

Additional info:
cmdline: /usr/bin/python /bin/hp-setup 192.168.178.21
executable: /bin/hp-setup
kernel: 3.8.8-203.fc18.x86_64
uid: 1000
ureports_counter: 1

Truncated backtrace:
models.py:424:read_section:TypeError: coercing to Unicode: need string or buffer, NoneType found

Traceback (most recent call last):
  File "/bin/hp-setup", line 318, in <module>
    device_uri, sane_uri, fax_uri = device.makeURI(param, jd_port)
  File "/usr/share/hplip/base/device.py", line 404, in makeURI
    mq = queryModelByURI(cups_uri)
  File "/usr/share/hplip/base/device.py", line 445, in queryModelByURI
    return queryModelByModel(model)
  File "/usr/share/hplip/base/device.py", line 434, in queryModelByModel
    return model_dat[model]
  File "/usr/share/hplip/base/models.py", line 514, in __getitem__
    if self.read_section(self.released_dat, model):
  File "/usr/share/hplip/base/models.py", line 424, in read_section
    fd = file(filename)
TypeError: coercing to Unicode: need string or buffer, NoneType found

Local variables in innermost frame:
in_section: False
is_include: False
section: 'hp_laserjet_professional_m1212nf_mfp'
cache: {}
filename: None
found: False
self: <base.models.ModelData instance at 0x145c638>

Revision history for this message
In , Michael (michael-redhat-bugs) wrote :

Created attachment 740738
File: backtrace

Revision history for this message
In , Michael (michael-redhat-bugs) wrote :

Created attachment 740739
File: core_backtrace

Revision history for this message
In , Michael (michael-redhat-bugs) wrote :

Created attachment 740740
File: environ

Revision history for this message
In , Michael (michael-redhat-bugs) wrote :

Created attachment 740741
File: smolt_data

Revision history for this message
Jiri Popelka (jpopelka) wrote :
Revision history for this message
In , Jiri (jiri-redhat-bugs) wrote :
Revision history for this message
Amarnath Chitumalla (amarnath-chitumalla) wrote :

Hi Jiri,

Thanks for providing the patch.

This issue happens when models.dat file is not present, and models.dat file needs to be present under "/usr/share/hplip/data/models/models.dat". Can you provide some more information analysis this issue.

1) file status /usr/share/hplip/data/models/models.dat

  $ ls -l /usr/share/hplip/data/models/models.dat
  Note:- if HPLIP home directory is /usr/local/share, change to /usr/local/share/hplip/data/models/models.dat

2) output of hp-check command
   $ hp-check

3) output of the hp-setup command
   $ hp-setup -g

Thanks & Regards,
Amarnath

Revision history for this message
In , Jiri (jiri-redhat-bugs) wrote :

Michael,

upstream asks for more information.
https://bugs.launchpad.net/hplip/+bug/1174736
Could you provide it there ?

Revision history for this message
Michael H (sojasau) wrote :
Download full text (10.1 KiB)

Hi,
this issue is originally detected by me. So here is the output:

ls -l /usr/share/hplip/data/models/models.dat
-rw-r--r-- 1 root root 965391 15. Mär 12:34 /usr/share/hplip/data/models/models.dat

hp-check
zsh: command not found: hp-check

hp-doctor
Traceback (most recent call last):
  File "/bin/hp-doctor", line 39, in <module>
    from check import DependenciesCheck
ImportError: No module named check

hp-setup -g -i

HP Linux Imaging and Printing System (ver. 3.13.3)
Printer/Fax Setup Utility ver. 9.0

Copyright (c) 2001-13 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

hp-setup[1915]: debug: param=
hp-setup[1915]: debug: selected_device_name=None
(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)

--------------------------------
| SELECT CONNECTION (I/O) TYPE |
--------------------------------

  Num Connection Description
            Type
  -------- ---------- ----------------------------------------------------------
  0* usb Universal Serial Bus (USB)
  1 net Network/Ethernet/Wireless (direct connection or JetDirect)
  2 par Parallel Port (LPT:)

Enter number 0...2 for connection type (q=quit, enter=usb*) ? 1

Using connection type: net

hp-setup[1915]: debug:
DEVICE CHOOSER setup_fax=True, setup_print=True
hp-setup[1915]: debug: Probing bus: net
hp-setup[1915]: debug: Outgoing: (44)
hp-setup[1915]: debug: 0000: 00 00 00 00 00 01 00 00 00 00 00 00 0f 5f 70 64 ............._pd
hp-setup[1915]: debug: 0010: 6c 2d 64 61 74 61 73 74 72 65 61 6d 04 5f 74 63 l-datastream._tc
hp-setup[1915]: debug: 0020: 70 05 6c 6f 63 61 6c 00 00 0c 00 01 p.local.....
hp-setup[1915]: debug: Outgoing: (44)
hp-setup[1915]: debug: 0000: 00 00 00 00 00 01 00 00 00 00 00 00 0f 5f 70 64 ............._pd
hp-setup[1915]: debug: 0010: 6c 2d 64 61 74 61 73 74 72 65 61 6d 04 5f 74 63 l-datastream._tc
hp-setup[1915]: debug: 0020: 70 05 6c 6f 63 61 6c 00 00 0c 00 01 p.local.....
hp-setup[1915]: debug: Outgoing: (44)
hp-setup[1915]: debug: 0000: 00 00 00 00 00 01 00 00 00 00 00 00 0f 5f 70 64 ............._pd
hp-setup[1915]: debug: 0010: 6c 2d 64 61 74 61 73 74 72 65 61 6d 04 5f 74 63 l-datastream._tc
hp-setup[1915]: debug: 0020: 70 05 6c 6f 63 61 6c 00 00 0c 00 01 p.local.....
hp-setup[1915]: debug: Outgoing: (44)
hp-setup[1915]: debug: 0000: 00 00 00 00 00 01 00 00 00 00 00 00 0f 5f 70 64 ............._pd
hp-setup[1915]: debug: 0010: 6c 2d 64 61 74 61 73 74 72 65 61 6d 04 5f 74 63 l-datastream._tc
hp-setup[1915]: debug: 0020: 70 05 6c 6f 63 61 6c 00 00 0c 00 01 p.local.....
hp-setup[1915]: debug: Found 0 devices
hp-setup[1915]: debug: getDeviceUri(None, None, ('hp',), None, , True)
hp-setup[1915]: debug: Mode=0
error: No device selected/specified or that sup...

Revision history for this message
Amarnath Chitumalla (amarnath-chitumalla) wrote :

Hi Michael,

Same error is not observed from the above logs.
---------------
File "/usr/share/hplip/base/models.py", line 424, in read_section
    fd = file(filename)
TypeError: coercing to Unicode: need string or buffer, NoneType found

Local variables in innermost frame:
in_section: False
is_include: False
section: 'hp_laserjet_professional_m1212nf_mfp'
cache: {}
filename: None
found: False
self: <base.models.ModelData instance at 0x145c638>
---------------------------------------------------------------

However, hp-check is failing. Seems like HPLIP package might not be installed properly, please install latest HPLIP from
http://hplipopensource.com/hplip-web/install.html

Thanks & Regards,
Amarnath

Revision history for this message
In , Jaromír (jaromr-redhat-bugs) wrote :

*** Bug 1002440 has been marked as a duplicate of this bug. ***

Changed in hplip (Fedora):
importance: Unknown → Undecided
status: Unknown → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.