Bug 816809 - exec/run calls don't handle CJK filenames well.
exec/run calls don't handle CJK filenames well.
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: perl-File-DesktopEntry (Show other bugs)
15
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Marcela Mašláňová
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-27 00:42 EDT by MozBug
Modified: 2012-08-08 05:19 EDT (History)
4 users (show)

See Also:
Fixed In Version: perl-File-DesktopEntry-0.04-16.fc18
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-07 15:59:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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


External Trackers
Tracker ID Priority Status Summary Last Updated
CPAN 76843 None None None Never

  None (edit)
Description MozBug 2012-04-27 00:42:17 EDT
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;
			s/\%(.)/
				($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}       : '' ;
			/eg;

			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 07:32:15 EDT
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 08:15:32 EDT
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 15:59:55 EDT
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:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

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