Bug 1256531

Summary: dnf install crashes if terminal window is too small
Product: [Fedora] Fedora Reporter: Dusty Mabe <dustymabe>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: awilliam, dustymabe, jsilhan, mluscon, packaging-team-maint, pnemade, rholy, robatino, satellitgo, sbandyop, tim.lauridsen, vmukhame
Target Milestone: ---Keywords: CommonBugs
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: AcceptedBlocker https://fedoraproject.org/wiki/Common_F23_bugs#dnf-resize-crash
Fixed In Version: dnf-1.1.2-4.fc23 dnf-1.1.2-4.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-04 19:13:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1170821    
Attachments:
Description Flags
Output From DNF Crash
none
ABRT Dump from DNF Crash none

Description Dusty Mabe 2015-08-24 20:24:25 UTC
Created attachment 1066623 [details]
Output From DNF Crash

Description of problem:

If the terminal window is too small DNF can crash. I had kicked off an install and then resized the terminal to be really small while I worked on something else. This resulted in half of the rpms getting installed and half of them not (see full attachment).

The output from the traceback is:
  Installing  : minizip-1.2.8-7.fc22.x86_64                                     12/58
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.py", line 415, in callback
    self._instProgress( bytes, total, h )
  File "/usr/lib/python2.7/site-packages/dnf/yum/rpmtrans.py", line 493, in _instProgress
    self.total_actions)
  File "/usr/lib/python2.7/site-packages/dnf/cli/output.py", line 2156, in progress
    percent, process, pkgname, wid1)
  File "/usr/lib/python2.7/site-packages/dnf/cli/output.py", line 2174, in _out_progress
    pkgname=pkgname, wid1=wid1)
  File "/usr/lib/python2.7/site-packages/dnf/cli/output.py", line 2230, in _makefmt
    bar = fmt_bar % (self.mark * int(marks * (percent / 100.0)), )
ValueError: unsupported format character '-' (0x2d) at index 6
FATAL ERROR: python callback <bound method RPMTransaction.callback of <dnf.yum.rpmtrans.RPMTransaction object at 0x7f2e33297990>> failed, aborting!

The abrt dump (full dump in attachment) shows:
Local variables in innermost frame:
ts_total: 58L
wid1: 12
pkgname: u'libtiger-0.3.4-9.fc22.x86_64'
full_pnl: -5
percent: 0L
self: <dnf.cli.output.CliTransactionDisplay object at 0x7f2e3966c4d0>
fmt_done: u'%2.2s/%2.2s'
l: 2
ts_done: 13
width: u'-6.-6'
overhead: 26
pnl: 0
done: u'13/58'
marks: -6
fmt_bar: u'[%--6.-6s]'
progress: True
size: u'2.2'


It seems to me like 'mark' getting a negative value is causing this problem:
$ python
Python 2.7.10 (default, Jul  5 2015, 14:15:43) 
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> marks = -6
>>> width = "%s.%s" % (marks, marks)
>>> fmt_bar = "[%-" + width + "s]"
>>> mark = '#'
>>> percent = 0L
>>> bar = fmt_bar % (mark * int(marks * (percent / 100.0)), )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unsupported format character '-' (0x2d) at index 6


Version-Release number of selected component (if applicable):
dnf-1.1.0-2.fc22.noarch

How reproducible:
Always


Steps to Reproduce:
1. Start install
2. Minimize terminal window to be really small
3. Observe failure

Comment 1 Dusty Mabe 2015-08-24 20:25:46 UTC
Created attachment 1066626 [details]
ABRT Dump from DNF Crash

Comment 2 Dusty Mabe 2015-08-25 20:37:26 UTC
Confirmed that this also happens for F23 alpha. Tested against https://download.fedoraproject.org/pub/fedora/linux/releases/test/23_Alpha/Cloud/x86_64/Images/Fedora-Cloud-Base-23_Alpha-20150806.2.x86_64.raw.xz 

[root@localhost ~]# rpm -q dnf
dnf-1.0.2-2.fc23.1.noarch

Comment 3 Fedora Blocker Bugs Application 2015-08-25 20:39:32 UTC
Proposed as a Blocker for 23-alpha by Fedora user dustymabe using the blocker tracking app because:

 It is a bit of a stretch but if someone minimized the terminal window and had the installation crash on them then it may be a violation of:

"The installed system must be able to download and install updates with the default console package manager."

Either way I'd like to see this get fixed.

Comment 4 Adam Williamson 2015-09-01 00:26:37 UTC
There is no point proposing bugs as Alpha blockers, as Alpha has been released. It achieves nothing (no process will pick them up). Moving to Final, you can move to Beta if you like but it feels Final-ish to me.

