Bug 846534 - hplip: hp-scan:636:<module>:IndexError: list index out of range
Summary: hplip: hp-scan:636:<module>:IndexError: list index out of range
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: hplip
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:1d53f44d111ef20829ed60a49de...
: 821707 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-08 05:09 UTC by Peter Bieringer
Modified: 2012-10-15 15:18 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 821707
Environment:
Last Closed: 2012-10-15 13:28:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1000299 0 None None None 2012-08-08 05:09:48 UTC

Description Peter Bieringer 2012-08-08 05:09:48 UTC
+++ This bug was initially created as a clone of Bug #821707 +++

abrt version: 2.0.3
architecture:   x86_64
cmdline:        
comment:        I ran hp-scan from cli. scanning using this method has worked for past 18 months. Since last update to hplip package this error occurs.
component:      hplip
executable:     /usr/bin/hp-scan
kernel:         2.6.43.2-6.fc15.x86_64
os_release:     Fedora release 15 (Lovelock)
package:        hplip-3.12.2-4.fc15
reason:         hp-scan:636:<module>:IndexError: list index out of range
time:           Tue May 15 12:46:22 2012
uid:            500
username:       samtuke

backtrace:      Text file, 22417 bytes

--- Additional comment from mail on 2012-05-15 07:48:42 EDT ---

Created attachment 584645 [details]
File: backtrace

--- Additional comment from jpopelka on 2012-05-15 09:01:08 EDT ---

Can you attach the output of running hp-scan ?

--- Additional comment from mail on 2012-05-15 11:14:43 EDT ---

Jiri:

$ hp-scan 
                                                                                                                                                                                                                                             
HP Linux Imaging and Printing System (ver. 3.12.2)                                                                                                                                                                                           
Scan Utility ver. 2.2

Copyright (c) 2001-9 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.


-----------------
| SELECT DEVICE |
-----------------

  Num       Scan device URI                                         
  --------  --------------------------------------------------------
  0         hpaio:/net/HP_LaserJet_M1522nf_MFP?ip=192.168.1.104     
  1         hpaio:/usb/Photosmart_C7200_series?serial=MY78UG32DJ04YG
  2         hpaio:/net/Photosmart_C7200_series?ip=192.168.1.86      

Enter number 0...2 for device (q=quit) ?0
warning: No destinations specified. Adding 'file' destination by default.
Using device hpaio:/net/HP_LaserJet_M1522nf_MFP?ip=192.168.1.104
Opening connection to device...
warning: Invalid resolution. Using closest valid resolution of 300 dpi
warning: Valid resolutions are  dpi.
Traceback (most recent call last):
  File "/usr/bin/hp-scan", line 636, in <module>
    res = valid_res[0]
IndexError: list index out of range

--- Additional comment from jpopelka on 2012-05-16 11:11:18 EDT ---

Seems that the SANE driver returns empty list of valid resolutions for your printer. If I compare 3.12.2 with 3.11.12 (previous stable update) I see that previously there were some resolutions hard-wired in the code.

diff -r hplip-3.11.12/scan/sane/soapht.c hplip-3.12.2/scan/sane/soapht.c
516,525c517
<    i=1;
<    session->resolutionList[i++] = 75;
<    session->resolutionList[i++] = 100;
<    session->resolutionList[i++] = 150;
<    session->resolutionList[i++] = 200;
<    session->resolutionList[i++] = 300;
<    session->resolutionList[i++] = 600;
<    //session->resolutionList[i++] = 1200;
<    session->resolutionList[0] = i-1;    /* length of word_list */
<    soapht_control_option(session, SOAP_OPTION_SCAN_RESOLUTION, SANE_ACTION_SET_AUTO, NULL, NULL); /* set default option */
---
>      soapht_control_option(session, SOAP_OPTION_SCAN_RESOLUTION, SANE_ACTION_SET_AUTO, NULL, NULL); /* set default option */

It's possible that your problem (SANE returning empty list of scan resolutions for your printer) was always there but the above mentioned change uncovered it.
As I have no idea where to start digging in the SANE driver I think it would be better to report this upstream.

--- Additional comment from jpopelka on 2012-05-16 11:33:50 EDT ---

Reported upstream as
https://bugs.launchpad.net/hplip/+bug/1000299

Sam, you'll probably need to supply some more info when asked.

--- Additional comment from jpopelka on 2012-05-17 06:20:37 EDT ---

So, we have a soapht.c source from upstream.
It's actually a 3.12.4 version with one small tweak on top of it.

I built 3.12.4 without [1] and with [2] this "tweak" and need you to test both of them.

