Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1045385 - Command line filenames are converted to different charset when file opening is attempted
Summary: Command line filenames are converted to different charset when file opening i...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: libreoffice
Version: 19
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Stephan Bergmann
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-20 10:04 UTC by matti aarnio
Modified: 2015-01-11 19:29 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-11 19:29:14 UTC
Type: Bug


Attachments (Terms of Use)

Description matti aarnio 2013-12-20 10:04:24 UTC
My Fedora setup (all versions since long time) are setup to use UTF-8 characters at xterm shells, and I have a habit of running all programs from shell instead of launching them from GUI menus -- or spending time at software internal menus of "open file..."


A file with name:  "test-åäö.odt"  is encoded in UTF-8 at the file system, but it can also be encoded in ISO-8859-1 as 8-bit characters. My shell uses file system's file names (byte sequences), and xterm presents them as interpreted texts.


Start of oowriter with command:
    ooffice test-åäö.odt
fails with "no such file found", and the pop-up screen _appears_ to show correct supplied filename.


Running that with "strace -ff -o ttt ...", and picking up lines with "test-" in them:

execve("/usr/lib64/libreoffice/program/soffice.bin",
   ["/usr/lib64/libreoffice/program/s"..., "test-\303\245\303\244\303\266.odt",
   "--splash-pipe=5"], [/* 60 vars */]) = 0
access("test-\345\344\366.odt", F_OK) = -1 ENOENT (No such file or directory)


So the input at process argv[] is definitely UTF-8 byte sequence of those characters, but when the program tries to access the file, the file name has been converted to different character set (ISO-8859-1 apparently,) which no longer matches the byte sequence at the filesystem.

As there is no difference in byte sequences of ASCII characters, most developers have had no opportunity to encounter this issue.

How to fix?

  - Preserve filenames as byte sequences received from argv/readdir() for
    all filesystem accesses
  - Feel free to display them in whatever interpretation format
  - Somehow solve the question of "enter filename with non-ASCII chars
    at dialogs, generate correct filename byte format."

This may be related on locale settings too:

LANG=en_US.UTF-8
LC_PAPER=A4
LC_TIME=fi_FI

No other LC_* environment variables are set, nor they should need to be set.

Comment 1 Stephan Bergmann 2014-01-06 10:05:10 UTC
I cannot reproduce this with libreoffice-core-4.1.4.2-2.fc19.x86_64.  With the same LANG/LC_* settings as above, and a file ~/Documents/test-åäö.odt in place, doing

> $ cd Documents
> $ strace -f ooffice test-åäö.odt 2>&1 | grep test-
[...]
> [pid  2137] execve("/usr/lib64/libreoffice/program/soffice.bin", ["/usr/lib64/libreoffice/program/s"..., "test-\303\245\303\244\303\266.odt", "--splash-pipe=5"], [/* 59 vars */] <unfinished ...>
> [pid  2137] access("/home/sbergman/Documents/test-\303\245\303\244\303\266.odt", F_OK) = 0
[...]

works fine and opens the document.  What is odd about your above strace output

> access("test-\345\344\366.odt", F_OK) = -1 ENOENT (No such file or directory)

is that the path passed to access is not absolute.  Is there anything odd about your CWD (that /does/ contain the test-åäö.odt file, does it?) when you run "ooffice test-åäö.odt"?

Comment 2 Fedora End Of Life 2015-01-09 20:55:02 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 matti aarnio 2015-01-11 19:29:14 UTC
The file open API seem to have changed since my initial report.
Now no adverse things happen.


write(3, "InternalIPC::Arguments1file:///home/mea/zzzzz,test-\303\244\303\266\303\245\303\244\303\266.odt\0", 98) = 98


Note You need to log in before you can comment on or make changes to this bug.