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

fix(subvol): make cmds work with relative paths #293

Conversation

tmuehlbacher
Copy link

Path::parent() returns Some("") for relative paths with a single component. The simplest fix is to just canonicalize the paths first.

So I actually had a few misconceptions about this issue, at first I thought it
was because I was doing bcachefs subvolume create my-subvol within a bind
mount because it worked when I gave the absolute path from the real mount. Then
I thought it was about CString lifetime in FFI, which was also incorrect.

In the end it's pretty simple. The Path::parent() API doesn't take into
account any side effects from the file system or check the real path. It just
works on the bytes of the Path and gives us a slice into the Path.

`Path::parent()` returns `Some("")` for relative paths with a single
component. The simplest fix is to just canonicalize the paths first.

Signed-off-by: Thomas Mühlbacher <[email protected]>
@koverstreet koverstreet merged commit c2354f0 into koverstreet:master Jun 9, 2024
1 check passed
@tmuehlbacher tmuehlbacher deleted the fix-subvolume-commands-with-relative-paths branch June 9, 2024 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants