Bug Hunting Session
Bug 118232 - FILEOPEN: General Error opening a SVG file
Summary: FILEOPEN: General Error opening a SVG file
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
6.1.0.0.beta2+
Hardware: All All
: medium normal
Assignee: Armin Le Grand
URL:
Whiteboard: target:6.2.0 target:6.1.0.2
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2018-06-18 19:34 UTC by Xisco Faulí
Modified: 2018-07-13 10:51 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
svg file (4.08 KB, image/svg+xml)
2018-06-18 19:34 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2018-06-18 19:34:48 UTC
Created attachment 142882 [details]
svg file

Steps to reproduce:
1. Open attached .SVG file

-> General Error. General Input/Output error.

How the file was created:
1. New blank Draw file
2. Export as .SVG

The file can be inserted from Insert - Image

Reproduced in

Version: 6.2.0.0.alpha0+
Build ID: d60d695fcc5064e1f16842387fdce23456a64694
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded
Comment 1 Xisco Faulí 2018-06-18 19:36:35 UTC
Regression introduced by:

author	Armin Le Grand <Armin.Le.Grand@cib.de>	2018-05-10 17:49:19 +0200
committer	Armin Le Grand <Armin.Le.Grand@cib.de>	2018-05-18 20:11:35 +0200
commit	3ca7be09834a26fbd1c371deabd7a58111092676 (patch)
tree	560c1ee287e529b8879bbc2375b5a48f87c65a51
parent	c845135b7b605257b5c94b382d88627282cb05a3 (diff)
Replace SVGFilter using SVGIO

Bisected with: bibisect-linux64-6.1

Adding Cc: to Armin Le Grand
Comment 2 Armin Le Grand 2018-07-03 07:13:10 UTC
Hi Xisco - I can somehow not grap the testfile. When clickling, I get an empty page (saying https://bug-attachments.documentfoundation.org/attachment.cgi?id=142882)
Comment 3 Xisco Faulí 2018-07-03 08:46:37 UTC
(In reply to Armin Le Grand (CIB) from comment #2)
> Hi Xisco - I can somehow not grap the testfile. When clickling, I get an
> empty page (saying
> https://bug-attachments.documentfoundation.org/attachment.cgi?id=142882)

Yep, because you're browser is opening the file directly.
You can either  right click on it - save file, or follow the steps in the description.

1. New blank Draw file
2. Export as .SVG
Comment 4 Armin Le Grand 2018-07-04 09:19:15 UTC
@Xisco - thanks, Yes - shouldhave see that :)

If the SVG is empty, no geometry gets imported. With no geometry, the import stops and creates no File.
I think this is as it should be, except that the error message is not fitting to this case.

What should happen with empty SVGs:
- as currently - error
- show some more meaningful message, but do not open empty Draw/Impress
- quietly open some Draw/Impress, 'guess' a document size

I am not sure...
Comment 5 Armin Le Grand 2018-07-04 09:21:01 UTC
Checked what libreoffice-6-0 did: Just opens an empty Draw. Is that the expected behaviour? Maybe we should ask UI/Design guys here...?
Comment 6 Telesto 2018-07-04 09:25:33 UTC
(In reply to Armin Le Grand (CIB) from comment #5)
> Checked what libreoffice-6-0 did: Just opens an empty Draw. Is that the
> expected behaviour? Maybe we should ask UI/Design guys here...?

Let's ask
Comment 7 Armin Le Grand 2018-07-04 10:26:28 UTC
@Heiko: See comment 4 - what would you expect...?
Comment 8 V Stuart Foote 2018-07-04 13:08:17 UTC
We need an error message other than the "General Input/Output error" -- maybe "The SVG image is malformed". And that, rather than opening onto an empty Draw canvas.
Comment 9 Tomaz Vajngerl 2018-07-04 13:22:54 UTC
Opening an empty file is not an error.
Comment 10 Xisco Faulí 2018-07-04 13:31:13 UTC
(In reply to Tomaz Vajngerl from comment #9)
> Opening an empty file is not an error.

Yep, I agree with Tomaz here!
Comment 11 V Stuart Foote 2018-07-04 14:01:35 UTC
(In reply to Tomaz Vajngerl from comment #9)
> Opening an empty file is not an error.

No, the point is because the "empty" SVG image has no defined dimension the import filter errors opening to Draw document. The "error" is for mishandling of the image--not the resulting empty document canvas.
Comment 12 Regina Henschel 2018-07-04 14:15:29 UTC
(In reply to V Stuart Foote from comment #11)
> No, the point is because the "empty" SVG image has no defined dimension...

The svg file has well defined dimensions. It produces an area of width=210mm and height=297mm. If you open the file in a browser, you will notice, that this area is really used, because if your browser window is too small, it will generate scroll bars. And if you insert the svg file into an HTML document with a lot of text, then this area will become visible.

Currently inserting the svg file into a Writer document, does not use this area, but sets it to "2". That is an error too.

The file has an error. The attribute version="1.2" is wrong, it has to be version="1.1" (bug 105636). But the corrected file shows the same general error message and the same error, when inserting it into a Writer document.

I suggest to generate an empty page with width and height as given in the outer most svg element, even if this page has no content.
Comment 13 Heiko Tietze 2018-07-05 08:50:46 UTC
The file must be correct because you saved it before with the same tool. And that was working in 6.0 but not anymore in 6.2.

If you get basic information from a file, generally spoken, that means you recognize it as SVG but everything else is missing, I would apply standard properties and _inform_ the user with an info bar. 

But as Regina commented that's not the issue here.
Comment 14 Armin Le Grand 2018-07-06 11:59:21 UTC
May be related to tdf#118254 - look there, TeXMaths *may* produce those empty SVGs, so it gets no loaded document in it's processing.
When looking at the comments I would say:
-> Open empty Draw with the intended dimensions
Comment 15 Roman Kuznetsov 2018-07-06 12:18:56 UTC
I agree with:
 Open empty Draw with the intended dimensions
Comment 16 Armin Le Grand 2018-07-11 16:25:21 UTC
Checking how this can be obtained. Bet would probably be to add a HiddenGeometryPrimitive to the SVGFilter import when there is no content, that one containing a PolygonHairlinePrimitive. That way, the Size will be correct.
For the SVGFGilter it will be necessary to avoid creating a SdrGrafObj when there is no GraphicContent, will try that.
For Reginas note in comment 12 I need to check if this may already work as intended using the above mentined HiddenGeometryPrimitive/PolygonHairlinePrimitive combination...
Comment 17 Commit Notification 2018-07-11 17:42:30 UTC
Armin Le Grand committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0613ce41da0b94bc481b94b8141afcf15df8abe7

tdf#118232 Allow load and insert of SVGs with no Geometry

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Armin Le Grand 2018-07-12 07:41:20 UTC
Done for master.
Question: Should this be added to libreoffice-6-1..?
Comment 19 Xisco Faulí 2018-07-12 10:04:10 UTC
(In reply to Armin Le Grand (CIB) from comment #18)
> Done for master.
> Question: Should this be added to libreoffice-6-1..?

My vote goes to the yes!
Comment 20 Commit Notification 2018-07-12 17:36:37 UTC
Armin Le Grand committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1ebbe4193f5a7ea928fd4940c2a62bcb773c4a00&h=libreoffice-6-1

tdf#118232 Allow load and insert of SVGs with no Geometry

It will be available in 6.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Xisco Faulí 2018-07-13 10:51:54 UTC
Verified in

Version: 6.2.0.0.alpha0+
Build ID: dbf8ad9bc385411c349095dfa66345464b4215d6
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

@Armin, Thanks for fixing this!!