BurntSushi / same-file

Cross platform Rust library for checking whether two file paths are the same file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with this crate over samba.

sbstp opened this issue · comments

I have a samba share mounted with cifs-utils. I'm doing some file operations in the share and it is not case insensitive, which is fine. However, it seems like it uses virtual inode numbers because the Handles have different numbers. Here's a sample of the issue:

Handle { file: Some(File { fd: 3, path: "GoodFellas (1990)", read: true, write: false }), is_std: false, dev: 46, ino: 10248 }
Handle { file: Some(File { fd: 3, path: "Goodfellas (1990)", read: true, write: false }), is_std: false, dev: 46, ino: 11984 }

Only the "GoodFellas (1990)" directory exists, but both uppercase and lowercase paths work to access it. But they report different inode numbers, which makes this library report a false negative.

I'm not really sure if anything can be done about this...

Yeah, I'm not sure there is anything to be done here. We could add a note in the documentation. Is there any other file attribute that would tip off an incorrect result here? If so, this crate could notice it and report an error or something to at least make this failure mode discoverable.

I asked on the cifs-utils mailing list and it's probably a bug when detecting if the client supports case insensitivity, setting case sensitive = yes on the server fixes the issue, the wrongly-cased path returns file not found now. So this library is fine.