#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)
Change History (7)
comment:1 by , 9 years ago
comment:3 by , 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 , 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 , 9 years ago
Milestone: | → 2.1.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Thanks for the explanations. Applied in trunk r30082
I'd appreciat if you could add explicit parenthesis in the following expression "FILE_GENERIC_READ | FILE_GENERIC_WRITE FILE_WRITE_DATA;"