You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The was reported by freaky.ashes on Discord - thanks to them for flagging it.
To reproduce:
Create a Spin app with an asset directory mount (e.g. files = [{ source = "assets", destination = "/" }])
Run it on Windows
You get a "couldn't resolve \assets<component>" error for the component asset directory, because the assets directory didn't get created
This happens because of a conflict between canonicalisation and the glob crate: when a glob is prefixed with a canonical (UNC) path, it does not match any files. (And asset directories get created only when files exist to be copied into them.) To reproduce this, create this Rust app:
use std::path::PathBuf;fnmain(){println!("Using plain dir");let bp = PathBuf::from(env!("CARGO_MANIFEST_DIR"));let paths = glob::glob(bp.join("src/**/*").to_str().unwrap()).unwrap();for path in paths {println!("{path:?}");}println!("Using canonicalised dir");let bp = PathBuf::from(env!("CARGO_MANIFEST_DIR")).canonicalize().unwrap();let paths = glob::glob(bp.join("src/**/*").to_str().unwrap()).unwrap();for path in paths {println!("{path:?}");}}
It prints something like
Using plain dir
Ok("D:\\Code Experiments\\globtest\\src\\main.rs")
Using canonicalised dir
This breaks directory mounts on Spin 2 because we canonicalise the source path, and use <source-path>/**/* to implement directory copying. I assume it also breaks glob mounts too but have not tested that case.
This is a known bug in the upstream glob crate: rust-lang/glob#132. The issue suggests a workaround which, although unsafe for general use, should be fine for us. Alternatively it might suffice to absolutise rather than canonicalise. The issue is 6 months old and there's no movement on it so we should not expect a fix from upstream.
The text was updated successfully, but these errors were encountered:
This also affects wildcard globs, but not single-file patterns. If you have a mix that contains a single-file pattern, the app runs but the files from wildcards and directory mounts are not there, only the single files.
The was reported by freaky.ashes on Discord - thanks to them for flagging it.
To reproduce:
files = [{ source = "assets", destination = "/" }]
)This happens because of a conflict between canonicalisation and the glob crate: when a glob is prefixed with a canonical (UNC) path, it does not match any files. (And asset directories get created only when files exist to be copied into them.) To reproduce this, create this Rust app:
It prints something like
This breaks directory mounts on Spin 2 because we canonicalise the source path, and use
<source-path>/**/*
to implement directory copying. I assume it also breaks glob mounts too but have not tested that case.This is a known bug in the upstream glob crate: rust-lang/glob#132. The issue suggests a workaround which, although unsafe for general use, should be fine for us. Alternatively it might suffice to absolutise rather than canonicalise. The issue is 6 months old and there's no movement on it so we should not expect a fix from upstream.
The text was updated successfully, but these errors were encountered: