hp-plugin -i plugin download error

Bug #740140 reported by Antonio Alcantara
76
This bug affects 11 people
Affects Status Importance Assigned to Milestone
HPLIP
Fix Released
High
Unassigned
hplip (Ubuntu)
Fix Released
High
Unassigned
python2.7 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: hplip

hp-plugin -i plugin download error - user is root as required

# hp-plugin -i

HP Linux Imaging and Printing System (ver. 3.11.3)
Plugin Download and Install Utility ver. 2.1

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.

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)

/
-----------------------------------------
| PLUG-IN INSTALLATION FOR HPLIP 3.11.3 |
-----------------------------------------

  Option Description
  ---------- --------------------------------------------------
  d Download plug-in from HP (recomended)
  p Specify a path to the plug-in (advanced)
  q Quit hp-plugin (skip installation)

Enter option (d=download*, p=specify path, q=quit) ? d

--------------------------
| DOWNLOAD CONFIGURATION |
--------------------------

Checking for network connection...
Downloading configuration file from: http://hplip.sf.net/plugin.conf
Downloading configuration: [\ ] 0% Traceback (most recent call last):
  File "/usr/bin/hp-plugin", line 320, in <module>
    plugin_download_callback)
  File "/usr/share/hplip/installer/core_install.py", line 1851, in get_plugin_info
    filename, headers = urllib.urlretrieve(plugin_conf_url, local_conf, callback)
  File "/usr/lib/python2.6/urllib.py", line 93, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.6/urllib.py", line 264, in retrieve
    size = int(headers["Content-Length"])
ValueError: invalid literal for int() with base 10: '7054, 7054'

Related branches

Changed in hplip (Ubuntu):
status: New → Invalid
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

This is not a bug of the Ubuntu package of HPLIP but of HPLIP itself (note also that the newest Ubuntu package is only of version 3.11.1 and not yet 3.11.3). Therefore I am closing the bug task for the Ubuntu package and adding a task for the upstream software.

To the HPLIP developers at HP, somewhere in the transitions of Python 2.6.x -> 2.7.0 -> 2.7.1 type conversion got more restrictive. Please check with the newest versions of Python.

Revision history for this message
Daniel LaGesse (dlagesse1992) wrote :

So, what should we do right now?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Try this possible fix:

https://bugs.launchpad.net/ubuntu/+source/hplip/+bug/368514/comments/14

Please tell whether it works.

Changed in hplip:
status: New → Incomplete
Changed in hplip (Ubuntu):
status: Invalid → Triaged
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Reopening the task for the Ubuntu package as according to bug 368514 the problem also occurs with HPLIP 3.11.1 and the fix posted there can be applied to Natty's HPLIP package as a simple patch.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have now tried and I can reproduce the bug. Some days ago I was still able to install the plugin with the hp-plugin utility.

Seems that something in Python changed some days ago. Python is now much more restrictive concerning data type conversions. See also bug 733088.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

On the way to prepare fixing Ubuntu's HPLIP package I discovered that the suggested fix is patching the file /usr/lib/python2.7/urllib.py which is part of the python2.7 package and not of HPLIP. Assuming the fix is the correct solution, the bug would be of Python and not of HPLIP and several other programs written in Python are also not able to download files.

Changed in python2.7 (Ubuntu):
milestone: none → ubuntu-11.04
Changed in hplip (Ubuntu):
milestone: none → ubuntu-11.04
Revision history for this message
wribeiro (wribeiro) wrote :

Ok Till.
The way I found to install hp-plugin is apply a small change on file "/usr/lib/python2.6/urllib.py", line 265, replacing the code
  size = int(headers["Content-Length"])
by
  size = int(headers["Content-Length"].split(",")[0])

That's because headers["Content-Length"] seems to be returning something like "7054, 7054" instead of "7054" that might be
expected.

After this hp-plugin works fine.

Revision history for this message
Scott Kitterman (kitterman) wrote :

