[Libreoffice-bugs] [Bug 119102] New: BASIC OPEN FOR BINARY does not delete existing file

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sun Aug 5 05:40:01 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=119102

            Bug ID: 119102
           Summary: BASIC OPEN FOR BINARY does not delete existing file
           Product: LibreOffice
           Version: 5.4.3.2 release
          Hardware: All
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: jmichael_ll at yahoo.com

Description:
     In a BASIC macro, 
OPEN path FOR BINARY AS #fnum
does not delete any existing file and create a fresh file.
     Pitonyak's guide to LibreOffice Macros indicates that the behavior with
respect to deleting an existing file and creating a new file should be
identical to that of
OPEN path FOR OUTPUT AS #fnum
     I find that OPEN FOR OUTPUT *does* delete any existing file.  (Or at
least, it truncates the existing file to zero length.)
     When the file exists, and is larger than what I am writing after OPEN FOR
BINARY, the resultant file is what I wrote in BINARY, followed by what's left
of the original file; i.e., it appears that the beginning of the file was
overwritten, but the CLOSE did not leave the end of the data in the file as the
last thing I just wrote.

Steps to Reproduce:
1. Copy a file to "x.txt"
2. Write a macro in LibreOffice that opens "x.txt" FOR BINARY, writes a few
bytes, and closes.
3. Run the macro
4. Check the file to see if there is anything past the few bytes written by the
macro.

Actual Results:
newoldoldold

Expected Results:
new


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: StartModule
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: yes

Version: 5.4.3.2 (x64)
Build ID: 92a7159f7e4af62137622921e809f8546db437e5
CPU threads: 4; OS: Windows 6.19; UI render: default; 
Locale: en-US (en_US); Calc: group

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20180805/1525d48c/attachment-0001.html>


More information about the Libreoffice-bugs mailing list