finder – MacOS mounted SMB share is not directly aware of new files?


I was absolutely pulling my hair out on what I thought was a bug in my code, where it kept telling me a file did not exist, even though just a second ago my code created that file successfully.

However after some (a lot) of fiddling around, I’ve figured out that for some reason MacOS 15.0.1 does some weird kind of write-cache, or at least is not aware of changes to the files throughout the whole OS.

I don’t think I’ve ever seen something like this before, and it’s 100% reproducible.

% touch test; mv test test2
mv: rename test to test2: Input/output error

Ok so what if I manually run it as two commands?

% touch test
% mv test test2
mv: rename test to test2: Input/output error

Still no luck. Ok what if I make the file, explicitly do a directly listing to “verify” if it exists, what would that do?

% touch test
% ls -l 
-rwx------  1 isa  staff     0 Nov  9 00:33 test
% mv test test2
% ls -l 
-rwx------  1 isa  staff     0 Nov  9 00:33 test2

Heck! It works. This is 100% consistently reproducible

I’ve tried adding sleep 5 in between the commands but that also does not resolve the issue.

This share is mounted through Finder, and I otherwise have full read/write rights over it. Doing these tests as root does not change the outcome, it’s not a permissions issue.


Question: How do I stop this behaviour, and make my SMB mount behave like a regular local folder?



Source link

Related Posts

About The Author

Add Comment