-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using the same cache key across multiple jobs can cause issues if we make assumption about it's content (like installing tools if not hit on the cache).
- Loading branch information
1 parent
d675c07
commit 4458fee
Showing
2 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# MacOS Rename Issue | ||
|
||
I've create a MemFS with `fuser` and I'm having issue with the rename operation on MacOS (using [email protected]) where the rename request is provided with empty filenames: | ||
|
||
```shell | ||
touch bar | ||
mv bar zar | ||
``` | ||
|
||
Result in the following Request log: | ||
|
||
```txt | ||
FUSE( 4) ino 0x00..01 RENAME src FilenameDir { dir: Inode(1), name: "" }, dest FilenameDir { dir: Inode(1), name: "" } | ||
``` | ||
|
||
I've added a log that dump the content of `data` before it's decoded into the Rename Request: | ||
|
||
```txt | ||
Parsing opcode FUSE_RENAME, data: AQAAAAAAAAAAAAAAAAAAAGJhcgB6YXIA | ||
``` | ||
|
||
By decoding the data, we get: | ||
|
||
```shell | ||
$ echo AQAAAAAAAAAAAAAAAAAAAGJhcgB6YXIA | base64 --decode | xxd | ||
00000000: 0100 0000 0000 0000 0000 0000 0000 0000 ................ | ||
00000010: 6261 7200 7a61 7200 bar.zar. | ||
``` | ||
|
||
So we have the filenames that are provided, that mean the issue is during the parsing of the low-level request from macFuse. | ||
`fuser` define the Rename request like so: | ||
|
||
```rust | ||
#[derive(Debug)] | ||
pub struct Rename<'a> { | ||
header: &'a fuse_in_header, | ||
arg: &'a fuse_rename_in, | ||
name: &'a Path, | ||
newname: &'a Path, | ||
} | ||
``` | ||
|
||
> [`Rename`](https://github.com/cberner/fuser/blob/424bbcaa30a586a6dc99b5019f5e9b9f7755a31f/src/ll/request.rs#L581-L587) | ||
```rust | ||
#[repr(C)] | ||
#[derive(Debug, FromBytes, FromZeroes)] | ||
pub struct fuse_rename_in { | ||
pub newdir: u64, | ||
} | ||
``` | ||
|
||
> [`fuse_rename_in`](https://github.com/cberner/fuser/blob/v0.14.0/src/ll/fuse_abi.rs#L584-L588) | ||
Parsing the provided data by MacFuse result in: | ||
|
||
```rst | ||
+---------------------+------------+---------------+------------------------------------+ | ||
| Rename | | ||
+=====================+============+===============+====================================+ | ||
| fuse_rename_in | | | ||
+---------------------+------------+---------------+------------------------------------+ | ||
| newdir: u64 | name: Path | newname: Path | _unused_ | | ||
+---------------------+------------+---------------+------------------------------------+ | ||
| 0100 0000 0000 0000 | 00 | 00 | 0000 0000 0000 6261 7200 7a61 7200 | | ||
+---------------------+------------+---------------+------------------------------------+ | ||
``` | ||
|
||
`fuse_rename_in` is defined as the following on MacFuse: | ||
|
||
```c | ||
struct fuse_rename_in { | ||
__u64 newdir; | ||
#ifdef __APPLE__ | ||
__u32 flags; | ||
__u32 padding; | ||
#endif | ||
}; | ||
``` | ||
|
||
> [`fuse_rename_in`](https://github.com/osxfuse/fuse/blob/6f7322893456f6ff9db145f096b9bfc2ba95d627/include/fuse_kernel.h#L446-L452) | ||
If we map the data received, everything seems to _click into place_: | ||
|
||
```rst | ||
+---------------------+------------+--------------+------------+---------------+ | ||
| Rename | | ||
+=====================+============+==============+============+===============+ | ||
| fuse_rename_in | | | ||
+---------------------+------------+--------------+------------+---------------+ | ||
| newdir: u64 | flags: u32 | padding: u32 | name: Path | newname: Path | | ||
+---------------------+------------+--------------+------------+---------------+ | ||
| 0100 0000 0000 0000 | 0000 0000 | 0000 0000 | 6261 7200 | 7a61 7200 | | ||
+---------------------+------------+--------------+------------+---------------+ | ||
``` |