Page 23 of 23

Re: [Hint] How did I fix my ODT file

Posted: Thu Jul 25, 2019 2:27 pm
by RoryOF
Depending on a lot of things, the first thing to try is to make (on a working machine) a bootable linux USB key; if the broken computer has a functioning motherboard, it may then be booted from the linux USB key and the files in question copied to another USB key. If that does not work because the motherboard is broken, the next step is to remove the hard disk and put it in a working desktop.

Re: [Hint] How did I fix my ODT file

Posted: Thu Jul 25, 2019 3:03 pm
by John_Ha
tazzy1981 wrote:Can anyone help me fix these files and maybe tell me how, so if I find more files I can reconstruct them myself?
I have never before seen a file like your two files.

They are not .xls or .xlsx files - they are flat ASCII files but strangely they are full of the " U " character so they cannot contain any user information, not even in encrypted form. I cannot understand how AOO could have created these files. When opened in a Hex editor the both look like this:
Clipboard01.png
You could see [Tutorial] How to find and un-delete AOO temporary files for detailed instructions on how to

a) use Previous Versions (W7 and later) to recover previous versions of the file (is there something similar on MacOS and Linux?);

b) recover your file as it was when you last opened or saved it, or as it was when it was last saved with AutoRecovery;

c) find previous versions of the file in the folder it is located in, but which have since been deleted;

d) un-delete the temporary files AOO wrote while you were editing the file, and then deleted. This will recover your file as it was when you last opened or you last saved it.

All .odt, .doc, .docx, .xls and .xlsx files are actually ZIP files and can be unzipped. For example this is what a .odt file looks like when unzipped:
Clipboard02.png
You should ask someone with good computer skills to analyse all the files on the disk. Some files and/or folders may be set to Hidden in which case you need to make them visible by Start > Control Panel > Folder options > View > Advanced settings ..., where you tick Show hidden files and folders.

Re: [Hint] How did I fix my ODT file

Posted: Thu Jul 25, 2019 3:30 pm
by RoryOF
I confirm what John_Ha says: they are both flat files full of U's. They suggest to me that a hard disk failure occurred, and that a recovery program tried to clean the damaged area of the hard disk, but this is only a guess.

Re: [Hint] How did I fix my ODT file

Posted: Thu Oct 03, 2019 4:05 pm
by Mic90
Hello! can someone here help me fix this file? same READ ERROR, I will be forever grateful as I worked on tis essay for the past 5 hours before loosing it all.

Re: [Hint] How did I fix my ODT file

Posted: Thu Oct 03, 2019 4:21 pm
by floris v
@Mic90: there is no need to post twice, and certainly if you do it, post a link to your other topic to prevent that the discussion splits over several threads and that people waste their time. Thank you.
 Edit: viewtopic.php?f=5&t=99550 
Solution offered there.

Re: [Hint] How did I fix my ODT file

Posted: Thu Oct 03, 2019 5:52 pm
by RoryOF
Please check the attached file and ensure content and formatting are as you require.

Re: [Hint] How did I fix my ODT file

Posted: Thu Oct 10, 2019 2:03 pm
by Medivh
Hello,

new here, I found this page after a long desperate search and trying for hours with recovery etc. Got a file prepared in June, now finally need it but it seems corrupted.

Not sure if I'm right here with this file, and I understand if nothing can be done, but I would appreciate if someone could give it a shot.
Sorry , had to attach it as a rar. since its 5mb so exceeds the limitation. (Lots of inserted pictures, but if only the text can be recovered I'm just fine)


Any help appreciated!

Re: [Hint] How did I fix my ODT file

Posted: Thu Oct 10, 2019 4:03 pm
by RoryOF
A quick examination suggests that your file is completely corrupt. Wait for confirmation from another before panicking.

Re: [Hint] How did I fix my ODT file

Posted: Thu Oct 10, 2019 4:16 pm
by Zizi64
I cannot open neither the unpacked .ods file, nor unpack the zip archive of the ODF fileformat...

Re: [Hint] How did I fix my ODT file

Posted: Thu Oct 10, 2019 6:34 pm
by F3K Total
Medivh wrote:Sorry , had to attach it as a rar. since its 5mb so exceeds the limitation. (Lots of inserted pictures, but if only the text can be recovered I'm just fine)
That does not meat the file you loaded up:
C1.PNG
C1.PNG (2.75 KiB) Viewed 192898 times
it's 411 Bytes, not 5 Megabytes, means 1/12756 of the filesize expected. Even rar will never compress something by a factor of 12756!!!
R

Re: [Hint] How did I fix my ODT file

Posted: Thu Oct 10, 2019 7:02 pm
by John_Ha
In fact your 411 byte RAR file is a compression of NewStoryboardEtc.ods which is 5.11 MBytes. The file is full of NUL characters which is why it compresses so well. There is no user data in your file.
Clipboard01.png
See [Tutorial] How to find and un-delete AOO temporary files for detailed instructions on how to

a) use Previous Versions (W7 and later) to recover previous versions of the file (is there something similar on MacOS and Linux?);

b) recover your file as it was when you last opened or saved it, or as it was when it was last saved with AutoRecovery;