We've had python2.7 2.7.1 in Natty since November and it's been the default Python since December 8, 2010. Nothing has changed 'recently'. That particular line is also the same in python2.6. Changing the way Python's urilib handles length to throw away the bogus half of the input data is not at all a proper solution for this. There's no evidence so far this is an issue in any Python version.

Changed in python2.7 (Ubuntu):
status: New → Invalid
milestone: ubuntu-11.04 → none
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Scott, what is the problem here then? Is it SourceForge's server not complying with the standards (the URL which is tried to be downloaded here is http://hplip.sf.net/plugin.conf)? Or does HP need to use another library?

Revision history for this message
brain_death (brain-death) wrote :

I'm on a Windows machine at the moment but I had the same error and from memory, this is a workaround.

Download the HP plugin from here:

http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.11.3-plugin.run

Install it by executing the file you downloaded or when prompted by the hp-plugin utility from your hard drive.

Sorted!

:o))

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

brain_death, thank you very much.

Manually installing the plugin directly from OpenPrinting is a workaround of users who got stuck on this bug, but we really need to fix hp-plugin, as Ubuntu ships with a concept of installing the plugin automatically if it is needed. Preferably we need a solution which has to be applied only to the HPLIP package.

Revision history for this message
brain_death (brain-death) wrote :

Point taken Till Kamppeter and of course I agree...

Thanks for being gentle with a Linux n00b!

Revision history for this message
Colin Watson (cjwatson) wrote :

What's actually happening is that the SourceForge server is sending the Content-Length header twice. Here are the headers I'm seeing, as captured by tcpflow:

  GET /plugin.conf HTTP/1.0
  Host: hplip.sourceforge.net
  User-Agent: Python-urllib/1.17

  HTTP/1.1 200 OK
  Server: Apache/2.2.3 (CentOS)
  Last-Modified: Thu, 17 Mar 2011 06:58:02 GMT
  ETag: "1b8e-49ea82eb2b4d9"
  Content-Length: 7054
  Expires: Sat, 26 Mar 2011 00:02:02 GMT
  Content-Type: text/plain
  Content-Length: 7054
  Date: Thu, 24 Mar 2011 00:02:02 GMT
  X-Varnish: 1348565344
  Age: 0
  Via: 1.1 varnish
  Connection: close

This is disallowed by HTTP/1.1. RFC2616 defines Content-Length thus in section 14.13:

       Content-Length = "Content-Length" ":" 1*DIGIT

but in section 4.2:

   Multiple message-header fields with the same field-name MAY be
   present in a message if and only if the entire field-value for that
   header field is defined as a comma-separated list [i.e., #(values)].
   It MUST be possible to combine the multiple header fields into one
   "field-name: field-value" pair, without changing the semantics of the
   message, by appending each subsequent field-value to the first, each
   separated by a comma. The order in which header fields with the same
   field-name are received is therefore significant to the
   interpretation of the combined field value, and thus a proxy MUST NOT
   change the order of these field values when a message is forwarded.

My reading is therefore that hplip.sourceforge.net is in violation of a MUST in RFC2616 and the client has no obligation to work around it, although some clients (e.g. Firefox) appear to do so. This should be reported to SourceForge.

Changed in hplip (Ubuntu):
status: Triaged → Invalid
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Colin, thank you very much for explaining the problem.

To the HPLIP developers at HP: Currently no user is able to install the proprietary driver plug-in for any version of HPLIP on any distribution. The problem is a software change which SourceForge has done on their servers which leads to a broken HTTP header. Due to this, the urllib of Python is not able any more to download the plugin index file http://hplip.sf.net/plugin.conf from SourceForge (Firefox and wget still download the file though). Please report this urgently to SourceForge giving a reference to this bug report and Colin Watson's comment. Note that this bug makes the plugin completely inaccessible for normal users (who do not know its location on OpenPrinting).

Revision history for this message
Scott Kitterman (kitterman) wrote :

I would suggest that rather than invalid, this should be wishlist. It's a sourceforge bug, but it would not be unreasonable for hplip to work around the bug as some browsers do.

Changed in hplip (Ubuntu):
importance: Undecided → Wishlist
milestone: ubuntu-11.04 → none
status: Invalid → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote : Re: [Bug 740140] Re: hp-plugin -i plugin download error

I think it would be OK for hplip to work around it. I'd recommend
against changing Python's httplib module, though. Let's keep any
workarounds contained.

Revision history for this message
Sanjay Kumar (sanjay-kumar14) wrote :

Hi All,

Thnaks for the detailed analysis of the bug. We were not able to reproduce the issue because the download just works fine when proxy settings are used. Anyway we could reproduce the issue once we used the direct internet connection. We will very soon get back to you with a proper solution to this issue or workaround.

Thanks,
Sanjay Kumar
Developer HPLIP Team Bangalore

Revision history for this message
Tameghe (fulca07) wrote :

Please, have a backup of the original urllib.py file, because with the modified one some applications doesn't work (the menu voice "Printing" under System>Administration, for example). Use the modified urllib.py only for the driver installation and then restore the original one.

Revision history for this message
Colin Watson (cjwatson) wrote :

As I said, we shouldn't be changing urllib (or httplib, which is more
directly relevant) at all. Any workaround should be confined to
hp-plugin.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

