Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 640778

Summary: sys-apps/portage: linux_ro_checker can return wrong path when multiple mounts use the same device
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: CoreAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---

Description Zac Medico gentoo-dev 2017-12-11 22:59:15 UTC
I noticed this problem on a system that has the same nfs device mounted in multiple locations. In this case linux_ro_checker complained about one of the *other* mountpoints referencing the same device, rather than the one that was passed in the dir_list argument.

The problem code is in this code where the first loop can select paths that are not members of dir_list, since is only accounts for a single path per device:

	ro_devs = {}
	for x in ro_filesystems:
		try:
			ro_devs[os.stat(x).st_dev] = x
		except OSError:
			pass

	ro_filesystems.clear()
	for x in set(dir_list):
		try:
			dev = os.stat(x).st_dev
		except OSError:
			pass
		else:
			try:
				ro_filesystems.add(ro_devs[dev])
			except KeyError:
				pass