You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2016/05/29 22:40:41 UTC

[Issue 126990] New: File saved normally then opened and filled with #

https://bz.apache.org/ooo/show_bug.cgi?id=126990

          Issue ID: 126990
        Issue Type: DEFECT
           Summary: File saved normally then opened and filled with #
           Product: Writer
           Version: 4.1.2
          Hardware: PC
                OS: Windows 8, 8.1
            Status: UNCONFIRMED
          Severity: Critical
          Priority: P5 (lowest)
         Component: help
          Assignee: issues@openoffice.apache.org
          Reporter: tinaconroy0718@gmail.com

I saved a file not 2 hours ago and when I opened it again the format was wrong
and all my text was #. The whole document just #########. This has happened
before. I do not want to rewrite it all again. Is there a way to recover the
text I had before?

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #5 from Tania Valladares <tl...@gmail.com> ---
 I am trying to recover a document in which the text has been replaced with #.
It is extremely important. Can you try to see the document as I understand
there's nothing I can do at this point. Can anyone try to retrieve it if I
bring it in somewhere? Thank you. You should really put a warning  on the
Apache open office website. I've lost a lot of material that is very valuable
to me.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

John <jo...@yahoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.ha24@yahoo.co.uk

--- Comment #2 from John <jo...@yahoo.co.uk> ---
Created attachment 85563
  --> https://bz.apache.org/ooo/attachment.cgi?id=85563&action=edit
An example .odt file which opens as "full of ######"

This file is taken from
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532&start=420#p372812.

Notes:

1  It is a .odt file, but it is not a zip file, and it has no internal
structure (no content.xml, manifest.rdf etc).

2  When the file is opened with a Hex editor, it is 27,605 Bytes, and each byte
is zero.

3  When the file is opened by Writer, Writer assumes it must be a flat, ASCII
TEXT file.  Writer brings up the ASCII Filter Options pop-up.  The document
then appears with 9,999 x "#" as word 1, a paragraph return; 9,999 x "#" as
word 2, a paragraph return, and the remaining "#" as word 3. Presumably Writer
has a 9,999 character limit on a word and adds the paragraph return.

4  The fault seems to have the characteristics of Writer reserving some space,
naming that space postcol literature II.odt, setting the space to all zeros ...
and then failing to write the correct data to the file.  The file content is
therefore all zeros.  Does this occur because Writer was somehow prevented from
completing the write?  Could shutting a laptop lid too quickly cause this?

5  There are numerous issues relating to saving files across networks, where
the slow speed of the network highlights problems.  See Issue 107558 - A hidden
step while writing OOo files? which reports that AOO continues to do saving
AFTER the bar stops moving across the bottom of the screen.  Could it be that
users think that the save is completed when the bar stops moving, and slam the
laptop lid shut, whereas the save has not completed?

See also Issue 104661 - Saving to file should take place in a process
independent of the GUI 

Some form of atomic save is needed where the save can be guaranteed.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

jeffooo <je...@orange.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jeffooo@orange.fr

--- Comment #27 from jeffooo <je...@orange.fr> ---
Thanks for fix this issue.

Can you set "target milestone" for this issue ?

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #14 from John <jo...@yahoo.co.uk> ---
Also, for someone with programming skills, a simple test would probably be

1.  Add an infinite loop a few lines after line 52 so that AOO loops during the
file write

2.  Wait until AOO is looping during the file write

3.  Issue a shutdown by closing the laptop lid.

Expected behaviour.  AOO will prevent the shutdown because the file has not
been written

Probable behaviour.  AOO will not attempt to prevent the shutdown

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #6 from John <jo...@yahoo.co.uk> ---
I am sorry but there is nothing which can be done because the file is full of
zeros - there is (literally) nothing in it.  For some reason the file was not
saved. Search the forum with #### and you will find a number of posts.

