Bug Hunting Session
Bug 52546 - Inconsistent behavior with filenames with dots under KDE
Summary: Inconsistent behavior with filenames with dots under KDE
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
3.5.5.3 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:3.7.0 target:3.6.1
Keywords:
: 64203 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-26 14:05 UTC by Mirosław Zalewski
Modified: 2013-06-20 13:36 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Table with filenames in OpenDocument format, for better reading (14.31 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-07-26 14:10 UTC, Mirosław Zalewski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mirosław Zalewski 2012-07-26 14:05:33 UTC
LO under KDE strips too many components from filename when saving files with dots in names. It does behave in a way that is unpredictable for both LO and KDE users.

I have made a little experiment that shows what is done. I did:
1. Create 1.2.3.4.txt file (command: 'date > 1.2.3.4.txt')
2. Create 1.2.3.4.jpg file (copied another JPG image)
3. Open TXT file in LO (run under newly created profile) in different conditions and then "Saved as" (did not change file type) and "Saved as" with changing file type.
4. Open JPG file in Kolourpaint and then "Saved as" (did not change file type) and "Saved as" with changing file type.

Results are in tables below. Both KDE and LO under pure X11 has "Automatically select filename extension". I tried it both checked on and off. To save space, I cropped it to only "Automatic..." in tables.
First column shows conditions that has been checked (LO desktop and "Automatic..." state). Second is filename that was proposed in save dialog. Third is name of file that was actually changed. Fourth is output of 'file' command run on saved file.
When saving as plain text file, LO did ask if I want to save in "Text" or "OpenDocument" format. I have always choosen "Text".

Table 1. LibreOffice; File: 1.2.3.4.txt; "Save as"
                              proposed name       file after export  'file' command output
KDE, Automatic... on          1.2.3.odt           1.2.3.odt          OpenDocument Text
KDE, Automatic... off         1.2.3.4             1.2.3.4            OpenDocument Text
GNOME                         1.2.3.4             1.2.3.4.txt        UTF-8 Unicode (with BOM) text
pure X11, Automatic... on     1.2.3.4             1.2.3.4.txt        UTF-8 Unicode (with BOM) text
pure X11, Automatic... off    1.2.3.4.txt         1.2.3.4.txt        UTF-8 Unicode (with BOM) text


Table 2. LibreOffice; File: 1.2.3.4.txt; "Save as", filetype changed to OTT
                              proposed name       file after export  'file' command output
KDE, Automatic... on          1.2.3.ott           1.2.3.ott          OpenDocument Text Template
KDE, Automatic... off         1.2.3.4             1.2.3.4            OpenDocument Text Template
GNOME                         1.2.3.4             1.2.3.4.ott        OpenDocument Text Template
pure X11, Automatic... on     1.2.3.4             1.2.3.4.ott        OpenDocument Text Template
pure X11, Automatic... off    1.2.3.4.txt         1.2.3.4.txt        OpenDocument Text Template


Table 3. Kolourpaint; File: 1.2.3.4.jpg; "Save as"
                              proposed name       file after export  'file' command output
Automatic... on               1.2.3.4.jpg         1.2.3.4.jpg        JPEG image data
Automatic... off              1.2.3.4.jpg         1.2.3.4.jpg        JPEG image data


Table 4. Kolourpaint; File: 1.2.3.4.jpg; "Save as", filetype changed to PNG
                              proposed name       file after export  'file' command output
Automatic... on               1.2.3.4.png         1.2.3.4.png        PNG image data
Automatic... off              1.2.3.4.jpg         1.2.3.4.jpg        PNG image data

Conclusions:
1. As we can see (tables 3 and 4), KDE may handle file type and extensions for applications. It will use last component as extension and change it automatically, *IF* "Automatic..." is turned on. If it is turned off, KDE will leave filename alone.
2. LO does not trust KDE that it will strip extension from file name and does it by itself (tables 1 and 2, rows 1 and 2, compare to wrows 4 and 5). But LO DOES trust KDE that it will add that extension (tables 1 and 2, rows 2, 3 and 4).
3. Behavior of LO under KDE is different than LO under GNOME/X11 AND other KDE apps. It does not fit into known patterns. This means that it certainly is bug in LO, not KDE.

What should be done:
LO should detect if it is run under KDE (we have OOO_FORCE_DESKTOP and SAL_USE_VCLPLUGIN variables for this, right?). If it does, then it should leave filename alone, trusting that KDE will do it's job. Do not strip anything (column two), do not add anything (column three). Then LO will work in the same way as other KDE apps and it's behaviour will be consistent.

Additional informations:
This issue has been discussed on KDE users mailing list. Link to discussion:
http://comments.gmane.org/gmane.comp.kde.general/26110
Especially second post provides deeper knowledge about a way that KDE handles file extensions.

Best regards
Mirosław Zalewski
Comment 1 Mirosław Zalewski 2012-07-26 14:10:57 UTC
Created attachment 64738 [details]
Table with filenames in OpenDocument format, for better reading
Comment 2 dE 2012-07-30 13:51:10 UTC
Reproducible with the exact same libreoffice version.
Comment 3 Not Assigned 2012-08-01 09:44:10 UTC
LuboÅ¡ LuÅak committed a patch related to this issue.
It has been pushed to "master":

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

do not let LO's autoextension handling interfere with KFileDialog's(fdo#52546)
Comment 4 Not Assigned 2012-08-01 09:51:01 UTC
LuboÅ¡ LuÅak committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c921fc0ae2b20de1953e7558fce6b9ddb94c56d3&g=libreoffice-3-6

do not let LO's autoextension handling interfere with KFileDialog's(fdo#52546)


It will be available in LibreOffice 3.6.1.
Comment 5 Mirosław Zalewski 2012-08-30 10:14:00 UTC
I can confirm that this is fixed as of LibreOffice 3.6.1.
Thanks! :)
Comment 6 Mirosław Zalewski 2013-06-20 13:36:22 UTC
*** Bug 64203 has been marked as a duplicate of this bug. ***