PATCH ATTACHED: hp-levels does not work without TTY

Bug #299479 reported by Till Kamppeter
4
Affects Status Importance Assigned to Milestone
HPLIP
Fix Released
Medium
Unassigned

Bug Description

When I build a package on a build server and do "hp-levels --help-man" during the build, hp-levels fails because it tries to determine the TTY dimensions. This means, that I cannot get a man page for this utility in an official package for Ubuntu.

The attached patch puts a "try: ... except: ..." around the TTY size determination which falls back to a default value if there is no TTY.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Revision history for this message
Aaron Albright (albrigha-deactivatedaccount) wrote :

Don will be adding this to our tip in the near future.

Aaron

Changed in hplip:
assignee: nobody → kalosaurusrex
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Don, Aaron, what about applying this patch to HPLIP?

Revision history for this message
dwelch91 (dwelch91) wrote : Re: [Bug 299479] Re: hp-levels does not work without TTY

I applied this patch on 11/18/08, so it should have been fixed in 2.8.12. We
will re-test in 3.9.1.

On Mon, Jan 19, 2009 at 12:19 AM, Till Kamppeter
<email address hidden>wrote:

> Don, Aaron, what about applying this patch to HPLIP?
>
> --
> hp-levels does not work without TTY
> https://bugs.launchpad.net/bugs/299479
> You received this bug notification because you are a member of HP Linux
> Imaging and Printing, which is subscribed to HPLIP.
>

Revision history for this message
dwelch91 (dwelch91) wrote : Re: [Bug 299479] Re: PATCH ATTACHED: hp-levels does not work without TTY

Patch was applied 11/18/08.

On Mon, Jan 19, 2009 at 12:35 AM, Till Kamppeter
<email address hidden>wrote:

> ** Summary changed:
>
> - hp-levels does not work without TTY
> + PATCH ATTACHED: hp-levels does not work without TTY
>
> --
> PATCH ATTACHED: hp-levels does not work without TTY
> https://bugs.launchpad.net/bugs/299479
> You received this bug notification because you are a member of HP Linux
> Imaging and Printing, which is subscribed to HPLIP.
>

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

In the source code of HPLIP 2.8.12 the bug is still present and I have still to apply the patch. Probably it got lost again on furthrt work you did on levels.py

Revision history for this message
dwelch91 (dwelch91) wrote :

I had actually "applied the patch" by modifying other code to have the same
effect (and to handle all calls to ttysize(), not just the single one from
hp-levels). I changed tui.ttysize() to return (40, 64) if the 'stty' command
fails:

# base/tui.py:193

def ttysize():
   try:
       import commands # TODO: Replace with subprocess (commands is
deprecated in Python 3.0)
       ln1 = commands.getoutput('stty -a').splitlines()[0]
       vals = {'rows':None, 'columns':None}
       for ph in ln1.split(';'):
           x = ph.split()
           if len(x) == 2:
               vals[x[0]] = x[1]
               vals[x[1]] = x[0]
       return int(vals['rows']), int(vals['columns'])
   except TypeError:
       return 40, 64

Is the exception type being caught wrong? The failure mode that you are
seeing must be different than how I tested this (I temporarily changed the
'stty' command to 'xstty' to make the command fail.)

On Mon, Jan 19, 2009 at 9:01 AM, Till Kamppeter <email address hidden>
wrote:
>
> In the source code of HPLIP 2.8.12 the bug is still present and I have
> still to apply the patch. Probably it got lost again on furthrt work you
> did on levels.py
>
> --
> PATCH ATTACHED: hp-levels does not work without TTY
> https://bugs.launchpad.net/bugs/299479
> You received this bug notification because you are a member of HP Linux
> Imaging and Printing, which is subscribed to HPLIP.

Revision history for this message
Linus Araque (linus-araque) wrote :

I was unable to reproduce this error using the latest (3.9.1.9) build. My test setup is as follows:

Distro - Ubuntu 8.10 Intrepid 32bit
Test unit - OfficeJet J6400
Connection - LAN
HPLIP - 3.9.1.9-internal

I used ssh to connect to my test system, then ran hp-levels from CLI. The output was as expected, the tool ran with no errors.

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

Sorry for the confusion.

Once, I simple made up my reminder e-mail of all the bugs which I have reported but which are not closed as fixed. Second, as your fix is done in a completely different file, my patch in the Ubuntu package did not stop to work, so it looked for me that the bug is not yet fixed. Your fix is even better than mine. Thank you very much.

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