c) find previous versions of the file in the folder it is located in, but which have since been deleted;

d) un-delete the temporary files AOO wrote while you were editing the file, and then deleted. This will recover your file as it was when you last opened or you last saved it.

Re: [Hint] How did I fix my ODT file

Posted: Fri Oct 11, 2019 12:38 am
by Medivh
Thank you everyone for trying.

I was already surprised that the file compressed down t only about 400 byte rar file.
Thank you John for posting the Link, I tried the said guide before as well.

Can't be helped. But I apppreaciate the input, thank you all!

Re: [Hint] How did I fix my ODT file

Posted: Wed Oct 16, 2019 3:03 pm
by John_Ha
Keme gave me an idea at Re: one of Calc file broken and RoryOF found me the source.

While I have no serious coding experience I think the NULLs we see in broken .odt files are probably written by a routine called Deflater.cxx in the package bit of AOO which writes files at [Apache-SVN]/openoffice/trunk/main/package/source/package/zipapi/Deflater.cxx. The source is as below. Deflater is the routine which Zips the file.

Note that line 52 appears to set something (the memory for the file? the disk space to be used for the file?) to zeros or NULLs. I think these are the NULLs we see in the broken .odt files. Line 51 is a comment explaining that NULLs are about to be written.

Code: Select all

51 	        /* Memset it to 0...sets zalloc/zfree/opaque to NULL */
52 	        memset (pStream, 0, sizeof(*pStream));
My hypothesis is therefore that AOO executes line 52 and the NULLs are written. Then, at some point after line 52 is executed, but before the data is written, AOO receives a shutdown? hibernate? command from Windows because the user closes the laptop lid. Normally, AOO would execute a graceful shutdown/hibernate where AOO would prevent the shutdown/hibernate until all data had been written and the AOO program had reached a stable place at which it could safely be paused. However, I suspect that AOO mishandles this shutdown/hibernate command and does not do a graceful shutdown instead allowing the shutdown to happen before AOO has finished writing the file and made AOO safe. The file is therefore full of nulls.

I have done some testing where I have found that AOO does slightly different things depending on when a laptop lid is closed which supports my suspicion.

Code: Select all

/**************************************************************
2 	 * 
3 	 * Licensed to the Apache Software Foundation (ASF) under one
4 	 * or more contributor license agreements.  See the NOTICE file
5 	 * distributed with this work for additional information
6 	 * regarding copyright ownership.  The ASF licenses this file
7 	 * to you under the Apache License, Version 2.0 (the
8 	 * "License"); you may not use this file except in compliance
9 	 * with the License.  You may obtain a copy of the License at
10 	 * 
11 	 *   http://www.apache.org/licenses/LICENSE-2.0
12 	 * 
13 	 * Unless required by applicable law or agreed to in writing,
14 	 * software distributed under the License is distributed on an
15 	 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 	 * KIND, either express or implied.  See the License for the
17 	 * specific language governing permissions and limitations
18 	 * under the License.
19 	 * 
20 	 *************************************************************/
21 	
22 	
23 	
24 	// MARKER(update_precomp.py): autogen include statement, do not remove
25 	#include "precompiled_package.hxx"
26 	#include <Deflater.hxx>
27 	#ifndef _ZLIB_H
28 	#ifdef SYSTEM_ZLIB
29 	#include <zlib.h>
30 	#else
31 	#include <external/zlib/zlib.h>
32 	#endif
33 	#endif
34 	#include <com/sun/star/packages/zip/ZipConstants.hpp>
35 	#include <string.h> // for memset
36 	
37 	using namespace com::sun::star::packages::zip::ZipConstants;
38 	using namespace com::sun::star;
39 	
40 	/** Provides general purpose compression using the ZLIB compression
41 	 * library.
42 	 */
43 	
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,
55 	                                DEF_MEM_LEVEL, nStrategyArg))
56 	        {
57 	                case Z_OK:
58 	                        break;
59 	                case Z_MEM_ERROR:
60 	                        delete pStream;
61 	                        break;
62 	                case Z_STREAM_ERROR:
63 	                        delete pStream;
64 	                        break;
65 	                default:
66 	                         break;
67 	        }
68 	}
69 	
70 	Deflater::Deflater(sal_Int32 nSetLevel, sal_Bool bNowrap)
71 	: bFinish(sal_False)
72 	, bFinished(sal_False)
73 	, bSetParams(sal_False)
74 	, nLevel(nSetLevel)
75 	, nStrategy(DEFAULT_STRATEGY)
76 	, nOffset(0)
77 	, nLength(0)
78 	{
79 	        init(nSetLevel, DEFAULT_STRATEGY, bNowrap);
80 	}
81 	
82 	sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength)
83 	{
84 	        sal_Int32 nResult;
85 	        if (bSetParams)
86 	        {
87 	                pStream->next_in   = (unsigned char*) sInBuffer.getConstArray() + nOffset;
88 	                pStream->next_out  = (unsigned char*) rBuffer.getArray()+nNewOffset;
89 	                pStream->avail_in  = nLength;
90 	                pStream->avail_out = nNewLength;
91 	
92 	#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
93 	                nResult = deflateParams(pStream, nLevel, nStrategy);
94 	#else
95 	                nResult = z_deflateParams(pStream, nLevel, nStrategy);
96 	#endif
97 	                switch (nResult)
98 	                {
99 	                        case Z_OK:
100 	                                bSetParams = sal_False;
101 	                                nOffset += nLength - pStream->avail_in;
102 	                                nLength = pStream->avail_in;
103 	                                return nNewLength - pStream->avail_out;
104 	                        case Z_BUF_ERROR:
105 	                                bSetParams = sal_False;
106 	                                return 0;
107 	                        default:
108 	                                return 0;
109 	                }
110 	        }
111 	        else
112 	        {
113 	                pStream->next_in   = (unsigned char*) sInBuffer.getConstArray() + nOffset;
114 	                pStream->next_out  = (unsigned char*) rBuffer.getArray()+nNewOffset;
115 	                pStream->avail_in  = nLength;
116 	                pStream->avail_out = nNewLength;
117 	
118 	#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
119 	                nResult = deflate(pStream, bFinish ? Z_FINISH : Z_NO_FLUSH);
120 	#else
121 	                nResult = z_deflate(pStream, bFinish ? Z_FINISH : Z_NO_FLUSH);
122 	#endif
123 	                switch (nResult)
124 	                {
125 	                        case Z_STREAM_END:
126 	                                bFinished = sal_True;
127 	                        case Z_OK:
128 	                                nOffset += nLength - pStream->avail_in;
129 	                                nLength = pStream->avail_in;
130 	                                return nNewLength - pStream->avail_out;
131 	                        case Z_BUF_ERROR:
132 	                                bSetParams = sal_False;
133 	                                return 0;
134 	                        default:
135 	                                return 0;
136 	                }
137 	        }
138 	}
139 	
140 	void SAL_CALL Deflater::setInputSegment( const uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength ) 
141 	{
142 	    OSL_ASSERT( !(nNewOffset < 0 || nNewLength < 0 || nNewOffset + nNewLength > rBuffer.getLength()));
143 	        
144 	    sInBuffer = rBuffer;
145 	    nOffset = nNewOffset;
146 	    nLength = nNewLength;
147 	}
148 	void SAL_CALL Deflater::setLevel( sal_Int32 nNewLevel ) 
149 	{
150 	        if ((nNewLevel < 0 || nNewLevel > 9) && nNewLevel != DEFAULT_COMPRESSION)
151 	        {
152 	                // do error handling
153 	        }
154 	        if (nNewLevel != nLevel)
155 	        {
156 	                nLevel = nNewLevel;
157 	                bSetParams = sal_True;
158 	        }
159 	}
160 	sal_Bool SAL_CALL Deflater::needsInput(  ) 
161 	{
162 	        return nLength <=0;
163 	}
164 	void SAL_CALL Deflater::finish(  ) 
165 	{
166 	        bFinish = sal_True;
167 	}
168 	sal_Bool SAL_CALL Deflater::finished(  ) 
169 	{
170 	        return bFinished;
171 	}
172 	sal_Int32 SAL_CALL Deflater::doDeflateSegment( uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength ) 
173 	{
174 	    OSL_ASSERT( !(nNewOffset < 0 || nNewLength < 0 || nNewOffset + nNewLength > rBuffer.getLength()));
175 	    return doDeflateBytes(rBuffer, nNewOffset, nNewLength);
176 	}
177 	sal_Int32 SAL_CALL Deflater::getTotalIn(  ) 
178 	{
179 	        return pStream->total_in;
180 	}
181 	sal_Int32 SAL_CALL Deflater::getTotalOut(  ) 
182 	{
183 	        return pStream->total_out;
184 	}
185 	void SAL_CALL Deflater::reset(  ) 
186 	{
187 	#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIXB
188 	        deflateReset(pStream);
189 	#else
190 	        z_deflateReset(pStream);
191 	#endif
192 	        bFinish = sal_False;
193 	        bFinished = sal_False;
194 	        nOffset = nLength = 0;
195 	}
196 	void SAL_CALL Deflater::end(  ) 
197 	{
198 	        if (pStream != NULL)
199 	        {
200 	#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
201 	                deflateEnd(pStream);
202 	#else
203 	                z_deflateEnd(pStream);
204 	#endif
205 	                delete pStream;
206 	        }
207 	        pStream = NULL;
208 	}
I realise this is unlikely ever to be fixed with the lack of AOO development but thought it worthwhile to record my thoughts just in case. It supports our idea that too quick shutting of a laptop lid could be causing problem and also explains why it is fairly infrequent - it has to occur at exactly the wrong time to catch the fault in the AOO coding.

I have never seen a report of LibreOffice causing this corruption so I think that LO may have fixed the bug.

I could be completely wrong ...

Re: [Hint] How did I fix my ODT file

Posted: Wed Oct 16, 2019 3:55 pm
by RoryOF
I doubt that there is any possible fix for this; an interrupt calling for a closedown can be inhibited (locked out, or postponed in software), but an actual physical loss of power, be it by power failure or by forced switch off of the power, can only be managed with an Uninterruptible Power Supply (UPS), the weight (and extra expense of which) prevent its inclusion in a laptop, and indeed, in most desktop computers.

Re: [Hint] How did I fix my ODT file

Posted: Sat Jun 06, 2020 7:53 pm
by John_Ha
John_Ha wrote:I realise this is unlikely ever to be fixed with the lack of AOO development ...
I had a thought how my hypothesis could be tested.

Someone with coding experience could code a "pause" immediately after the nulls are written so AOO pauses after the nulls have been written but before the content gets written. If the tester then issued a sleep, hibernate or power off command, or shut the laptop lid, AOO should prevent the sleep or hibernate, and prevent the power off from happening, because AOO has a file open which has not been written.

On restarting the PC the file should be found to be full of nulls.

Re: [Hint] How did I fix my ODT file

Posted: Wed Jun 10, 2020 5:59 pm
by Ensaf
I need your Urgent help

I am a Freelancer Journalist and I was using OpenOffice 3.1.4 until 08 June 2020. All my writing are and were in Farsi / Persian, as you may say.
All my writings were automatically saved as ODT format.
I was working on a new project that i need to read and refer to a lot books as my resources. I need to do search on E-book to go on faster. I tried some new software on my desktop that runs by Windows 10.
usually i do not turn off my pc. but on the June 08 I need to restart. Then I find out that All of my written files are working as before just the last one that I was working on. It is encrypted.
I am not familiar with formats or file codes. I just do open the Text Write and change to Farsi/Persian alphabets and do my job and just push Save button when i need. It does automatically do saving in the same format as always do.
I tried to open and recover it in different ways for example in Western Europe series, Unicodes, Arabics too but they did not worked for me.
Would you please help me.
Ensaf
hedayatensafali!gmail.com

Re: [Hint] How did I fix my ODT file

Posted: Wed Jun 10, 2020 8:11 pm
by FJCC
I seems your file has been corrupted and cannot be recovered. You can post it here for someone to look at it but I am not hopeful. To upload a file, click Post Reply and look for the Upload Attachment tab just below the box where you type a response.
There is also a tutorial here that explains about recovering temporary versions of files.

Re: [Hint] How did I fix my ODT file

Posted: Wed Jun 10, 2020 8:16 pm
by John_Ha
Ensaf wrote:usually i do not turn off my pc. but on the June 08 I need to restart.
If
  • you had one or more files (fred.odt, tom.odt etc) open in AOO/LO and
  • the PC got restarted without your saving these files first
you should find that your files fred.odt and tom.odt are still on disk and as they were before you started editing. Also, the temporary file(s) AOO/LO wrote when you opened each file should still be there.

All edits since the file was opened will have been lost because they were stored in memory. They had not been saved to disk by your saving the file; nor by AutoRecovery as it was not enabled. As Always create a backup copy was not enabled there is no backup of the previously saved version.

See Why is my file full of #####? for a discussion.

[Tutorial] How to find and un-delete AOO temporary files gives detailed instructions on how to

a) use Previous Versions (W7 and later) to recover previous versions of the file (is there something similar on MacOS and Linux?);

b) recover your file as it was when you last opened or saved it, or as it was when it was last saved with AutoRecovery;

c) find previous versions of the file in the folder it is located in, but which have since been deleted;

d) find any temporary files AOO wrote while you were editing the file but which have not yet been deleted;

e) un-delete the temporary files AOO wrote while you were editing the file, and then deleted. d) and e) will recover your file as it was when you last opened or you last saved it.

If you cannot follow the instructions ask someone with more PC skills to help you. Act quickly - the longer you wait the more likely any temporary files are to be deleted.

If you have some files which you can upload, upload them here (128 kb max) or to a file share website like Dropbox, Google Drive or MediaFire etc. If the file has confidential information send it to me - I have sent you an email with my ID.

Re: [Hint] How did I fix my ODT file

Posted: Sat Feb 27, 2021 5:47 pm
by ardovm
John_Ha wrote:While I have no serious coding experience I think the NULLs we see in broken .odt files are probably written by a routine called Deflater.cxx in the package bit of AOO which writes files at [Apache-SVN]/openoffice/trunk/main/package/source/package/zipapi/Deflater.cxx. The source is as below. Deflater is the routine which Zips the file.

Note that line 52 appears to set something (the memory for the file? the disk space to be used for the file?) to zeros or NULLs. I think these are the NULLs we see in the broken .odt files. Line 51 is a comment explaining that NULLs are about to be written.

Code: Select all

51 	        /* Memset it to 0...sets zalloc/zfree/opaque to NULL */
52 	        memset (pStream, 0, sizeof(*pStream));
I am not sure that "those" NULLs are "the same" NULLs that were reported.

According to the zlib manual the structure pStream contains support data for the compression algorithm. It is zeroed at the beginning in order to have it in a "known state".

The compressed (i.e. output for zlib) data are written in another method:

Code: Select all

82 	sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength)
83 	{
84 	        sal_Int32 nResult;
85 	        if (bSetParams)
86 	        {
87 	                pStream->next_in   = (unsigned char*) sInBuffer.getConstArray() + nOffset;
88 	                pStream->next_out  = (unsigned char*) rBuffer.getArray()+nNewOffset;
89 	                pStream->avail_in  = nLength;
90 	                pStream->avail_out = nNewLength;
Here, it is clear that the the pStream just hold pointers to the input data (sInBuffer) and the output buffer (rBuffer)
...
It supports our idea that too quick shutting of a laptop lid could be causing problem and also explains why it is fairly infrequent - it has to occur at exactly the wrong time to catch the fault in the AOO coding.
In case it could be interesting for other forum readers, we are trying to reproduce the problem on the bug report #126869.
I could be completely wrong ...
Me too, of course! Any help, suggestions etc. are appreciated!

Re: [Hint] How did I fix my ODT file

Posted: Sat Feb 27, 2021 8:54 pm
by John_Ha
ardovm wrote:I am not sure that "those" NULLs are "the same" NULLs that were reported.
I will defer to your vastly greater coding expertise!!

Re: [Hint] How did I fix my ODT file

Posted: Sat Feb 27, 2021 11:00 pm
by John_Ha
ardovm wrote:Any help, suggestions etc. are appreciated!
If you want to be puzzled have a peep at Format error discovered in the file in sub-document. :D

It is by no means the "normal" format error bug, with its repeated attributes or single bit error, which you seem to have fixed. It is something which I cannot even begin to guess what has happened as there are hundreds if not thousands of corruptions in content.xml!!

My head aches if I think about it so I have stopped thinking about it and I have put it down to alien life from outer space messing with us. :super: