Bug 816809 - exec/run calls don't handle CJK filenames well.
Summary: exec/run calls don't handle CJK filenames well.
Alias: None
Product: Fedora
Classification: Fedora
Component: perl-File-DesktopEntry
Version: 15
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Marcela Mašláňová
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2012-04-27 04:42 UTC by MozBug
Modified: 2012-08-08 09:19 UTC (History)
4 users (show)

Fixed In Version: perl-File-DesktopEntry-0.04-16.fc18
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-08-07 19:59:51 UTC
Type: Bug

Attachments (Terms of Use)
convert $_ to native before substitude with native filename. (460 bytes, patch)
2012-04-27 04:42 UTC, MozBug
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
CPAN 76843 0 None None None Never

Description MozBug 2012-04-27 04:42:17 UTC
Created attachment 580630 [details]
convert $_ to native before substitude with native filename.

The exec()/run() subroutines in DesktopEntry.pm cannot handle CJK filenames, under UTF-8 locale.

It can be see with mimeopen which use DesktopEntry to handle open files with .desktop format.

use a CJK filename like "我的图片.jpg", with mimeopen:
$ mimeopen 我的图片.jpg

The filename passed to the pic viewer will be screw up, like some latin1@#$AS.jpg.

The cause is that the regex substitution in the parse_Exec() function mixed utf-8 and native string at line 337:

		else { # expand with word ( e.g. --input=%f )
			my $bad;
				($1 eq '%') ? '%'                :
				($1 eq 'f') ? (_paths(@argv))[0] :
				($1 eq 'u') ? (_uris(@argv) )[0] :
				($1 eq 'd') ? (_dirs(@argv) )[0] :
				($1 eq 'c') ? $self->get('Name') :
				($1 eq 'k') ? $$self{file}       : '' ;

			push @exec, $_;

Where the argv is in byte encoding and $_ is in UTF_8, when mixed in regex, the output will be garbage for non-latin1 argv.

A possible fix is to convert $_ to byte string before doing the substitution.

Comment 1 Marcela Mašláňová 2012-04-27 11:32:15 UTC
I created upstream bug report. The patch looks ok to me. Do you want update even for F-15 or are you fine with fix in rawhide?

Comment 2 MozBug 2012-04-27 12:15:32 UTC
I'm ok with fix in rawhide. My box was patched anyway.

Thanks for taking care of it.

Comment 3 Fedora End Of Life 2012-08-07 19:59:55 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

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

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached 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 to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

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.

The process we are following is described here:

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