[Hint] How did I fix my ODT file

Discuss the word processor

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

Postby RoryOF » Thu Jul 25, 2019 2:27 pm

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.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29759
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby John_Ha » Thu Jul 25, 2019 3:03 pm

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.
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6870
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

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

Postby RoryOF » Thu Jul 25, 2019 3:30 pm

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.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29759
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby Mic90 » Thu Oct 03, 2019 4:05 pm

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.
Attachments
Essay Michela Filzi 4.odt
(71.82 KiB) Downloaded 11 times
Open Office 4.1.3 on MacOS Sierra Version 10.12.6
Mic90
 
Posts: 2
Joined: Thu Oct 03, 2019 3:15 pm

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

Postby floris v » Thu Oct 03, 2019 4:21 pm

@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: https://forum.openoffice.org/en/forum/viewtopic.php?f=5&t=99550 
Solution offered there.
AOO 4.1.6 op Linux Mint
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 4168
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

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

Postby RoryOF » Thu Oct 03, 2019 5:52 pm

Please check the attached file and ensure content and formatting are as you require.
Attachments
Essay Michela Filzi 4_repaired.odt
(71.2 KiB) Downloaded 5 times
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29759
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby Medivh » Thu Oct 10, 2019 2:03 pm

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!
Attachments
NewStoryboardEtc.rar
(411 Bytes) Downloaded 8 times
OpenOffice 4.1.5 on Windows 10
Medivh
 
Posts: 2
Joined: Thu Oct 10, 2019 1:50 pm

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

Postby RoryOF » Thu Oct 10, 2019 4:03 pm

A quick examination suggests that your file is completely corrupt. Wait for confirmation from another before panicking.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29759
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby Zizi64 » Thu Oct 10, 2019 4:16 pm

I cannot open neither the unpacked .ods file, nor unpack the zip archive of the ODF fileformat...
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.3.2; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8474
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby F3K Total » Thu Oct 10, 2019 6:34 pm

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 292 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
    MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
    my current system
  • Windows 7 OOo, AOO, LOLinux Mint OOo, AOO, LO
F3K Total
Volunteer
 
Posts: 934
Joined: Fri Dec 16, 2011 8:20 pm

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

Postby John_Ha » Thu Oct 10, 2019 7:02 pm

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.
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6870
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

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

Postby Medivh » Fri Oct 11, 2019 12:38 am

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!
OpenOffice 4.1.5 on Windows 10
Medivh
 
Posts: 2
Joined: Thu Oct 10, 2019 1:50 pm

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

Postby John_Ha » Wed Oct 16, 2019 3:03 pm

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 Deflator.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.

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   Expand viewCollapse view
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.

At some point after line 52 is executed AOO receives a shutdown? hibernate? command from Windows because the user closes the laptop lid. Normally, AOO would execute a graceful shutdown/hibernate where shutdown/hibernate would be paused 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. AOO allows the shutdown to happen before AOO has finished writing the file and made AOO safe.

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   Expand viewCollapse view
/**************************************************************
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 could be completely wrong ...
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6870
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

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

Postby RoryOF » Wed Oct 16, 2019 3:55 pm

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.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29759
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Previous

Return to Writer

Who is online

Users browsing this forum: No registered users and 20 guests