HP has provided a workaround in HPLIP 3.11.3a. I am backporting it now.

Changed in hplip (Ubuntu):
status: Confirmed → In Progress
importance: Wishlist → High
milestone: none → ubuntu-11.04-beta-1
Changed in hplip (Ubuntu):
status: In Progress → Fix Committed
Changed in hplip:
status: Incomplete → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hplip - 3.11.1-2ubuntu2

---------------
hplip (3.11.1-2ubuntu2) natty; urgency=low

  * debian/patches/workaround-sf-server-bug-for-plugin-index-download.dpatch:
    In order to download the proprietary plug-in (firmware files, driver
    add-ons), the "hp-plugin" utility downloads an index file from SourceForge.
    Due to software changes at SourceForge which introduced a bug, Python's
    urllib is not able any more to download this file, making the plug-in
    download via "hp-plugin" impossible. HP has quickly released HPLIP 3.11.3a
    which works around the problem by using the command line utility "wget".
    This patch is a backport of the workaround (LP: #740140).

  * debian/control: Let hplip depend on wget. wget is needed for the plugin
    download now.
 -- Till Kamppeter <email address hidden> Fri, 25 Mar 2011 17:08:18 +0100

Changed in hplip (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Sanjay Kumar (sanjay-kumar14) wrote :

Hi All,

Please find the HPLIP release [version 3.11.3a] in our website for the plugin issue. We are now using wget utility to download the files from sourceforge in order to overcome issues seen in python library. Thanks for using HPLIP.

Thanks,
Sanjay Kumar
HPLIP Team

Revision history for this message
Tameghe (fulca07) wrote :

I've Ubuntu 10.04 LTS and consequently an old version of hplip. How can I do to install my LaserJet 1020 plugin? I would prefer not to update hplip and choice the plugin in a specific path during the installation process of my hplip. But I don't know which is the plugin I have to download. Can someone explain to me how to do? Thanks!

Revision history for this message
Sanjay Kumar (sanjay-kumar14) wrote :

Hi Tameghe,

In case you dont want to upgrade HPLIP, please replace /usr/share/hplip/instaler/core_install.py with the core_install.py fle present in the HPLIP 3.11.3a tarball release (hplip-3.11.3a.tar.gz) and then try following command.

 hp-plugin -i

Download link for hplip-3.11.3a.tar.gz is:
http://sourceforge.net/projects/hplip/files/hplip/3.11.3a/hplip-3.11.3a.tar.gz/download
File Location: hplip-3.11.3a\installer\core_install.py

This will now download and install the plugin. Thanks for contacting HPLIP.

Thanks,
Sanjay Kumar
HPLIP Team

Revision history for this message
Tameghe (fulca07) wrote :

Thanks a lot for your help! However I've chosen another way: I've downloaded the .run and the .asc files for my version of hplip from http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/, put them in my home directory and installed them from that path. All works well!!! Thanks again ...

Changed in hplip:
status: Confirmed → Fix Released
importance: Undecided → High
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.