Skip to content
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

Different feature.fs.mapping behaviour in different hooks #3095

Open
t4lz opened this issue Feb 15, 2025 · 1 comment
Open

Different feature.fs.mapping behaviour in different hooks #3095

t4lz opened this issue Feb 15, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@t4lz
Copy link
Member

t4lz commented Feb 15, 2025

For example in read_link (and in some other hooks)

pub(crate) fn read_link(path: Detour<PathBuf>) -> Detour<ReadLinkFileResponse> {
let path = remap_path!(path?);
check_relative_paths!(path);

We first remap the path, then we check if the mapped path is relative. However in open (and some other hooks):

pub(crate) fn open(path: Detour<PathBuf>, open_options: OpenOptionsInternal) -> Detour<RawFd> {
let path = path?;
check_relative_paths!(path);
let path = remap_path!(path);

If it's a relative path, we bypass before mapping the path.

We should make sure all detours have the same mapping logic.

The docs match the second case (ignore relative before mapping), so I assume this is the correct behaviour.

/// - Relative paths: this feature (currently) does not apply mappings to relative paths, e.g.
/// `../dev`.

In most fs hooks, the three macros check_relative_paths!, remap_path! and ensure_not_ignored! should be called, so we should maybe just have a macro/function that calls them all in the right order.

@t4lz t4lz added the bug Something isn't working label Feb 15, 2025
Copy link

linear bot commented Feb 15, 2025

@Razz4780 Razz4780 self-assigned this Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants