Bug 14541 - shutter does not start when not using C locale
Summary: shutter does not start when not using C locale
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: MGA5TOO MGA5-64-OK MGA5-32-OK advisory
Keywords: Triaged, validated_update
Depends on:
Blocks:
 
Reported: 2014-11-13 23:13 CET by Alex Loginov
Modified: 2015-10-25 17:35 CET (History)
13 users (show)

See Also:
Source RPM: shutter-0.93-4.1.mga5
CVE:
Status comment:


Attachments

Description Alex Loginov 2014-11-13 23:13:56 CET
Description of problem:
[user@localhost ~]$ shutter
defined(@array) is deprecated at /usr/bin/shutter line 3727.
        (Maybe you should just omit the defined()?)
defined(@array) is deprecated at /usr/bin/shutter line 3738.
        (Maybe you should just omit the defined()?)
WARNING: gnome-web-photo is missing --> screenshots of websites will be disabled!

WARNING: Image::ExifTool is missing --> writing Exif information will be disabled!

WARNING: Gtk2::AppIndicator is missing --> there will be no icon showing up in the status bar when running Unity!

Cannot decode string with wide characters at /usr/lib/perl5/5.20.1/i386-linux-thread-multi/Encode.pm line 215, <DATA> line 19.


Version-Release number of selected component (if applicable): shutter-0.93-4.mga5


How reproducible: always


Steps to Reproduce:
1. install shutter
2. run shutter


Reproducible: 

Steps to Reproduce:
Manuel Hiebel 2014-11-14 22:41:27 CET

Keywords: (none) => Triaged
CC: (none) => cazzaniga.sandro, geiger.david68210, guillomovitch, loginov_alex, pterjan, shlomif, thierry.vignaud

Comment 1 Pascal Terjan 2014-11-14 22:48:18 CET
I had never heard of this application, but it seems to be a 11k lines perl script, not really something I'd want to debug...

Also, it actually starts but doesn't display a window.
Comment 2 Manuel Hiebel 2014-11-14 22:56:33 CET
sorry you indeed only made one commit
Comment 3 Shlomi Fish 2014-11-19 10:15:16 CET
Hi Alex!

I am getting similar warnings, but it starts fine here - does it display the system tray icon which you can click to bring the main window (or right click for options)? I'm using Mageia 5 with KDE 4.
Comment 4 Alex Loginov 2014-11-19 21:49:27 CET
I tested Mageia 5 Cauldron KDE, LXDE, MATE: there is nothing in tray and no main window for shutter:(
Comment 5 Shlomi Fish 2014-11-20 10:58:20 CET
(In reply to Alex Loginov from comment #4)
> I tested Mageia 5 Cauldron KDE, LXDE, MATE: there is nothing in tray and no
> main window for shutter:(

does it also happen in a new user? Please test.
Comment 6 Alex Loginov 2014-11-21 14:54:37 CET
> does it also happen in a new user? Please test.

Yes, it does.
Comment 7 Shlomi Fish 2014-11-21 16:36:46 CET
(In reply to Alex Loginov from comment #6)
> > does it also happen in a new user? Please test.
> 
> Yes, it does.

shutter works fine inside a Mageia 5 i586 VM. You seem to have some strange problems.
Comment 8 Thierry Vignaud 2014-11-21 22:58:58 CET
Seriously?
He did see a problem and report it.

Let's try it:
[tv@localhost gdb]$  sudo urpmi shutter
(...)
[tv@localhost gdb]$ shutter
defined(@array) is deprecated at /usr/bin/shutter line 3727.
        (Maybe you should just omit the defined()?)
defined(@array) is deprecated at /usr/bin/shutter line 3738.
        (Maybe you should just omit the defined()?)
WARNING: Image::ExifTool is missing --> writing Exif information will be disabled!

WARNING: Gtk2::AppIndicator is missing --> there will be no icon showing up in the status bar when running Unity!

Cannot decode string with wide characters at /usr/lib/perl5/5.20.1/x86_64-linux-thread-multi/Encode.pm line 215, <DATA> line 19.
[tv@localhost gdb]$ echo $?
255
Comment 9 Thierry Vignaud 2014-11-21 23:04:05 CET
Last thing it does is reading /usr/share/shutter/resources/icons/sel_window_menu.svg

Adding the following to Encode.pm @line 215:
    use MDK::Common qw(backtrace); warn ">> HERE\n". backtrace(), "\n";

results in:

>> HERE
Encode::decode_utf8() called from /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Locale/gettext.pm:226
Locale::gettext::_convert() called from /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Locale/gettext.pm:126
Locale::gettext::get() called from /usr/share/shutter/resources/modules/Shutter/App/Menu.pm:597
Shutter::App::Menu::fct_ret_actions_menu() called from /usr/share/shutter/resources/modules/Shutter/App/Menu.pm:75
Shutter::App::Menu::create_menu() called from /usr/bin/shutter:558

Adding eval makes it go further:
    my $string = eval {$utf8enc->decode( $octets, $check ) };

So yes it's broken.
Interestingly, it works fine with C locale, but not with another locale.
(. ~/.i18n.C; shutter ) => KO

Summary: shutter does not start => shutter does not start when not using C locale

Comment 10 Thierry Vignaud 2014-11-21 23:04:26 CET
s/KO/OK/
Comment 11 Thierry Vignaud 2014-11-21 23:06:14 CET
And the string that causes the issue (for french locale) is:
"_Renommerâ¦"

Yet again a poorly written app that doesn't handle UTF-8 smoothly
Comment 12 Alex Loginov 2014-11-21 23:08:54 CET
Thierry, thank you for tests and confirmed issue.
Comment 13 Thierry Vignaud 2014-11-21 23:29:58 CET
You're welcome.
Though I won't go further (too much stuff)
Comment 14 Shlomi Fish 2014-11-22 08:53:08 CET
(In reply to Thierry Vignaud from comment #11)
> And the string that causes the issue (for french locale) is:
> "_Renommerâ¦"
> 
> Yet again a poorly written app that doesn't handle UTF-8 smoothly

My locale is:

<<<<
shlomif@telaviv1:~$ locale
LANG=en_GB.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=
shlomif@telaviv1:~$ 
>>>>

and shutter works fine there. Can you give an example to an offending locale?
Comment 15 Shlomi Fish 2014-11-22 08:55:46 CET
Ah, I can reproduce the problem with this command:

LC_ALL=es_ES.UTF-8 LANG=es_ES.UTF-8 LANGUAGE=es_ES:es shutter
Comment 16 Shlomi Fish 2014-11-22 13:07:47 CET
Hi all,

here's more of what I discovered.

With this program:

«
#!/usr/bin/perl

use strict;
use warnings;

#Gettext and filename parsing
use POSIX qw/setlocale/;
use Locale::gettext;

#Set LC_NUMERIC to C to prevent decimal commas (or anything else)
setlocale(LC_NUMERIC, "C");
setlocale( LC_MESSAGES, "" );
my $d = Locale::gettext->domain("shutter");

$d->dir('/usr/share/locale');

print $d->get("Session");
»

I am getting:

shlomif@telaviv1:~$ perl Test.pl
Sessionshlomif@telaviv1:~$

but:

«
shlomif@telaviv1:~$ LC_ALL=es_ES.UTF-8 LANG=es_ES.UTF-8 LANGUAGE=es_ES:es perl -MCarp::Always Test.pl
Cannot decode string with wide characters at /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Encode.pm line 215.
        Encode::decode_utf8("Sesio\x{301}n") called at /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Locale/gettext.pm line 226
        Locale::gettext::_convert(Locale::gettext=HASH(0x1be3e78), "Sesio\x{301}n") called at /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Locale/gettext.pm line 126
        Locale::gettext::get(Locale::gettext=HASH(0x1be3e78), "Session") called at Test.pl line 17
shlomif@telaviv1:~$
»

It doesn't happen on Ubuntu x86-64 and I also am unable to build the latest Locale::gettext module from source without its tests failing.

Regards,

-- Shlomi Fish
Comment 17 Thierry Vignaud 2014-11-22 15:09:27 CET
What do you mean?
The latest release dates from 2005...
Comment 18 Shlomi Fish 2014-11-22 15:12:53 CET
Hi all,

after I built and installed the CPAN module (while ignoring its failed tests), I was able to start shutter fine while using this command line:

< SHELL >
shlomif@telaviv1:~$ LC_ALL=es_ES.UTF-8 LANG=es_ES.UTF-8 LANGUAGE=es_ES:es perl -MCarp::Always /usr/bin/shutter
defined(@array) is deprecated at /usr/bin/shutter line 3727.
        (Maybe you should just omit the defined()?)
 at /usr/bin/shutter line 3727.
defined(@array) is deprecated at /usr/bin/shutter line 3738.
        (Maybe you should just omit the defined()?)
 at /usr/bin/shutter line 3738.
WARNING: Gtk2::AppIndicator is missing --> there will be no icon showing up in the status bar when running Unity!

 at /usr/bin/shutter line 9331.
        main::fct_init_depend called at /usr/bin/shutter line 134

(shutter:23396): Gtk-WARNING **: Failed to set text from markup due to error parsing markup: Error on line 1 char 43: ' ' is not a valid character following the characters '</'; ' ' may not begin an element name

(shutter:23396): Gtk-WARNING **: Failed to set text from markup due to error parsing markup: Error on line 1 char 43: ' ' is not a valid character following the characters '</'; ' ' may not begin an element name
GLib-CRITICAL **: Source ID 238 was not found when attempting to remove it at /usr/bin/shutter line 7247.
        main::fct_show_status_message(1, "\x{a1}Ajustes guardados correctamente!") called at /usr/bin/shutter line 4835
        main::fct_save_settings(undef) called at /usr/bin/shutter line 3321
        main::__ANON__() called at /usr/bin/shutter line 2884
        eval {...} called at /usr/bin/shutter line 2884
shlomif@telaviv1:~$ 
shlomif@telaviv1:~$ 
shlomif@telaviv1:~$ 

< / SHELL >

So it seems to be a problem with our packaging of Locale::gettext . Reassigning.

Regards,

-- Shlomi Fish

CC: (none) => jquelin
Source RPM: shutter => perl-Locale-gettext-1.50.0-15.mga5.src.rpm

Comment 19 Shlomi Fish 2014-11-22 15:17:57 CET
(In reply to Thierry Vignaud from comment #17)
> What do you mean?
> The latest release dates from 2005...

I ran "perl Makefile.PL" ; "make" ; "make test" ; "make install" inside the unpacked directory of this archive - https://cpan.metacpan.org/authors/id/P/PV/PVANDRY/gettext-1.05.tar.gz - from https://metacpan.org/release/gettext .
Comment 20 Thierry Vignaud 2014-11-22 15:29:48 CET
It looks like using Locale::gettext::dgettext(domain, str) instead of $domain->get(str) works better.

eg this works fine:
  print Locale::gettext::dgettext('shutter', "_Rename...");

whereas this doesn't:
  my $d = Locale::gettext->domain("shutter");
  print $d->get("_Rename...");

Anyway, I think it needs quite some patching in order to work as UTF-8 internally.
Meaning:
- initializing gtk:
  Gtk2->set_locale
  though using setlocale() should be OK too
- binding gettext to UTF-8:
Locale::gettext::bind_textdomain_codeset($_, 'UTF-8') foreach qw(shutter-upload-plugins shutter-plugins shutter);

Source RPM: perl-Locale-gettext-1.50.0-15.mga5.src.rpm => shutter

Comment 21 Shlomi Fish 2014-11-22 15:43:42 CET
Hi Thiery,

(In reply to Thierry Vignaud from comment #20)
> It looks like using Locale::gettext::dgettext(domain, str) instead of
> $domain->get(str) works better.
> 
> eg this works fine:
>   print Locale::gettext::dgettext('shutter', "_Rename...");
> 
> whereas this doesn't:
>   my $d = Locale::gettext->domain("shutter");
>   print $d->get("_Rename...");

Well, $d->get is :

sub get {
	my ($self, $msgid) = @_;
	$self->_convert(dgettext($self->{domain}, $msgid));
}

sub _convert {
	my ($self, $str) = @_;
	return $str if ($self->{raw});
	# thanks to the use of UTF-8 in bind_textdomain_codeset, the
	# result should always be valid UTF-8 when raw mode is not used.
	if ($self->{emulate}) {
		delete $self->{emulate};
		$self->{raw} = 1;
		my $null = $self->get("");
		if ($null =~ /charset=(\S+)/) {
			$self->{decode_from} = $1;
			$self->{raw} = 0;
		} #else matches the behaviour of glibc - no null entry
		  # means no conversion is done
	}
	if ($self->{decode_from}) {
		return decode($self->{decode_from}, $str);
	} else {
		return decode_utf8($str);
	}
}

And it is expected to work properly instead of throwing a fit on every Unicode codepoint. And people may wish to run Locale::gettext apps from source.

> 
> Anyway, I think it needs quite some patching in order to work as UTF-8
> internally.
> Meaning:
> - initializing gtk:
>   Gtk2->set_locale
>   though using setlocale() should be OK too
> - binding gettext to UTF-8:
> Locale::gettext::bind_textdomain_codeset($_, 'UTF-8') foreach
> qw(shutter-upload-plugins shutter-plugins shutter);

This gives me the same error:

#!/usr/bin/perl

use strict;
use warnings;

#Gettext and filename parsing
use POSIX qw/setlocale/;
use Locale::gettext;

#Set LC_NUMERIC to C to prevent decimal commas (or anything else)
setlocale(LC_NUMERIC, "C");
setlocale( LC_MESSAGES, "" );

Locale::gettext::bind_textdomain_codeset($_, 'UTF-8') foreach (qw(shutter-upload-plugins shutter-plugins shutter));
my $d = Locale::gettext->domain("shutter");

$d->dir('/usr/share/locale');

print $d->get("Session");

=====


Sessionshlomif@telaviv1:~$ LC_ALL=es_ES.UTF-8 LANG=es_ES.UTF-8 LANGUAGE=es_ES:esMCarp::Always Test.pl
Cannot decode string with wide characters at /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Encode.pm line 215.
        Encode::decode_utf8("Sesio\x{301}n") called at /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Locale/gettext.pm line 226
        Locale::gettext::_convert(Locale::gettext=HASH(0x1259318), "Sesio\x{301}n") called at /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Locale/gettext.pm line 126
        Locale::gettext::get(Locale::gettext=HASH(0x1259318), "Session") called at Test.pl line 19
shlomif@telaviv1:~$
Comment 22 Alex Loginov 2015-02-08 19:27:22 CET
Example:

#!/usr/bin/perl
use Locale::gettext;
my $d = Locale::gettext->domain("test");
print $d->get("пÑовеÑка"), "\n";

returns "Error" with upstream gettext/encode and returns "OK" with Mageia gettext/encode.
Samuel Verschelde 2015-05-31 23:08:04 CEST

Whiteboard: (none) => MGA5TOO

Olivier Placais 2015-08-14 21:31:32 CEST

CC: (none) => olivier.placais

Grio Ru 2015-08-19 19:29:21 CEST

CC: (none) => grio

Alex Loginov 2015-08-22 13:01:07 CEST

Source RPM: shutter => shutter, gettext

Comment 23 Alex Loginov 2015-10-15 10:38:37 CEST
It was fixed for shutter-0.93.1-4.mga6.
Reassign to maintainer of shutter to provide an update for mga5.

Source RPM: shutter, gettext => shutter
Assignee: bugsquad => shlomif

Comment 24 Shlomi Fish 2015-10-17 10:47:08 CEST
(In reply to Alex Loginov from comment #23)
> It was fixed for shutter-0.93.1-4.mga6.
> Reassign to maintainer of shutter to provide an update for mga5.

shutter-0.93.1-rel1-subrel1 was submitted to http://pkgsubmit.mageia.org/ for Mageia 5 and should be available in updates_testing soon. Please test. Assigning to the QA team.

Assignee: shlomif => qa-bugs

Comment 25 David GEIGER 2015-10-17 13:22:03 CEST
Tested mga5_64 and mga5_32,

Testing complete for new shutter-0.93.1-1.1.mga5, I confirm that the locale issue is now fixed for French system.

----------------------------------------
Before (impossible to use shutter):

$ shutter
WARNING: Image::ExifTool is missing --> writing Exif information will be disabled!

WARNING: Gtk2::AppIndicator is missing --> there will be no icon showing up in the status bar when running Unity!

Cannot decode string with wide characters at /usr/lib/perl5/5.20.1/x86_64-linux-thread-multi/Encode.pm line 215, <DATA> line 19.
$
----------------------------------------

After (now shutter starts, runs and uses French translation properly):

$ shutter 
WARNING: Gtk2::AppIndicator is missing --> there will be no icon showing up in the status bar when running Unity!
$
David GEIGER 2015-10-17 13:23:34 CEST

Whiteboard: MGA5TOO => MGA5TOO MGA5-64-OK MGA5-32-OK

David GEIGER 2015-10-17 13:27:38 CEST

Source RPM: shutter => shutter-0.93-4.1.mga5
Hardware: i586 => All
Version: Cauldron => 5

Comment 26 David GEIGER 2015-10-17 13:36:43 CEST
Packages in 5/core/updates_testing:
========================
shutter-0.93.1-1.1.mga5.noarch.rpm


Source RPM: 
========================
shutter-0.93.1-1.1.mga5.src.rpm
Comment 27 Alex Loginov 2015-10-23 22:27:43 CEST
Advisory:
========================

Updated shutter package fixes utf8 for locales and shutter starts successfully.
Before update shutter started using C locale only.

========================

Updated packages in core/updates_testing:
========================
shutter-0.93.1-1.1.mga5.noarch.rpm

Source RPM: 
shutter-0.93.1-1.1.mga5.src.rpm
Comment 28 William Kenney 2015-10-25 15:19:39 CET
Validating this update

Keywords: (none) => validated_update
CC: (none) => wilcal.int, sysadmin-bugs

Comment 29 Thomas Backlund 2015-10-25 17:23:12 CET
advisory uploaded

CC: (none) => tmb
Whiteboard: MGA5TOO MGA5-64-OK MGA5-32-OK => MGA5TOO MGA5-64-OK MGA5-32-OK advisory

Comment 30 Mageia Robot 2015-10-25 17:35:35 CET
An update for this issue has been pushed to Mageia Updates repository.

http://advisories.mageia.org/MGAA-2015-0161.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED


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