From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DCB4C138330 for ; Sun, 18 Sep 2016 22:26:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 01772E0914; Sun, 18 Sep 2016 22:26:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B0ECCE0914 for ; Sun, 18 Sep 2016 22:26:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 47B4B340A9D for ; Sun, 18 Sep 2016 22:26:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 33FF8247E for ; Sun, 18 Sep 2016 22:26:28 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1474236798.a000c492b9f12a43b75c2613323e29a472732259.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/writeable_check.py X-VCS-Directories: pym/portage/util/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: a000c492b9f12a43b75c2613323e29a472732259 X-VCS-Branch: master Date: Sun, 18 Sep 2016 22:26:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 051e015c-4227-47fa-bade-7a6834e61ecd X-Archives-Hash: c7be214633fbd1bf961e6203956c8725 commit: a000c492b9f12a43b75c2613323e29a472732259 Author: Mikhail Pukhlikov gentoo org> AuthorDate: Fri Sep 16 10:47:22 2016 +0000 Commit: Zac Medico gentoo 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)