See
[url=https://forum.openoffice.org/en/forum/viewtopic.php?f=71&t=85038][Tutorial]
How to find and un-delete Writer temporary files[/url] for instructions on how
to identify and un-delete the temporary files Writer wrote while you were
editing the file, and then deleted.  You should be able to recover all or most
of the file.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

Tania Valladares <tl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tl.valladares53@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #13 from John <jo...@yahoo.co.uk> ---
Also, for someone with programming skills, a simple test would probably be

1.  Add an infinite loop a few lines after line 52 so that AOO loops during the
file write

2.  Issue a shutdown by closing the laptop lid.

Expected behaviour.  AOO will prevent the shutdown because the file has not
been written

Probable behaviour.  AOO will not attempt to prevent the shutdown

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

orcmid <or...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|orcmid@apache.org           |

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #8 from John <jo...@yahoo.co.uk> ---
Yes.  There are hundreds and hundreds of cases on the forum.

I strongly suspect that the problem arises when AOO mishandles a hibernate or
sleep interrupt when it is in the process of saving a file.

I further suspect that the time at which the interrupt arrives is critical - at
some times it is handled at others it is not. 

I did some testing for Patricia about two years ago which seemed to support
this suggestion.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

oooforum (fr) <oo...@free.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |oooforum@free.fr

--- Comment #7 from oooforum (fr) <oo...@free.fr> ---
This issue must be maintained opened?
We know that #### content is equal to a lost document.
The problem is to reproduce the process which corrupt a file.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

Peter <pe...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CONFIRMED                   |ACCEPTED

--- Comment #17 from Peter <pe...@apache.org> ---
After all the years i am on a fix. yay.
I try to get it in the next release.

Test plan:
1 Functional:
These exercise the paths the change touches or deliberately routes around:

a) Save existing doc (the fixed path) — Writer, Calc, Impress
b) Save As to a new name — non-overwrite branch, must be unchanged
c) Save to a network share and a USB stick — the sibling must land on that
volume, not %TEMP%. This is the case that would silently lose atomicity if the
sibling logic is wrong; check in ProcMon that the temp is created on the target
volume
d) Save with the doc open in another process holding a handle → should still
save via fallback, and the trace should fire. This is the intended graceful
degradation
e) Password-protected document
f) Large document (perf sanity — you accepted the cost, but worth knowing the
number)
g) Linux, if you test there: symlinked document → must take the fallback and
leave the symlink intact
2. The actual crash test
VM with a snapshot, so it's repeatable. Run it against an unfixed build first —
if you can't reproduce the bug, the harness proves nothing.

a) Save a document.
b) Within ~1-2 s, hard-kill: notmyfault64.exe /crash, or the hypervisor's Reset
(not a clean shutdown — that flushes).
Boot, hex-dump the file.
c) Unfixed: expect all-zeros on some fraction of trials — it's a race, so run
it several times. Fixed: never zeros; you get either the previous document or
the new one.

I currently cant do the VM, my laptop does not have the free space for that.
Linux build is currently difficult too.
I do not own a large document, but maybe i can produce one. (lots of pictures)
I will note when the patch lands.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #4 from John <jo...@yahoo.co.uk> ---
Created attachment 85564
  --> https://bz.apache.org/ooo/attachment.cgi?id=85564&action=edit
Some examples of damaged files - all zeros, garbage and a mixture

See the forum post 22 page term paper replaced with pound signs which is at
https://forum.openoffice.org/en/forum/viewtopic.php?f=6&t=17677#p81363.  You
will see well over 200 cases of "My document is all #####" reports, many with
uploaded damaged files.  I have identified a few below:

These reports have each uploaded files which are full of zeros:

1.  Retrieving document at
https://forum.openoffice.org/en/forum/viewtopic.php?f=6&t=17690
2.  File now contains nothing but # characters at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=18573
3.  Character Set issue opening an .ODT document at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=23463
4.  Problem with file at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=25534
5.  .odt corrupted at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=25838
There are many more ...

