Bug 112235 - FILESAVE Unable to save with lost linked image: Error in writing sub-document content.xml
Summary: FILESAVE Unable to save with lost linked image: Error in writing sub-document...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-05 14:45 UTC by Paddy Landau
Modified: 2017-09-18 15:29 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
The error message (15.79 KB, image/png)
2017-09-05 14:51 UTC, Paddy Landau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paddy Landau 2017-09-05 14:45:44 UTC
Description:
An old error appears to have resurfaced. Neither the solution nor the cause had previously been found, but I have been lucky enough to at least find the cause, to help track down a solution.

When a Writer document has a link to an image, but the image is no longer present on disk, the document cannot be saved. If the image is restored to file, the document can again be saved.

This problem occurs in 5.4.1, whereas 5.4.0 worked correctly. Thus, it is a regression.

The following explanation shows how to reproduce it, and gives a workaround (unfortunately unworkable for documents with many linked images). However, because the error message is obscure for the non-technical user, it leaves the user utterly helpless to proceed.

Steps to Reproduce:
1. Open a document with a linked image. If you don't have such a document, create an image and then Insert > Image > select an image > Insert as Link (it isn't necessary to save the new document).

2. Remove or rename the linked image from disk (but keep it in the document).

3. Try to save the document.

Actual Results:  
On trying to save the document, the following error message is displayed.

> saving the document Untitled 1:
> Write Error.
> Error in writing sub-document content.xml.

(Replace "Untitled 1" with your document's name, if it has been saved.)

You can save the document again by doing any one of the following.
• Restore the original image on disk.
• Right-click the image > Properties > Image > Link > File name > set the new file name (assuming that the image file was merely renamed and not removed). Note that you cannot use a new image to replace the old image; Writer requires the original image.
• Delete the image from the document, and optionally replace it.

Expected Results:
What should happen is that the file is saved regardless. This allows the user to reopen the file later and replace the missing image with a new one. (This is a feature that I haved used frequently.)

If a large file with many linked images is copied to a new location but misses some of the images, this bug renders the file unable to be saved without deleting all of the linked images — this can be most undesirable.


Reproducible: Always

User Profile Reset: No

Additional Info:
In the following Ask LibreOffice question:
https://ask.libreoffice.org/en/question/90164/cannot-save-file-error-in-writing-sub-document-contentxml/
One answer said to check the following OpenOffice tutorial:
https://forum.openoffice.org/en/forum/viewtopic.php?f=71&t=87180
But XML Copy Editor does not report an error.

Related (closed) bug reports:
https://bugs.documentfoundation.org/show_bug.cgi?id=60769
https://bugs.documentfoundation.org/show_bug.cgi?id=109049

Tested with the following versions.

• 5.3.1.6 — works correctly
• 5.4.0.3 — works correctly
• 5.4.1.2 — fails

Operating system: Linux Ubuntu 16.04 64-bit


User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
Comment 1 Paddy Landau 2017-09-05 14:51:16 UTC
Created attachment 136034 [details]
The error message

This is the error message displayed when trying to save the document.
Comment 2 Buovjaga 2017-09-10 17:07:44 UTC
I confirm with 5.4.1, but not with the latest master. It seems it was fixed (again).

A quick way for you to test is to grab an AppImage of a daily build: http://libreoffice.soluzioniopen.com/ Follow the instructions on the site to run it (really easy, don't have to install anything)

Set to NEEDINFO.
Change back to UNCONFIRMED, if the problem persists. Change to RESOLVED WORKSFORME, if the problem went away.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.4.1.2.0+
Build ID: 5.4.1-1
CPU threads: 8; OS: Linux 4.12; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group

Arch Linux 64-bit, KDE Plasma 5
Version: 6.0.0.0.alpha0+
Build ID: 09122a537318f7ada075820f3b1ef83a64e56751
CPU threads: 8; OS: Linux 4.12; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on September 10th 2017
Comment 3 Paddy Landau 2017-09-10 20:31:04 UTC
Thank you for confirming, Buovjaga.

You are correct — the development version 6.0.0.0 works correctly.

I'm not sure that I should marked this as resolved, because surely it will affect everyone using LibreOffice Fresh until Fresh is replaced with the new version?
Comment 4 Buovjaga 2017-09-11 04:58:26 UTC
Well, we can use a backport request.

Might also be interesting to try with 5.4.2 when it hits release candidate status soon: https://wiki.documentfoundation.org/ReleasePlan/5.4#5.4.2_release
Comment 5 Paddy Landau 2017-09-11 11:55:05 UTC
Thanks, Buovjaga. I've made a note in my diary to check for the release candidate daily. When it's released, I'll test, and post back here. If it still doesn't work, I'll ask how to do a backport request.
Comment 6 Buovjaga 2017-09-11 12:10:03 UTC
(In reply to Paddy Landau from comment #5)
> Thanks, Buovjaga. I've made a note in my diary to check for the release
> candidate daily. When it's released, I'll test, and post back here. If it
> still doesn't work, I'll ask how to do a backport request.

It's ok, I added the necessary keywords for the request :)
Comment 7 Paddy Landau 2017-09-18 15:07:38 UTC
Good news. I've just tested with 5.4.2.1, and it works correctly.

I presume that I leave the status as RESOLVED WORKSFORME?
Comment 8 Buovjaga 2017-09-18 15:29:26 UTC
(In reply to Paddy Landau from comment #7)
> Good news. I've just tested with 5.4.2.1, and it works correctly.
> 
> I presume that I leave the status as RESOLVED WORKSFORME?

Ah, excellent. Yep, status remains and I will clean the other stuff.