Apache OpenOffice (AOO) Bugzilla – Issue 22745
XSimpleFileAccess::openFileWrite() not truncating
Last modified: 2017-05-20 11:29:36 UTC
(There's no "documentation" subcomponent for "ucb"...) It is not documented that XSimpleFileAccess::openFileWrite() does not truncate the file. There's no API which atomically opens and truncates a file (using kill() has race conditions and can be desastrous for directories).
Yes, I agree that this is at least a documentation issue (if not even a request for an improved implementation).
Hi Andreas, can you please have a look into this (and at least improve the documentation, if not the implementation)? Thanks, Matthias
AB: Accepted as documentation issue. I think the implementation must not be changed, because code may already rely on the current behaviour. Besides, the statement "There's no API which atomically opens truncates a file" is not true. Everyone is free to use UCB API directly. The SimpleFileAccess service is - as its name says - only a simple wrapper for convenience.
So, everyone who wants to create/truncate a file has to reinvent the wheel? If that's the policy, why have XSimpleFileAccess in the first place? Using the UCB for such a simple operation as creating/truncating a file is overkill -- it's much simpler to wrap a C FILE in an XOutputStream. Why not add createTruncateFile() to, say, XSimpleFileAccess4?
According to the roadmap of OpenOffice.org 2.0 (http://tools.openoffice.org/releases/q-concept.html) this issue has been scheduled for 3.0.
s. above
cp: retargeted to Office-Later due to limited ressources
Reset assigne to the default "issues@openoffice.apache.org".