You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The procedures in POSIX.File_Locking don't properly lock the whole file when Whole_File is True. They look up the file's current size with POSIX.IO.File_Size, and then call fcntl to lock that many bytes. This does not work when another process appends to the file concurrently. Even if the file doesn't grow between the calls to File_Size and fcntl, locking only the file's current size doesn't prevent another process from locking a region past the end and appending to the file.
Locks may start and extend beyond the current end of a file, but
shall not extend before the beginning of the file. A lock shall
be set to extend to the largest possible value of the file offset
for that file by setting l_len to 0. If such a lock also has
l_start set to 0 and l_whence is set to SEEK_SET, the whole file
shall be locked.
Replace all three calls to File_Size in posix-file_locking.adb with zero, like this: Blady-Com/florist@7fdcc75
The text was updated successfully, but these errors were encountered:
The procedures in POSIX.File_Locking don't properly lock the whole file when Whole_File is True. They look up the file's current size with POSIX.IO.File_Size, and then call fcntl to lock that many bytes. This does not work when another process appends to the file concurrently. Even if the file doesn't grow between the calls to File_Size and fcntl, locking only the file's current size doesn't prevent another process from locking a region past the end and appending to the file.
Quoting the POSIX Programmer's Manual at https://man7.org/linux/man-pages/man3/fcntl.3p.html:
Replace all three calls to File_Size in posix-file_locking.adb with zero, like this:
Blady-Com/florist@7fdcc75
The text was updated successfully, but these errors were encountered: