File 0001-server-debug-sharing-violation.patch of Package wine
From 2fd071cfc25aae51c7fc5dcc7c6c8d923215e78e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Fri, 2 Jan 2026 19:44:22 +0100
Subject: [PATCH] server: debug sharing violation
---
server/fd.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/server/fd.c b/server/fd.c
index f70bec354a3..f226df44b72 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1629,22 +1629,33 @@ static unsigned int check_sharing( struct fd *fd, unsigned int access, unsigned
fd->access = access;
fd->sharing = sharing;
+ fprintf(stderr, "check_sharing: %s %x %x\n", fd->unix_name, access, sharing);
LIST_FOR_EACH_ENTRY( fd_ptr, &fd->inode->open, struct fd, inode_entry )
{
if (fd_ptr == fd) continue;
/* if access mode is 0, sharing mode is ignored */
- if (fd_ptr->access & all_access) existing_sharing &= fd_ptr->sharing;
+ fprintf(stderr, " %x %x\n", fd_ptr->access, fd_ptr->sharing);
+ if (fd_ptr->access & all_access) {
+ existing_sharing &= fd_ptr->sharing;
+ }
existing_access |= fd_ptr->access;
}
+ fprintf(stderr, "check_sharing: %s -> %x %x\n", fd->unix_name, existing_access, existing_sharing);
if (((access & read_access) && !(existing_sharing & FILE_SHARE_READ)) ||
((access & write_access) && !(existing_sharing & FILE_SHARE_WRITE)) ||
((access & DELETE) && !(existing_sharing & FILE_SHARE_DELETE)))
+ {
+ fprintf(stderr, "SHARING_VIOLATION 1\n");
return STATUS_SHARING_VIOLATION;
+ }
if (((existing_access & FILE_MAPPING_WRITE) && !(sharing & FILE_SHARE_WRITE)) ||
((existing_access & FILE_MAPPING_IMAGE) && (access & FILE_WRITE_DATA)))
+ {
+ fprintf(stderr, "SHARING_VIOLATION 2\n");
return STATUS_SHARING_VIOLATION;
+ }
if ((existing_access & FILE_MAPPING_IMAGE) && (options & FILE_DELETE_ON_CLOSE))
return STATUS_CANNOT_DELETE;
if ((existing_access & FILE_MAPPING_ACCESS) && (open_flags & O_TRUNC))
@@ -1654,7 +1665,10 @@ static unsigned int check_sharing( struct fd *fd, unsigned int access, unsigned
if (((existing_access & read_access) && !(sharing & FILE_SHARE_READ)) ||
((existing_access & write_access) && !(sharing & FILE_SHARE_WRITE)) ||
((existing_access & DELETE) && !(sharing & FILE_SHARE_DELETE)))
+ {
+ fprintf(stderr, "SHARING_VIOLATION 3\n");
return STATUS_SHARING_VIOLATION;
+ }
return 0;
}
--
2.52.0