These reports have each uploaded a damaged file:

1.  Re: ASCII Filter? Help me save my doc!!! at
https://forum.openoffice.org/en/forum/viewtopic.php?f=6&t=25503#p265546  The
file appears to be a valid .odt when you unzip it, but the file is damaged

2. Re: 22 pages term paper replaced with pound signs at
https://forum.openoffice.org/en/forum/viewtopic.php?f=6&t=17677&start=30#p275921
points to a file at http://www.mediafire.com/download/x75pb ... s_copy.ods
which is partially full of zeros and partially full of garbage.
There are many more ...

See the forum post [Hint] How did I fix my ODT file at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532 (viewed 140,000
times) which has many, many corrupted files which have been uploaded.  Many
have been analysed by forum posters.  

A small collection include:

1 Re: [Hint] How did I fix my ODT file at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532&start=390#p372337
uploaded a file clinical opthalmolog1.odt which appears to be a valid odt file,
but is full of zeros after FF0 (4,080) bytes.  Is the 2^n significant?

2 Re: [Hint] How did I fix my ODT file at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532&start=420#p372836
has upl;oaded $R67BQ9D.odt which starts with readable text which looks like a
Firefox crash report, then is full of zeros, then has binary data and then ends
with zeros.

3 Re: [Hint] How did I fix my ODT file at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532&start=330#p354771
Both dz.odt and mc.t.odt start off looking like a valid PK zip files, but then
just end - the files are corrupted.

4 Re: [Hint] How did I fix my ODT file at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532&start=330#p357120
uploaded the water door.odt.  The file is full of garbage - it looks like a
dump of memory.

I have uploaded a ZIP file with examples of these damaged files.

There are also many reports, with uploaded files, where the file is perfect ...
but the XML tags in content.xml are incorrect.  acknak is often able to correct
the XML errors manually and thus recover the file.  For example, see
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532&start=360#p357769
for currupted tags, which refers to Issue 126219: invalid xml on saving
document with comment/annotation

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #22 from Peter <pe...@apache.org> ---
Nice to read from you John.

What's happening, in plain terms
When you save, the bytes don't go straight onto the disk. Windows keeps them in
memory for a while and writes them out when convenient — usually within a few
seconds, sometimes much longer if the machine is busy. That part is normal and
every program lives with it.

Two things made it destructive here.

AOO told you the save had succeeded while the data was still only in memory. It
never asked the operating system to actually commit it to the disk. So the
progress bar finished, the document looked saved, and you carried on — but if
the machine lost power or froze in the next few seconds, those bytes never
landed.

Worse, AOO erased your existing document before writing the new one. It emptied
the file to zero length first, then streamed the new version into it. So during
the save there was a moment when your old document was already gone and the new
one wasn't on disk yet. That is why people lose a 22-page paper rather than
just the last ten minutes of edits — the previously saved content was deleted
as the first step.

What you're left with is a file of the right size whose contents were never
written. The file system records "this file is 27,605 bytes" but the data was
only ever in memory. Windows deliberately reads unwritten areas back as zeros,
so you get a file full of nothing. It isn't a zip archive any more, so AOO
doesn't recognise it as a document, falls back to treating it as plain text,
and shows the ASCII import dialog — and zero bytes display as #.

What we changed
AOO now waits for the disk. The save isn't reported as successful until the
operating system confirms the data is physically written. If that confirmation
fails, you get a save error instead of a false success.

AOO no longer deletes your document to save it. The new version is written next
to the old one under a temporary name, confirmed onto the disk, and only then
swapped into place in a single step the file system cannot leave half-finished.
If anything interrupts at any point, your previous document is untouched.

The practical effect: a completed save can no longer turn into a zero-filled
file, and a crash during a save now costs you at most that one save instead of
the whole document. Saves may be marginally slower, because waiting for the
disk takes real time. That was a deliberate trade.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

Peter <pe...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ACCEPTED                    |RESOLVED

--- Comment #26 from Peter <pe...@apache.org> ---
Issue has been tested and committed to trunk.
see commit 210da5364ee5715a5b2c0345cd5580a3bfc88049

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #3 from orcmid <or...@apache.org> ---
(In reply to John from comment #2)
> Created attachment 85563 [details]
> An example .odt file which opens as "full of ######"
> 
> This file is taken from
> https://forum.openoffice.org/en/forum/viewtopic.
> php?f=7&t=1532&start=420#p372812.
> 
> Notes:
> 
> 1  It is a .odt file, but it is not a zip file, and it has no internal
> structure (no content.xml, manifest.rdf etc).
> 
> 2  When the file is opened with a Hex editor, it is 27,605 Bytes, and each
> byte is zero.
> 
> 3  When the file is opened by Writer, Writer assumes it must be a flat,
> ASCII TEXT file.  Writer brings up the ASCII Filter Options pop-up.  The
> document then appears with 9,999 x "#" as word 1, a paragraph return; 9,999
> x "#" as word 2, a paragraph return, and the remaining "#" as word 3.
> Presumably Writer has a 9,999 character limit on a word and adds the
> paragraph return.
[ ... ]

I confirm the behavior with the example file.  The particular file triggers the
plaintext filter.  If the file is opened, it will be presented as paragraphs
having runs of "#" characters.  (I assume, in this case, the hex 00 bytes are
interpreted as unknown or inadmissable characters and "#" is used to indicate
them.)

I confirm that the file consists of 27,605 null (hex 00) bytes.

What we need to know from Tina, who has had this experience more than once, is 

 1. When a previously-saved file was opened for further work, and it showed as
all "####", did the plaintext filter show up first?  Did she click OK and then
see the all "#" document?

 2. What can Tina report about the conditions under which the document was
saved and later failed to open correctly?

 3. Can Tina upload an attachment of the file that opened that way for her,
exactly as it was when she tried to open it (not after accepting the plaintext
filter).

And, either way, Tina's document will not be recoverable.  But the evidence she
can provide may help us to eliminate or mitigate what the cause might be.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #11 from oooforum (fr) <oo...@free.fr> ---
(In reply to John from comment #9)
> where I suggest the NULLs are written in
> Line 52 of DEFLATOR.  
If you have programming skill, you can submit a PR on Github with this fix:
https://github.com/apache/openoffice

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

Peter <pe...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|Normal                      |Critical
                 CC|                            |petko@apache.org

--- Comment #10 from Peter <pe...@apache.org> ---
I set the Importance to critical, since we have to look into this.
This issue has been the "Most Valued Bug" for some time now. And we should not
forget to solve it.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #21 from John <jo...@yahoo.co.uk> ---
When I was researching the problem I found another program (Notepad++ or
another editor??) which was suffering the same #### problem.  The resolution
proposed was to stop buffering the write.

LO does not seem to have the #### problem.  Has LO swapped to a direct, instead
of a buffered, write?

I am the John who posted many times above in this bug report.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #12 from John <jo...@yahoo.co.uk> ---
Unfortunately I don't have sufficient programming skills :-(

I recently assisted a user with a corrupted .ods file which I think resulted
from the same "shut down before writing is completed" cause.  

In his case (see
https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=103810#p502547) he
had lots of graphs and they were all missing.  Unzipping the .ods showed that
the Object 1 through Object 189 folders were present, so were content.xml.
manifest.rdf, meta.xml, mimetype and styles.xml.  However, folders
Configurations-2, META-INF, ObjectReplacements and Thumbnails were missing.

It would support my theory if the missing folders were written after that data
which was written. 

The file is 2MB so I cannot upload it here but it is still available in the
forum thread.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

orcmid <or...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|help                        |save-export
             Status|UNCONFIRMED                 |CONFIRMED
                 CC|                            |orcmid@apache.org
     Ever confirmed|0                           |1

--- Comment #1 from orcmid <or...@apache.org> ---
(In reply to tinaconroy0718 from comment #0)
> I saved a file not 2 hours ago and when I opened it again the format was
> wrong and all my text was #. The whole document just #########. This has
> happened before. I do not want to rewrite it all again. Is there a way to
> recover the text I had before?

Generally, no.

When this happens, however it happens, that is really the content of the file
and that is all there is.

The best precaution is to not save over the previous copy but save with a new
name (put a date in the name or use a sequence number).  Then you at least can
fall back to the one you made the failed one from.  This precaution works for a
number of other problems as well.

If you want, you can upload the file as an attachment here, and we can inspect
it to confirm whether there is recoverable content.

This is the first of the cases identified in Issue 126846.

I am extracting the essential information here so we have an identified issue
for this individual case.  I failed to find an existing separate issue about
it.

"Hagar Delest has carefully listed the posts where users have lost data at 22
pages term paper replaced with pound signs, where he has collected over two
hundred (224 to date) cases."  That is at
https://forum.openoffice.org/en/forum/viewtopic.php?f=6&t=17677

The forum topic includes some cases beside the "#" case.  This issue is for
tracking the "#" issue only.

-- 
You are receiving this mail because:
You are the assignee for the issue.

Re: [Issue 126990] File saved normally then opened and filled with #

Posted by Rory O'Farrell <of...@iol.ie>.
I'm unable at present to send the message below to issues@openoffice.apache.org, so I sent it to this list instead, for general information

Rory

On Sun, 02 Aug 2026 06:46:11 +0000
bugzilla@apache.org wrote:

> https://bz.apache.org/ooo/show_bug.cgi?id=126990
> 
> --- Comment #24 from John <jo...@yahoo.co.uk> ---
> Peter
> 
> Thank you for your explanation and for fixing this horrible bug.
> 
> The idea that the #### were caused by the user slamming the laptop lid shut was
> given to me by Rory O'Farrell, another Forum volunteer, so I make no claim for
> it!  Rory's idea did however prompt me to investigate it further.

At the time he looked into this, John also investigated the occasional loss of pictures in both Writer and Impress, in which the pictures were unexplainedly replaced by blank boxes. This occurred on both Windows and Linux installs.  Then LibreOffice expended a large sum (Euro 55,000, from memory) on fixing both problems - the XXXX and the picture loss, and the easy solution was to suggest a transfer to that program.

I found a fix that worked for me using OpenOffice. which I prefer and still use, on Xubuntu linux: this was to disable the "Always create a backup copy" and "Save AutoRecovery every x minutes", both settable in /Tools /Options Load-Save: General; I have used this fix in approximately the past 15-20 years without loss of pictures, mostly while preparing Impress presentations.  I cannot say, and do not know, if my workaround (above) will work on Windows.

I suspect that when the "Save Autorecovery..." routine cuts in, there is some problem with preservation of the state of the system - a stack problem? - and the links to the pictures get lost.  But I am not a programmer (experience only with Fortan 2 in 1965, and Z80 assembler in 1979), and do not offer this as a definitive analysis.

With these options disabled, the responsibility lies on the User to make regular timed/dated backups, which experience shows most users will not do.

Rory


 
> As an aside, I worked in IT for many years and when I started volunteering for
> the Forum, I was somewhat surprised by the almost complete disconnect between
> the Forum, where user problems are raised; and Development, where problems are
> chosen to be fixed.  In my experience, there needs to be a very close link
> between Forum and Development so that the problems the users report are fixed. 
> Very few users come here to report their problems - they go instead to the
> Forum.
> 
> -- 
> You are receiving this mail because:
> You are the assignee for the issue.

-- 
Rory O'Farrell <of...@iol.ie>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org


[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #24 from John <jo...@yahoo.co.uk> ---
Peter

Thank you for your explanation and for fixing this horrible bug.

The idea that the #### were caused by the user slamming the laptop lid shut was
given to me by Rory O'Farrell, another Forum volunteer, so I make no claim for
it!  Rory's idea did however prompt me to investigate it further.

As an aside, I worked in IT for many years and when I started volunteering for
the Forum, I was somewhat surprised by the almost complete disconnect between
the Forum, where user problems are raised; and Development, where problems are
chosen to be fixed.  In my experience, there needs to be a very close link
between Forum and Development so that the problems the users report are fixed. 
Very few users come here to report their problems - they go instead to the
Forum.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #23 from Peter <pe...@apache.org> ---
Added a pull request for this issue:
https://github.com/apache/openoffice/pull/493

Thanks John for all the analysis. I think you got pretty close. Your analysis
was awesome. :)

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #25 from Peter <pe...@apache.org> ---
I plan to build a test version of this bug. 
@Jon would you help to check if this issue is now solved?

I plan to use the win10 64 test builds. The solution can be backported, but for
now i think a first review would be great.
All the best
peter

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

Peter <pe...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.17

--- Comment #28 from Peter <pe...@apache.org> ---
target milestone is 4.1.17, the next upcomming release

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #9 from John <jo...@yahoo.co.uk> ---
As

a) this bug is confirmed, 
b) there are hundreds of reports of it in the forum,
c) it causes complete data loss and nothing can be recovered from the file (the
# are displayed because the file is full of NULL characters)

I think it should be classified as CRITICAL.

See
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532&start=660#p479545
where I suggest the NULLs are written in Line 52 of DEFLATOR.  If the PC issues
a SHUTDOWN after line 52 and AOO does not prevent the shutdown, then the file
would presumably be full of NULLs.

44    Deflater::~Deflater(void)
45    {
46            end(); 
47    }
48    void Deflater::init (sal_Int32 nLevelArg, sal_Int32 nStrategyArg,
sal_Bool bNowrap)
49    {
50            pStream = new z_stream;
51            /* Memset it to 0...sets zalloc/zfree/opaque to NULL */
52            memset (pStream, 0, sizeof(*pStream));
53    
54            switch (deflateInit2(pStream, nLevelArg, Z_DEFLATED, bNowrap?
-MAX_WBITS : MAX_WBITS,

See Why is my file full of #####? at
https://forum.openoffice.org/en/forum/viewtopic.php?f=71&t=85038#p493247 for a
discussion.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #16 from John <jo...@yahoo.co.uk> ---
See "Text in document transformed to #####" at
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=104676#p507553 where
a user describes exactly what happened to cause a .odt file to become full of
#####.

> The piece of writing that I have lost is an OpenDocument Text [ie a .odt file].
>
> I opened it and had been working on it for few hours, saving it 
> every 10 minutes or so, when my computer froze and showed a grey screen.
> As this hadn't shifted despite my best efforts I had to do a forced shut
> down after about half an hour.
> 
> When I restarted the computer it was all fine apart from the document
> I had open on the screen where the text had been replaced by ######
> 
> [ie - when AOO opened ...\fred.odt, the file displayed as #####
> which means ...\fred.odt was a flat file (not a ZIP container) full
> of null characters.  Inspection of ...\fred.odt uploaded to the forum
> shows fred.odt is full of null characters 

As I understand it, when AOO edits fred.odt:

1.  AOO copies ...\fred.odt to a temporary file in ...\Temp.  

2.  AOO marks ...\fred.odt as "in use".  If I send ...\fred.odt to 7-ZIP I get
a 7-ZIP error message "The process cannot access the file it is being used by
another process".  However, I can copy the file and I can send the file to
Notepad++ where it opens.

3. All user changes are held in memory until the file is saved.  ...\fred.odt
is thus never touched until a Save is done.

4.  When a Save is done, ...\fred.odt is saved as a proper .odt file.

As the user saved the document I would expect ...\fred.odt to be a proper .odt
file containing the document exactly as it was when the document being edited
was last saved. 

So why is ...\fred.odt a flat file full of nulls when the PC is restarted? 

Could it be that AOO was writing a Save when the PC froze - indeed, AOO
probably caused the freeze.  In this case, I would expect ...\fred.odt to be as
it was when the PC froze and this is why it is full of nulls.

So, is there a stage during the file write process when ...\fred.odt is set to
be full of nulls?  Or some Windows process that kicks in as a freeze happens
which fills the file full of nulls?

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #15 from John <jo...@yahoo.co.uk> ---
See Comment 46 in Issue 126869 - Analysis Task: Lost/Corrupted Documents after
Save/Shutdown where I shut down the PC (Start > Power > Shutdown) a few seconds
after the green bar had finished crossing the screen.  The file was still being
written (I used a slow diskette drive) and AOO did not prevent the shutdown as
expected.

See Comment 48 in Issue 126869 where I issued the shutdown as soon as possible
after the green bar had finished crossing the screen (ie a few seconds
earlier).  AOO now prevented the shutdown taking place and the shutdown screen
offered a pop-up with "fred.odt is open in AOO - do you want to cancel?" and I
was able to prevent shutdown. When I cancelled shutdown AOO was displaying a
"Do you want to save your changes?" pop-up.    

Conclusion:  AOO mishandles? ignores? a Windows interrupt saying the PC is
being shutdown.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #18 from Peter <pe...@apache.org> ---
here is the Description what the fix contains:

## Fix plan (in order of value)

1. **Stop truncating the original in place.** `docfile.cxx:1858-1860` is the
actual
   data-loss primitive. Replace with: write temp **in the target directory** →
sync →
   `osl_moveFile` over the target. A crash then leaves the *old* file intact —
never a
   zero-filled one. This eliminates the entire class, including the power-cut
case that
   no amount of shutdown handling can catch. Must preserve what the current
code path
   gets right: file attributes/permissions of the original, the `SID_OVERWRITE`
/
   `SID_RENAME` semantics, and the backup-on-failure restore.
2. **Sync before reporting success** — `osl_syncFile` before the `close()` at
   `shell.cxx:1914`. Ordering matters: sync the data *then* rename. This costs
real
   wall-clock on every save, so it likely wants to be scoped to the
document-commit
   path rather than imposed on every UCB write; measure before committing to
placement.
3. **Sync the backup too**, and keep it until the *next* successful save rather
than
   deleting it in `ClearBackup_Impl`.

Ordering note: (1) and (2) are **not independent — (2) is a prerequisite for
(1).**
Implemented in that order for that reason. The atomic rename in (1) is only
meaningful
if the sibling it renames is already on the medium; without (2) it would swap
in a file
whose data is still in the page cache, and the same crash would still yield
zeros —
just under a different filename. Neither is complete alone: (2) without (1)
leaves the
crash-during-save window, (1) without (2) is not durable at all.

What (2) alone does and does not buy:
- **Closes the reported signature.** Success is no longer reported until the
bytes are
  durable, so a completed save can no longer turn into zeros in a later crash.
It also
  removes the false "save succeeded" signal, which is what makes the current
bug so
  destructive — users acted on it.
- **Residual window: a crash *during* the save**, between the truncate at
  `docfile.cxx:1858` and the sync completing. That yields a truncated or
partially-zero
  file, not the classic "full size, all zeros". The window shrinks from
  *write + page-cache writeback delay* (seconds, sometimes much longer under
memory
  pressure) to *write duration only* (milliseconds locally; still seconds on a
slow
  share). Only (1) makes that window non-destructive.

Performance: (2) syncs on **every** UCB file write, not just document saves —
config
writes and extension installs included. That is a deliberate call (correctness
first,
2026-07-27); revisit scoping after the fix is out, and keep trunk and AOO41X
identical
rather than shipping a narrowed variant to one of them.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #19 from Peter <pe...@apache.org> ---
ok, my smoke test was to save on windows a new small document.
tested on ntfs, usb drive.
I used following to simulate an interfearance:
opened the cdb debugger
setup the debugger:
bu KERNELBASE!MoveFileExW ".echo >>> MoveFileExW; du @rcx; du @rdx; r r8; gc"
bu KERNELBASE!FlushFileBuffers ".echo >>> FlushFileBuffers; gc"
bc 0
bu KERNELBASE!MoveFileExW ".echo >>> MoveFileExW; du @rcx; du @rdx; gu; .echo  
 ret:; r rax; gc"
g

then create the testthis.odt document in writer:


# separate PowerShell window, with testthis.odt already open in AOO
PS C:\workspace\openoffice> $p = "C:\path\to\Document\testthis.odt"
PS C:\workspace\openoffice> $f = [System.IO.File]::Open($p, 'Open', 'Read',
'ReadWrite')
PS C:\workspace\openoffice> # now save in AOO, then:
PS C:\workspace\openoffice> $f.Close()

now you see somethin like (annonymized pathes ;)):
(7c50.34a0): C++ EH exception - code e06d7363 (first chance)
>>> FlushFileBuffers
>>> FlushFileBuffers
>>> MoveFileExW
00000000`104e7910  "C:\path\to\Document\testthi"
00000000`104e7950  "s1.odt"
00000000`104e7d90  "C:\path\to\Document\testthi"
00000000`104e7dd0  "s.odt"
rax=0000000000000000
>>> FlushFileBuffers
(7c50.34a0): C++ EH exception - code e06d7363 (first chance)
(7c50.34a0): C++ EH exception - code e06d7363 (first chance)
(7c50.34a0): C++ EH exception - code e06d7363 (first chance)
>>> MoveFileExW
00000000`115b77f0  "C:\temp\ooo_doc\user\7154.tmp"
00000000`0cd89d30  "C:\temp\ooo_doc\user\registrymod"
00000000`0cd89d70  "ifications.xcu"
rax=0000000000000001
(7c50.34a0): C++ EH exception - code e06d7363 (first chance)

fix looks good to me. preparing commit.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

--- Comment #20 from John <jo...@yahoo.co.uk> ---
I used to help on the forum where I had about 10,000 posts as John_Ha

I am pretty certain that a file full of ##### is caused by OO buffering the
WRITE,  The sequence of events is

1  User saves file.
2  File is written to buffer
3. User shuts down PC (typically slams the laptop lid shut) BEFORE buffer has
been written to disk
4. The file is full of #####. 

See the Writer [Tutorial] How to find and un-delete AOO/LO temporary files
which has Why is my Writer file full of #####? at
https://forum.openoffice.org/en/forum/viewtopic.php?p=493247#p493247 which
includes:

Secondly, no-one has yet identified the precise reason for how this corruption
occurs. It is strongly suspected that files with ##### are created when the PC
hangs, crashes, suffers a power cut, or is powered off before it has flushed
its buffers to disk. AOO has successfully written the file to the buffer in
memory, but the PC crash prevents the buffer contents being written to disk.
There can be a delay of several seconds - I have seen five or more seconds
reported - before the buffer starts to be written to disk.

Despite the file having a .odt or .ods or ,odp etc qualifier, a file full of
#### is not a properly formed .od* ZIP file. Instead, it is a flat ASCII text
file which is full of null characters. When such a file is opened by AOO/LO, it
opens in Writer and the user is asked which ASCII Filter should be applied.
This is because AOO/LO sees it is a flat ASCII text file and AOO/LO Writer
needs to be told what characters to expect in the file.

-- 
You are receiving this mail because:
You are the assignee for the issue.

[Issue 126990] File saved normally then opened and filled with #

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126990

Czesław Wolański <cz...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |czeslaw.wolanski@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the issue.