smart upgrade crashes on serial or xen terminal

Bug #243999 reported by Rehan Khan
2
Affects Status Importance Assigned to Milestone
Smart Package Manager
New
Undecided
Unassigned

Bug Description

Revision history for this message
Rehan Khan (rasker) wrote :
Download full text (8.3 KiB)

Issue 172:

msg1276 (view) Author: netmask Date: 2008-01-04.11:50:00

eswierk, thanks for taking a look at this issue. Even though looks like you
touched the correct spot to fix the issue, IMHO one should not just guess that
user is running on a 70px window. My vote would be 20px as a safe value.

msg1269 (view) Author: eswierk Date: 2007-12-31.18:55:26

When TextProgress.setScreenWidth is passed a width of 0, it generates a bogus
format string containing a negative number.

The attached patch works around this bug by forcing the width to at least 70
characters.

msg1185 (view) Author: ed Date: 2007-08-25.14:54:44

NB I can still reproduce this on Fedora 7.

msg1131 (view) Author: ed Date: 2007-04-08.19:32:31

Hi, yes I can still reproduce this on Fedora Core 5 with the default set of
repositories. However, it seems to appear only when running smart inside an
Emacs shell buffer. (This is a way to run a subshell in Emacs and have the
output of commands appear in Emacs.) Try starting GNU Emacs or xemacs and do
M-x shell to make the shell buffer appear, then run a smart command to install a
package. My hunch is that the progress bar code is going wrong because smart's
output is not going to a real tty that supports querying width and height. Here
is another example:

root@bone /home/ed/packages/SRPMS # smart install dosbox
Loading cache...
( 0%) [100%]

Computing transaction...

Installing packages (2):

736.1kB of package files are needed. 2.1MB will be used.

Confirm changes? (Y/n): y

Fetching packages...
-> http://download.fedora.redhat.com/.../SDL_net-1.2.6-2.fc6.x86_64.rpm
( 0%)(73% Stalled Unknown)(73% 4.0kB/s Unknown) [ 50%]
-> http://download.fedora.redhat.com/.../dosbox-0.70-1.fc6.x86_64.rpm
(4% 4.0kB/s 02m55s)(4% 7.0kB/s 02m55s)(6% 7.0kB/s 01m37s)(8% 7.0kB/s 01m37s)(8%
13.2kB/s 01m37s)(11% 13.2kB/s 49s)(13% 13.2kB/s 49s)(13% 17.9kB/s 49s)(15%
17.9kB/s 34s)(17% 21.4kB/s 34s)(20% 21.4kB/s 27s)(22% 24.1kB/s 27s)(24% 24.1kB/s
23s)(26% 24.1kB/s 23s)(26% 26.0kB/s 23s)(29% 26.0kB/s 20s)(29% 23.5kB/s 20s)(31%
23.5kB/s 21s)(33% 23.5kB/s 21s)(33% 25.6kB/s 21s)(35% 25.6kB/s 18s)(38% 25.6kB/s
18s)(38% 27.2kB/s 18s)(40% 27.2kB/s 16s)(42% 27.2kB/s 16s)(42% 28.4kB/s 16s)(44%
28.4kB/s 14s)(47% 28.4kB/s 14s)(47% 29.3kB/s 14s)(49% 29.3kB/s 12s)(51% 29.3kB/s
12s)(51% 30.0kB/s 12s)(53% 30.0kB/s 11s)(55% 30.5kB/s 11s)(58% 30.5kB/s 10s)(60%
30.5kB/s 10s)(60% 30.9kB/s 10s)(62% 30.9kB/s 09s)(64% 31.1kB/s 09s)(67% 31.1kB/s
08s)(67% 27.3kB/s 08s)(69% 27.3kB/s 08s)(71% 27.3kB/s 08s)(71% 28.5kB/s 08s)(73%
28.5kB/s 07s)(76% 28.5kB/s 07s)(76% 29.4kB/s 07s)(78% 29.4kB/s 05s)(80% 29.4kB/s
05s)(80% 30.0kB/s 05s)(82% 30.0kB/s 04s)(85% 30.0kB/s 04s)(85% 30.5kB/s 04s)(87%
30.5kB/s 03s)(89% 30.5kB/s 03s)(89% 30.9kB/s 03s)(91% 30.9kB/s 02s)(94% 31.2kB/s
02s) (96% 31.2kB/s 01s) (98% 31.2kB/s 01s) (98% 31.4kB/s 01s) [100%]

Committing transaction...
( 0%) [ 0%]

Traceback (most recent call last):
  File "/usr/bin/smart", line 194, in ?
    main(sys.argv[1:])
  File "/usr/bin/smart", line 167, in main
    exitcode = iface.run(opts.command, opts.argv)
  File "/usr/lib64/python2.4/site-packages/smart/interface.py", line 53, in run
    result = _c...

Read more...

Revision history for this message
Rehan Khan (rasker) wrote :

msg1293 (view) Author: peter-endian Date: 2008-01-28.11:01:11

yes, that patch fixes the problem also. Did not see it before.
However, viewing the patch i think, the patch of issue172 is more a workaround
only for this specific problem.

But the problem is more that getScreenWidth sometimes can return 0 and that size
will be used also in other parts of the tool, which will also fail if fixed only
in text/progress.py like in patch of issue172

I think it would be better to fix it in getScreenWidth(). I am unsure if simply
returning 80 if the size is 0 is sufficient. Better would be to read it out
somewhere, but did not find any possibility for serial terminal emulation.
Also maybe returning 80 if the width is <20, like you mentioned would be better,
than simply returning 80 if it is 0, since the problem persists if the width
would be 4 for example.

msg1291 (view) Author: netmask Date: 2008-01-27.11:22:23

Hi Peter,
Could you please check if the proposed patch in issue172 fixes your issue?

msg1289 (view) Author: peter-endian Date: 2008-01-25.15:24:40

if you try to smart upgrade through a serial console or a xen console smart
crashes with this traceback:

...
  File "/usr/lib/python2.4/site-packages/smart/backends/rpm/pm.py", line 309, in
__call__
    self.prog.show()
  File "/usr/lib/python2.4/site-packages/smart/progress.py", line 110, in show
    self.expose(topic, percent, *info)
  File "/usr/lib/python2.4/site-packages/smart/interfaces/text/progress.py",
line 108, in expose
    out.write(self._topicmaskn % (n, topic))
ValueError: unsupported format character '-' (0x2d) at index 9

This happens because getScreenWith() returns a window size of 0 for those
terminal emulations.
The attached patch returns a default value of 80 when the window size is 0.

Revision history for this message
Rehan Khan (rasker) wrote :

The above is issue 355

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.