packit / rpms / anaconda

Forked from rpms/anaconda 2 years ago
Clone

Files

Blob Blame History Raw
From 5ffa3a3ec37d28618bce1a8650e89d3dad51eb85 Mon Sep 17 00:00:00 2001
From: Vendula Poncova <vponcova@redhat.com>
Date: Mon, 13 May 2019 11:28:08 +0200
Subject: [PATCH] Parse the output of df correctly (#1708701)

Split each line only once and in the rightmost way to get a mount
point and a number of available blocks. The mount point can contain
white spaces.

Example of the output:

Mounted on          Avail
/tmp/My Volume    1234567

Resolves: rhbz#1708701
---
 pyanaconda/payload/dnfpayload.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/pyanaconda/payload/dnfpayload.py b/pyanaconda/payload/dnfpayload.py
index 40ca6f72b7..af32ef43c6 100644
--- a/pyanaconda/payload/dnfpayload.py
+++ b/pyanaconda/payload/dnfpayload.py
@@ -103,9 +103,7 @@ def _df_map():
     lines = output.splitlines()
     structured = {}
     for line in lines:
-        items = line.split()
-        key = items[0]
-        val = items[1]
+        key, val = line.rsplit(maxsplit=1)
         if not key.startswith('/'):
             continue
         structured[key] = Size(int(val) * 1024)