Skip to content

Commit

Permalink
Merge pull request #4117 from wasmerio/fix-for-inheritance
Browse files Browse the repository at this point in the history
Fixed an issue where inheritance was inverted
  • Loading branch information
Michael Bryan authored Aug 2, 2023
2 parents ec0a7ef + 9eb0add commit a3f4dbe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 2 additions & 0 deletions lib/wasix/src/runtime/resolver/outputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,7 @@ pub struct ResolvedPackage {
pub commands: BTreeMap<String, ItemLocation>,
pub entrypoint: Option<String>,
/// A mapping from paths to the volumes that should be mounted there.
/// Note: mappings at the start of the list obscure mappings at the end of the list
/// thus this list represents an inheritance tree
pub filesystem: Vec<ResolvedFileSystemMapping>,
}
18 changes: 7 additions & 11 deletions lib/wasix/src/runtime/resolver/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,7 @@ fn resolve_package(dependency_graph: &DependencyGraph) -> Result<ResolvedPackage
}
}

// Note: when resolving filesystem mappings, the first mapping will come
// from the root package and its dependencies will be following. However, we
// actually want things closer to the root package in the dependency tree to
// come later so they override their dependencies.
filesystem.reverse();
tracing::debug!("resolved filesystem: {:?}", &filesystem);

Ok(ResolvedPackage {
root_package: dependency_graph.root_info().id(),
Expand Down Expand Up @@ -1166,10 +1162,10 @@ mod tests {
pkg.filesystem,
vec![
ResolvedFileSystemMapping {
mount_path: PathBuf::from("/usr/local/lib/first"),
mount_path: PathBuf::from("/root"),
original_path: "/root".to_string(),
volume_name: "atom".to_string(),
original_path: "/usr/local/lib/first".to_string(),
package: builder.get("first", "1.0.0").package_id(),
package: builder.get("root", "1.0.0").package_id(),
},
ResolvedFileSystemMapping {
mount_path: PathBuf::from("/usr/local/lib/second"),
Expand All @@ -1178,10 +1174,10 @@ mod tests {
package: builder.get("second", "1.0.0").package_id(),
},
ResolvedFileSystemMapping {
mount_path: PathBuf::from("/root"),
original_path: "/root".to_string(),
mount_path: PathBuf::from("/usr/local/lib/first"),
volume_name: "atom".to_string(),
package: builder.get("root", "1.0.0").package_id(),
original_path: "/usr/local/lib/first".to_string(),
package: builder.get("first", "1.0.0").package_id(),
}
]
);
Expand Down
3 changes: 0 additions & 3 deletions lib/wasix/src/runtime/resolver/wapm_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ impl WapmSource {
%response.status,
%response.redirected,
?response.headers,
response.body=String::from_utf8_lossy(&body).as_ref(),
"Received a response from GraphQL",
);

Expand Down Expand Up @@ -146,8 +145,6 @@ impl Source for WapmSource {
let mut archived_versions = Vec::new();

for pkg_version in versions {
tracing::trace!(?pkg_version, "Checking a package version");

let version = match Version::parse(&pkg_version.version) {
Ok(v) => v,
Err(e) => {
Expand Down

0 comments on commit a3f4dbe

Please sign in to comment.