On Sun, May 17, 2026 at 05:35:32PM +1000, Seth McDonald wrote:
When dry running, mbsync should not be altering the filesystem by
creating directories.  However, mkdir() and mkdir_p() were being called
on both dry and non-dry runs, creating directories in both situations.

Ensure mkdir_p() instead just calls mkdir_p_check() on dry runs.
mkdir_p_check() attempts to determine whether mkdir_p() would succeed or
fail and returns appropriately, thereby simulating a call to mkdir_p()
without modifying the filesystem.

Where appropriate, reroute any calls to mkdir() to mkdir_p() so that the
simulated directory creation is also used at those calls.  With
'appropriate' meaning the parent directory of the wanted new directory
is expected to exist prior to the call.

this looks fundamentally reasonable. however,
- it seems unnecessary to check the write permission. dry run doesn't need to ensure that a real run would actually succeed. such a check is inherently racy anyway, as hypothetically the situation on the ground could change in between. - opening the directory and the subsequent faccessat() seem rather over-engineered to me. a simple access() would be good enough in this situation. - once simplified, it should be possible to just have a single conditional in mkdir_p() instead of branching out to a whole separate call chain.



_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to