From ff60304966e1f7d062d23fc0c2567517891469af Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Tue, 15 Sep 2026 23:19:33 -0400 Subject: [PATCH] Avoid unlink/rename when replacing regular files on Android Android's September 2026 security patches [0] changed the MediaProvider behavior so that it revokes app permissions on unlink and rename within its FUSE filesystem, which is used for both internal storage (/sdcard) and external storage (SD cards and USB drives). For rename, permissions for both paths are revoked as it does: revoke destination -> rename -> revoke source. Unfortunately, this means it is now impossible to keep app permissions to files in a shared folder while performing atomic file replacement. This commit works around the problem by performing in-place overwrites when replacing regular files. This essentially forces the use of the fallback path of osutil.RenameOrCopy() when the destination is on a FUSE filesystem on Android. The statfs magic check is sufficient since the only FUSE filesystem openable by path on Android is MediaProvider's. [0] https://android.googlesource.com/platform/packages/providers/MediaProvider/+/91dddac65b6ef48ae54302fa852029c2fcf010aa Signed-off-by: Andrew Gunnerson --- external/syncthing | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/syncthing b/external/syncthing index 14a0bfc..668fe24 160000 --- a/external/syncthing +++ b/external/syncthing @@ -1 +1 @@ -Subproject commit 14a0bfc1daa33dcea493afb58cedc6647cadf93c +Subproject commit 668fe245a4ccb97231a534dad85737d4a9e2e1f4