Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6065 closed defect (fixed)

VSIL append mode not correct in windows

Reported by: Lucian Plesea Owned by: warmerdam
Priority: normal Milestone: 2.1.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

The existing code makes append the same as write, other than seeking to the end of the file on open. See patch for cpl_vsil_win32.cpp with corrected code.

Attachments (1)

cpl_vsil_win32.patch (806 bytes ) - added by Lucian Plesea 9 years ago.
Patch for port/cpl_vsil_win32.cpp

Download all attachments as: .zip

Change History (7)

comment:1 by Even Rouault, 9 years ago

I'd appreciat if you could add explicit parenthesis in the following expression "FILE_GENERIC_READ | FILE_GENERIC_WRITE FILE_WRITE_DATA;"

by Lucian Plesea, 9 years ago

Attachment: cpl_vsil_win32.patch added

Patch for port/cpl_vsil_win32.cpp

comment:2 by Lucian Plesea, 9 years ago

Here you go!

comment:3 by Even Rouault, 9 years ago

Hum actually looking closer, I don't understand in which situations the patch is necessary. Could you explain a bit more ?

Or is it just to be more POSIX compliant ?

Were there cases where this caused problems in practice ?

I guess there are other /vsi modules where append mode is just implemented as initial seeking. Actually I just now realize that append mode seems to prohibit writing at other places that end even after explicit seeking...

comment:4 by Lucian Plesea, 9 years ago

Append mode is not just an initial seek, far from it. It guarantees that the content sent to a file does not gets overwritten, regardless of how many processes use it in append mode at the same time. Without append mode, content may be overwritten. There is also an "a+" mode, that lets you mix random seeks and reads with writes at the end of the file. The classic use is logging from multiple processes.

It doesn't apply to in most /vsi modules other than the ones backed by a real file system.

comment:5 by Even Rouault, 9 years ago

Milestone: 2.1.0
Resolution: fixed
Status: newclosed

Thanks for the explanations. Applied in trunk r30082

comment:6 by Even Rouault, 9 years ago

trunk r30083 "Fix runtime on Wine < 1.7.4 for file append mode (trunk only, follow up of r30082, #6065)"

Note: See TracTickets for help on using tickets.