First download all the .rpm files from [1] into separate directory,
go into that directory and update hplip with
su -c 'yum --nogpgcheck localupdate *.rpm'
Close hp-systray if running. Then run 'hp-scan' or 'xsane' to do scanning.
Then do the same with [2].

[1] http://koji.fedoraproject.org/koji/taskinfo?taskID=4083198
[2] http://koji.fedoraproject.org/koji/taskinfo?taskID=4083221

--- Additional comment from mail on 2012-05-17 09:35:36 EDT ---

Same problem with both; the output looks identical, just formatted a bit differently. I haven't done a diff, and I didn't restart the machine or cups or anything between the updates, but I followed the procedure exactly as you said.

Output with [1]:

$ hp-scan

HP Linux Imaging and Printing System (ver. 3.12.4)
Scan Utility ver. 2.2

Copyright (c) 2001-14 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.


-----------------
| SELECT DEVICE |
-----------------

  Num       Scan device URI                                         
  --------  --------------------------------------------------------
  0*        hpaio:/net/HP_LaserJet_M1522nf_MFP?ip=192.168.1.104     
  1         hpaio:/usb/Photosmart_C7200_series?serial=MY78UG32DJ04YG
  2         hpaio:/net/Photosmart_C7200_series?ip=192.168.1.86      

Enter number 0...2 for device (q=quit, <enter>=default: 0*) ?0
warning: No destinations specified. Adding 'file' destination by default.
Using device hpaio:/net/HP_LaserJet_M1522nf_MFP?ip=192.168.1.104
Opening connection to device...
warning: Invalid resolution. Using closest valid resolution of 300 dpi
warning: Valid resolutions are  dpi.
Traceback (most recent call last):
  File "/usr/bin/hp-scan", line 636, in <module>
    res = valid_res[0]
IndexError: list index out of range




Output with [2]:

$ hp-scan

HP Linux Imaging and Printing System (ver. 3.12.4)
Scan Utility ver. 2.2

Copyright (c) 2001-14 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.
                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                             
-----------------                                                                                                                                                                                                                            
| SELECT DEVICE |                                                                                                                                                                                                                            
-----------------                                                                                                                                                                                                                            
                                                                                                                                                                                                                                             
  Num       Scan device URI                                                                                                                                                                                                                  
  --------  --------------------------------------------------------                                                                                                                                                                         
  0*        hpaio:/net/HP_LaserJet_M1522nf_MFP?ip=192.168.1.104                                                                                                                                                                              
  1         hpaio:/usb/Photosmart_C7200_series?serial=MY78UG32DJ04YG                                                                                                                                                                         
  2         hpaio:/net/Photosmart_C7200_series?ip=192.168.1.86                                                                                                                                                                               
                                                                                                                                                                                                                                             
Enter number 0...2 for device (q=quit, <enter>=default: 0*) ?0                                                                                                                                                                               
warning: No destinations specified. Adding 'file' destination by default.                                                                                                                                                                    
Using device hpaio:/net/HP_LaserJet_M1522nf_MFP?ip=192.168.1.104                                                                                                                                                                             
Opening connection to device...                                                                                                                                                                                                              
warning: Invalid resolution. Using closest valid resolution of 300 dpi                                                                                                                                                                       
warning: Valid resolutions are  dpi.                                                                                                                                                                                                         
Traceback (most recent call last):                                                                                                                                                                                                           
  File "/usr/bin/hp-scan", line 636, in <module>
    res = valid_res[0]
IndexError: list index out of range

--- Additional comment from jpopelka on 2012-06-20 02:48:52 EDT ---

Could you re-try with hplip-3.12.6 from updates-testing ?
Update with:
yum update --enablerepo=updates-testing 'hplip*'

--- Additional comment from mail on 2012-06-20 07:49:23 EDT ---

