Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 640778 - sys-apps/portage: linux_ro_checker can return wrong path when multiple mounts use the same device
Summary: sys-apps/portage: linux_ro_checker can return wrong path when multiple mounts...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-11 22:59 UTC by Zac Medico
Modified: 2017-12-11 22:59 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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