@@ -3514,6 +3514,22 @@ static PSID get_current_user_sid(void)
3514
3514
return result ;
3515
3515
}
3516
3516
3517
+ static int acls_supported (const char * path )
3518
+ {
3519
+ size_t offset = offset_1st_component (path );
3520
+ WCHAR wroot [MAX_PATH ];
3521
+ DWORD file_system_flags ;
3522
+
3523
+ if (offset &&
3524
+ xutftowcs_path_ex (wroot , path , MAX_PATH , offset ,
3525
+ MAX_PATH , 0 ) > 0 &&
3526
+ GetVolumeInformationW (wroot , NULL , 0 , NULL , NULL ,
3527
+ & file_system_flags , NULL , 0 ))
3528
+ return !!(file_system_flags & FILE_PERSISTENT_ACLS );
3529
+
3530
+ return 0 ;
3531
+ }
3532
+
3517
3533
int is_path_owned_by_current_sid (const char * path )
3518
3534
{
3519
3535
WCHAR wpath [MAX_PATH ];
@@ -3569,7 +3585,14 @@ int is_path_owned_by_current_sid(const char *path)
3569
3585
* okay, too.
3570
3586
*/
3571
3587
result = 1 ;
3572
- else if (git_env_bool ("GIT_TEST_DEBUG_UNSAFE_DIRECTORIES" , 0 )) {
3588
+ else if (IsWellKnownSid (sid , WinWorldSid ) &&
3589
+ git_env_bool ("GIT_TEST_DEBUG_UNSAFE_DIRECTORIES" , 0 ) &&
3590
+ !acls_supported (path )) {
3591
+ /*
3592
+ * On FAT32 volumes, ownership is not actually recorded.
3593
+ */
3594
+ warning ("'%s' is on a file system that does not record ownership" , path );
3595
+ } else if (git_env_bool ("GIT_TEST_DEBUG_UNSAFE_DIRECTORIES" , 0 )) {
3573
3596
LPSTR str1 , str2 , to_free1 = NULL , to_free2 = NULL ;
3574
3597
3575
3598
if (ConvertSidToStringSidA (sid , & str1 ))
0 commit comments