Bug 1256845 - Exception in anaconda reclaim space dialog with "plural" languages
Exception in anaconda reclaim space dialog with "plural" languages
Status: CLOSED NEXTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: anaconda (Show other bugs)
7.1
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Anaconda Maintenance Team
Release Test Team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-25 11:05 EDT by Vit Ry
Modified: 2015-08-25 13:20 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-25 13:20:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Anaconda exception stacktrace (305.36 KB, text/plain)
2015-08-25 11:05 EDT, Vit Ry
no flags Details
Patch to fix a bug (2.40 KB, patch)
2015-08-25 11:07 EDT, Vit Ry
no flags Details | Diff

  None (edit)
Description Vit Ry 2015-08-25 11:05:53 EDT
Created attachment 1066898 [details]
Anaconda exception stacktrace

Description of problem:

Anaconda's Reclaim space dialog crashes, if user uses language which has >=3 nplurals (Czech, Polish, Latvian...). See http://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html for full list.

Version-Release number of selected component (if applicable):
anaconda-19.31.123-1


How reproducible:
always


Steps to Reproduce:
1. Prepare virtual machine, so it already has some OS/installation and no free space.
2. Start in VM installation of RHEL 7.1/CentOS 7.1 (15.03) and select one of "problematic" languages (Czech, Polish, Latvian...).
3. Press "System-Installation destination". Then Done. Reclaim space dialog will appears.
4.Press "Reclaim space".

Actual results:
Python exception appears (see attachement)

Expected results:
Appearing of another dialog - "Reclaim disk space"

Additional info:

This bug was introduced by this commit: 
https://github.com/rhinstaller/anaconda/commit/24beb771a76df9b3059dcade862b47f6b772676d#diff-67c821c2c42c4c96a7ad07c5a772061e

see file pyanaconda/ui/gui/spokes/lib/resize.py line 228.
So, commit added next logic

text = P_("<b>%s disk; %s reclaimable space</b> (in filesystems)",
          "<b>%s disks; %s reclaimable space</b> (in filesystems)",
          escape_markup(nDisks)) % (escape_markup(nDisks),   escape_markup(size_str(totalReclaimable)))

which will fails, because P_() need args like (str, str, int), but third argument is "escape_markup(nDisks)", which will be string, so gettext.py fails.

It can be easy fixed (and already fixed in anaconda-20.1-1; can't find proper commit) like

diff --git a/anaconda/pyanaconda/ui/gui/spokes/lib/resize.py b/anaconda/pyanaconda/ui/gui/spokes/lib/resize.py
index c45147e..5744b44 100644
--- a/anaconda/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/anaconda/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -225,7 +225,7 @@ class ResizeDialog(GUIObject):
         if nDisks is not None and totalReclaimable is not None:
             text = P_("<b>%(count)s disk; %(size)s reclaimable space</b> (in file systems)",
                       "<b>%(count)s disks; %(size)s reclaimable space</b> (in file systems)",
-                      escape_markup(nDisks)) % {"count": escape_markup(nDisks),
+                      nDisks) % {"count": escape_markup(nDisks),
                                                 "size": escape_markup(totalReclaimable)}
             self._reclaimable_label.set_markup(text)
Comment 1 Vit Ry 2015-08-25 11:07:28 EDT
Created attachment 1066900 [details]
Patch to fix a bug
Comment 3 David Shea 2015-08-25 13:20:40 EDT
Thanks for the report. The change in your patch is already in git  (https://github.com/rhinstaller/anaconda/blob/rhel7-branch/pyanaconda/ui/gui/spokes/lib/resize.py#L231), so this bug will be fixed in the next version of RHEL 7.

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