Fix handling of shared roots Upstream-commit: f98a596be9eda121c6a9d5eef53d3d38849d9b56 Component: engine