Comment 5 Dusty Mabe 2015-09-01 02:10:41 UTC
Hey Adam. Sorry about that. I chose alpha because that was the release criteria I was referencing (see [1]). I knew alpha was out. Next time I'll just propose it for whatever the "next" milestone is.

Thanks!

[1] - http://fedoraproject.org/wiki/Fedora_23_Alpha_Release_Criteria#Installer_must_run

Comment 6 Adam Williamson 2015-09-01 02:20:06 UTC
Yep - all Alpha criteria apply to Beta, and all Alpha and Beta criteria apply to Final. So if you find a violation of an 'older' criterion just go ahead and nominate against the next milestone.

Comment 7 Honza Silhan 2015-09-01 12:27:01 UTC
*** Bug 1258108 has been marked as a duplicate of this bug. ***

Comment 8 Adam Williamson 2015-09-10 19:26:46 UTC
Discussed at 2015-09-10 blocker review meeting: https://meetbot-raw.fedoraproject.org/fedora-blocker-review/2015-09-10/f23-blocker-review.2015-09-10-16.00.log.txt . Accepted as a Final blocker. We acknowledge that not many users are likely to hit this - making the terminal smaller while a transaction is in progress seems like a fairly unusual thing to do - but we considered that the impact of this bug is so severe (crashing during a package transaction leaves the entire system in an inconsistent and potentially broken state) that even one person hitting it would be too many. Basically we reckon any known bug that can cause the package manager to crash in the middle of a transaction is almost certainly a release blocker.

Criterion is "The installed system must be able to download and install updates with the default console package manager.", with the note that it's a conditional violation but the *consequences* are so severe it constitutes a blocker.

We will also document this for Beta.

Comment 9 Adam Williamson 2015-09-22 06:20:35 UTC
Can we please get a fix for this ASAP? A crasher bug during package install in a stable release (this affects both 22 and 23) is not a good thing...thanks!

Comment 10 Fedora Update System 2015-09-22 15:00:41 UTC
hawkey-0.6.1-1.fc23 dnf-plugins-core-0.1.12-2.fc23 dnf-1.1.2-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16428

Comment 11 Fedora Update System 2015-09-22 15:02:52 UTC
dnf-plugins-core-0.1.12-2.fc22 hawkey-0.6.1-1.fc22 dnf-1.1.2-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16429

Comment 12 Fedora Update System 2015-09-23 03:54:30 UTC
dnf-1.1.2-2.fc23, dnf-plugins-core-0.1.12-2.fc23, hawkey-0.6.1-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf-plugins-core dnf hawkey'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-16428

Comment 13 Fedora Update System 2015-09-23 21:22:22 UTC
dnf-1.1.2-2.fc22, dnf-plugins-core-0.1.12-2.fc22, hawkey-0.6.1-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf-plugins-core dnf hawkey'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-16429

Comment 14 Adam Williamson 2015-09-30 22:32:15 UTC
So the update to fix this was the one that busted dnf entirely; both F22 and F23 updates have been negative karma'ed to oblivion.

I see newer builds for both 22 and 23 in Koji:

http://koji.fedoraproject.org/koji/buildinfo?buildID=688785
http://koji.fedoraproject.org/koji/buildinfo?buildID=688786

but no update for either in Bodhi. If these are ready to go could you please submit updates? Thanks!

Comment 15 Fedora Update System 2015-10-02 15:20:39 UTC
dnf-plugins-core-0.1.12-3.fc23 hawkey-0.6.1-2.fc23 dnf-1.1.2-4.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-38e69423f3

Comment 16 Fedora Update System 2015-10-02 15:24:39 UTC
dnf-plugins-core-0.1.12-3.fc22 hawkey-0.6.1-2.fc22 dnf-1.1.2-4.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-3528c659e4

Comment 17 Fedora Update System 2015-10-04 01:36:12 UTC
dnf-1.1.2-4.fc22, dnf-plugins-core-0.1.12-3.fc22, hawkey-0.6.1-2.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update hawkey dnf-plugins-core dnf'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-3528c659e4

Comment 18 Fedora Update System 2015-10-04 01:52:06 UTC
dnf-1.1.2-4.fc23, dnf-plugins-core-0.1.12-3.fc23, hawkey-0.6.1-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update hawkey dnf-plugins-core dnf'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-38e69423f3

Comment 19 Fedora Update System 2015-10-04 19:12:56 UTC
dnf-1.1.2-4.fc23, dnf-plugins-core-0.1.12-3.fc23, hawkey-0.6.1-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2015-10-05 21:52:26 UTC
dnf-1.1.2-4.fc22, dnf-plugins-core-0.1.12-3.fc22, hawkey-0.6.1-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.