commit:     a000c492b9f12a43b75c2613323e29a472732259
Author:     Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 16 10:47:22 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 22:13:18 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a000c492

writeable_check: add additional checks to mountinfo parsing function

 pym/portage/util/writeable_check.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/pym/portage/util/writeable_check.py 
b/pym/portage/util/writeable_check.py
index b698ea1..26fe199 100644
--- a/pym/portage/util/writeable_check.py
+++ b/pym/portage/util/writeable_check.py
@@ -57,14 +57,22 @@ def linux_ro_checker(dir_list):
                                # there can be a variable number of fields
                                # to the left of the ' - ', after the attr's, 
so split it there
                                mount = line.split(' - ', 1)
-                               _dir, attr1 = mount[0].split()[4:6]
+                               try:
+                                       _dir, attr1 = mount[0].split()[4:6]
+                               except ValueError:
+                                       # If it raises ValueError we can simply 
ignore the line.
+                                       continue
                                # check for situation with invalid entries for 
/home and /root in /proc/self/mountinfo
                                # root path is missing sometimes on WSL
                                # for example: 16 1 0:16 / /root rw,noatime - 
lxfs  rw
-                               try:
-                                       attr2 = mount[1].split()[2]
-                               except IndexError:
-                                       attr2 = mount[1].split()[1]
+                               if len(mount) > 1:
+                                       try:
+                                               attr2 = mount[1].split()[2]
+                                       except IndexError:
+                                               try:
+                                                       attr2 = 
mount[1].split()[1]
+                                               except IndexError:
+                                                       attr2 = mount[1]
                                if attr1.startswith('ro') or 
attr2.startswith('ro'):
                                        ro_filesystems.add(_dir)
 

Reply via email to