-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filesystem watching crashes with symlinks pointing outside the asset folder #5689
Comments
I'm not sure we should be loading assets behind symlinks, at least by default. |
That is for Bevy developers to decide; but I could see that sometimes symlinking some assets would be a helpful thing to do. (You might not want to store everything under your code repository, for example.) But it would be nice if at least instead of crashing, it would do something nicer about it. I'm not very well-versed in Bevy's logging and error reporting facilities, but maybe some warning about not being able to load it? |
Okay, learned new stuff about this! I made a simple test program with Now, since |
Then there's the problem that even though directory walking didn't follow symlinks, the users can still provide paths to |
#5705 Is an attempt to fix this by at least providing consistent behaviour that "fails fast" but not unexpectedly instead of sometimes working and sometimes not, creating confusion and possibly making downstream to rely on buggy behaviour. |
Bevy version
0.8.0
What you did
I have a symlink pointing to a directory containing some assets, that was located outside of Bevy's assets directory.
What went wrong
As I modify a file in this directory, Bevy panics here: https://github.com/bevyengine/bevy/blob/main/crates/bevy_asset/src/io/file_asset_io.rs#L191 with
StripPrefixError
.Additional information
My attempt to debug this problem showed that (at least on macOS 12.5) the
notify
crate which Bevy uses for filesystem watching, returns an event with asset path/Users/kon/repos/bomberman-of-the-hill/rounds/1/1.wasm
(the absolute path of the asset, after having followed the symlink) as a response to modifying this asset, whereasasset_io.root_path
is set to/Users/kon/repos/bomberman-of-the-hill/crates/bomber_game/assets/
. As you can see from this Playground snippet, this produces aStripPrefixError
: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e4662b33f004e4f1a1f7d226a5dbe6c8An interesting twist is that the asset would be reachable via path
/Users/kon/repos/bomberman-of-the-hill/crates/bomber_game/assets/rounds/1/1.wasm
and Bevy actually finds and uses this path when using the normal loading functions ofAssetServer
instead of filesystem watching. Of course, Bevy doesn't realize that the assets with differing paths are actually the same.The text was updated successfully, but these errors were encountered: