When file truncation happens by Basic's Open statement

Takeshi Abe tabe at fixedpoint.jp
Fri Dec 21 17:37:15 UTC 2018


Hi,

In order to tell whether the behavior reported in tdf#119102 [1] is a bug
or not, I would like to understand the specification of LibO Basic's Open
statement [2].

The following table summarizes what current (master) LibO does, which I read
from SbiStream::Open() in basic/source/runtime/iosys.cxx.

      ACCESS\FOR      | APPEND | BINARY | INPUT | OUTPUT | RANDOM |
----------------------+--------+--------+-------+--------+--------+
       default        |   -    |   -    |   -   |   X    |   -    |
 READ  ("read only")  |   -    |   -    |   -   |   -    |   -    |
 WRITE ("write only") |   -    |  -(*)  |   X   |   X    |  -(**) |
 READ WRITE ("both")  |   -    |  -(*)  |   X   |   X    |  -(**) |

"X": the runtime deletes the file of given path first if already exists;
"-": it does not.
(*)  requested in i#18638 <https://bz.apache.org/ooo/show_bug.cgi?id=18638>;
     see commit 23b49669ab70cac72d5f6d955e7d2af617e6934e.
(**) requested in i#61277 <https://bz.apache.org/ooo/show_bug.cgi?id=61277>;
     see commit 42a63dd0e81f13a84a5f551e03ede685e2bf34c7.

So here is a couple of questions popping up on a confused soul:

(1) What does the default ACCESS mode mean?
Is it just the same as READ, WRITE, or READ WRITE?
Or does it depends on given FOR mode?

(2) Does 'FOR INPUT + ACCESS WRITE' or 'FOR OUTPUT + ACCESS READ' make
any sense?

Thank you for your attention.

[1] https://bugs.documentfoundation.org/show_bug.cgi?id=119102
[2] https://help.libreoffice.org/Basic/Open_Statement_Runtime

Cheers,
-- Takeshi Abe


More information about the LibreOffice mailing list