(In reply to comment #8)
> Could you re-try with hplip-3.12.6 from updates-testing ?
> Update with:
> yum update --enablerepo=updates-testing 'hplip*'

Same output after update:


[samtuke@sam-desktop ~]$ hp-scan                                                                                                                                                                                                             
                                                                                                                                                                                                                                             
HP Linux Imaging and Printing System (ver. 3.12.6)                                                                                                                                                                                           
Scan Utility ver. 2.2                                                                                                                                                                                                                        
                                                                                                                                                                                                                                             
Copyright (c) 2001-14 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.


-----------------
| SELECT DEVICE |
-----------------

  Num       Scan device URI                                         
  --------  --------------------------------------------------------
  0         hpaio:/net/Photosmart_C7200_series?ip=192.168.1.103     
  1*        hpaio:/net/HP_LaserJet_M1522nf_MFP?ip=192.168.1.104     
  2         hpaio:/usb/Photosmart_C7200_series?serial=MY78UG32DJ04YG
  3         hpaio:/net/Photosmart_C7200_series?ip=192.168.1.86      

Enter number 0...3 for device (q=quit, <enter>=default: 1*) ?1
warning: No destinations specified. Adding 'file' destination by default.
Using device hpaio:/net/HP_LaserJet_M1522nf_MFP?ip=192.168.1.104
Opening connection to device...
warning: Invalid resolution. Using closest valid resolution of 300 dpi
warning: Valid resolutions are  dpi.
Traceback (most recent call last):
  File "/usr/bin/hp-scan", line 636, in <module>
    res = valid_res[0]
IndexError: list index out of range

--- Additional comment from pb on 2012-07-21 10:03:42 EDT ---

This bug hits me also on Fedora 16 with hplip-3.12.2-4.fc16, downgrading to hpijs-3.11.10-7.fc16 fixes the issue.

Unfortunately, in updates-testing is no newer version than 3.12.2-4 :-(

@Reporter: please extend version with FC16

--- Additional comment from mail on 2012-07-21 14:43:16 EDT ---

I have since updated to F17 (using preupgrade, presumably with the additional repositories still enabled from earlier in this thread). Since doing so, the issue is resolved.

Anything I can usefully do with the systems I now have to help with this bug?

--- Additional comment from jpopelka on 2012-07-23 08:35:40 EDT ---

Peter, can you try this build (3.12.6.fc16) ?
https://koji.fedoraproject.org/koji/buildinfo?buildID=326237

--- Additional comment from pb on 2012-07-25 02:01:24 EDT ---

(In reply to comment #12)
> Peter, can you try this build (3.12.6.fc16) ?
> https://koji.fedoraproject.org/koji/buildinfo?buildID=326237

Tested, did not solve the issue :-(

--- Additional comment from endoflife on 2012-08-07 16:06:13 EDT ---

This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 1 Peter Bieringer 2012-08-08 05:10:48 UTC
Issue is still present on F17 using hplip-3.12.6-1.fc17.i686

$ hp-scan

HP Linux Imaging and Printing System (ver. 3.12.6)
Scan Utility ver. 2.2

Copyright (c) 2001-14 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.

Using device: hpaio:/net/HP_LaserJet_CM1415fn?zc=hpljpc

warning: No destinations specified. Adding 'file' destination by default.
Using device hpaio:/net/HP_LaserJet_CM1415fn?zc=hpljpc
Opening connection to device...
warning: Invalid resolution. Using closest valid resolution of 300 dpi
warning: Valid resolutions are  dpi.
Traceback (most recent call last):
  File "/usr/bin/hp-scan", line 636, in <module>
    res = valid_res[0]
IndexError: list index out of range

Comment 2 Tim Waugh 2012-08-29 09:16:16 UTC
Are you able to visit the IP address for the printer using a web browser?  If so, could you attach what this page says?:

http://my-printer-ip-addr/Scan/ScanCaps

(you might have to "Save Page As..." to save the XML file)

Comment 3 Tim Waugh 2012-08-29 11:49:42 UTC
*** Bug 821707 has been marked as a duplicate of this bug. ***

Comment 4 Tim Waugh 2012-08-29 11:50:23 UTC
Sorry, that should be on port 8080 I think, like this:

http://my-printer-ip-addr:8080/Scan/ScanCaps

Comment 5 Tim Waugh 2012-08-30 08:36:24 UTC
Oh, my mistake.  In fact, it is not possible to debug this problem because HPLIP requires a proprietary HP plugin for that printer model.  As a result it is not possible to see how it works or why it might be going wrong.  Sorry.

Comment 6 Peter Bieringer 2012-10-14 14:08:57 UTC
Hi, issue is still not fixed, can one take a look at least for model HP LaserJet CM1415fn or is this also impossible?

/usr/share/hplip/scan.py

Issue must be caused by:
 valid_res = device.getOptionObj('resolution').constraint

which results currently in 
 hp-scan[20673]: debug: Device supported resolutions []

ngrep shows that resolution is still transferred somehow:

<PlatenOpticalResolution><Width>1200</Width><Height>1200</Height>


Here is the full ngrep of the communication of hplip until it fails:

T client -> printer
  POST / HTTP/1.1..Host: http:0..User-Agent: gSOAP/2.7..Content-Type: application/soap+xml; charset=utf-8..Transfer-Encod
  ing: chunked..Connection: close....                                                                                    
##
T client -> printer
  19E..<?xml version="1.0" encoding="UTF-8"?>.<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
   xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x
  sd="http://www.w3.org/2001/XMLSchema" xmlns:wscn="http://tempuri.org/wscn.xsd"><SOAP-ENV:Body><wscn:GetScannerElements>
  </wscn:GetScannerElements></SOAP-ENV:Body></SOAP-ENV:Envelope>..0....  


T printer -> client
  <?xml version="1.0" encoding="UTF-8"?>.<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmln
  s:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="h
  ttp://www.w3.org/2001/XMLSchema" xmlns:wscn="http://tempuri.org/wscn.xsd"><SOAP-ENV:Body><wscn:ScanElements><ScannerCon
  figuration><DeviceSettings><FormatSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="wscn:ScanDocumentFormat" SOAP-
  ENC:arraySize="2"><item>jfif</item><item>hpraw</item></FormatSupported><QualityFactorSupported>false</QualityFactorSupp
  orted><ContentSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="wscn:ContentType" SOAP-ENC:arraySize="1"><item>Aut
  o</item></ContentSupported><DocumentSizeAutoDetectSupported>false</DocumentSizeAutoDetectSupported><FeederCapacity>50</
  FeederCapacity><DuplexRotation>180</DuplexRotation><Rotation>0</Rotation></DeviceSettings><Platen><ColorSupported xsi:t
  ype="SOAP-ENC:Array" SOAP-ENC:itemType="wscn:ColorEntryType" SOAP-ENC:arraySize="4"><item>BlackandWhite1</item><item>Gr
  ayScale8</item><item>RGB24</item><item>20291628</item></ColorSupported><PlatenMinimumSize><Width>1920</Width><Height>19
  20</Height></PlatenMinimumSize><PlatenMaximumSize><Width>8500</Width><Height>11690</Height></PlatenMaximumSize><PlatenO
  pticalResolution><Width>1200</Width><Height>1200</Height></PlatenOpticalResolution><FlatbedSupported>true</FlatbedSuppo
  rted></Platen><ADF><                                                                                                   
##
T printer -> client
  ADFSupported>true</ADFSupported><ADFSupportsDuplex>false</ADFSupportsDuplex><ADFMinimumSize><Width>1920</Width><Height>
  1920</Height></ADFMinimumSize><ADFMaximumSize><Width>8500</Width><Height>15000</Height></ADFMaximumSize><ADFOpticalReso
  lution><Width>300</Width><Height>300</Height></ADFOpticalResolution></ADF></ScannerConfiguration><ScannerStatus><Scanne
  rCurrentTime>2012-10-14T14:50:51Z</ScannerCurrentTime><ScannerState>Idle</ScannerState><ScannerStateReason>None</Scanne
  rStateReason><ScanToStatus><PaperInADF>false</PaperInADF><ScanToAvailable>false</ScanToAvailable></ScanToStatus></Scann
  erSta..78..tus><ScannerInfo><ModelNumber>CE861A</ModelNumber></ScannerInfo></wscn:ScanElements></SOAP-ENV:Body></SOAP-E
  NV:Envelope>..0....

Comment 7 Tim Waugh 2012-10-15 13:28:14 UTC
As noted, this printer requires a proprietary plugin from HP. As we do not/cannot examine the source code for this, there is no possibility of debugging it.

The only way to fix it is to get HP to do so, unfortunately.

Comment 8 Peter Bieringer 2012-10-15 15:18:32 UTC
(In reply to comment #7)
> As noted, this printer requires a proprietary plugin from HP. As we do
> not/cannot examine the source code for this, there is no possibility of
> debugging it.
> 
> The only way to fix it is to get HP to do so, unfortunately.

Thank you for your hint, this pushes me to investigate the plugin status....

Original:

hp-check reports:

HP_LaserJet_CM1415fn
--------------------
Type: Printer
Device URI: hp:/net/HP_LaserJet_CM1415fn?zc=hpljpc
PPD: /etc/cups/ppd/HP_LaserJet_CM1415fn.ppd
PPD Description: HP LaserJet CM1410 Series Postscript (recommended)
Printer status: printer HP_LaserJet_CM1415fn is idle.  enabled since Do 05 Jan 2012 07:29:28 CET
error: Required plug-in status: Not installed
Communication status: Good

=> plugin missing!

re-run hp-setup, which installs the plugin -> everything works fine now again.


Afterwards:

HP_LaserJet_CM1415fn
--------------------
Type: Printer
Device URI: hp:/net/HP_LaserJet_CM1415fn?zc=hpljpc
PPD: /etc/cups/ppd/HP_LaserJet_CM1415fn.ppd
PPD Description: HP LaserJet CM1410 Series Postscript (recommended)
Printer status: printer HP_LaserJet_CM1415fn is idle.  enabled since Do 05 Jan 2012 07:29:28 CET
Required plug-in status: Installed  <-!!!!
Communication status: Good


Looks like the plugin got lost :-(

So I suggest at least to extend hplip to display a hint in case of no resolution is in the list to check the plugin status.


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