From 03e37210271b050878ca693caf1bff11f625c244 Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Tue, 1 Apr 2014 21:41:37 -0700 Subject: [PATCH] portage/util/writeable_check.py: Reverse order of RO check (bug 505428) The read only check is falsely detecting readonly filesystems while in the chroot. Reversing the search order should solve the problem. --- pym/portage/util/writeable_check.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pym/portage/util/writeable_check.py b/pym/portage/util/writeable_check.py index e6ddce6..470382d 100644 --- a/pym/portage/util/writeable_check.py +++ b/pym/portage/util/writeable_check.py @@ -46,13 +46,14 @@ def linux_ro_checker(dir_list): ro_filesystems = set() try: + roregex = re.compile(r'(\A|,)ro(\Z|,)') with io.open("/proc/mounts", mode='r', encoding=_encodings['content'], errors='replace') as f: - roregex = re.compile(r'(\A|,)ro(\Z|,)') - for line in f: - if roregex.search(line.split(" ")[3].strip()) is not None: - romount = line.split(" ")[1].strip() - ro_filesystems.add(romount) + lines = [s.replace('\n', '') for s in f.readlines()] + for line in lines.reverse(): + if roregex.search(line.split(" ")[3].strip()) is not None: + romount = line.split(" ")[1].strip() + ro_filesystems.add(romount) # If /proc/mounts can't be read, assume that there are no RO # filesystems and return. -- 1.8.5.3