bugGNU Octave - Bugs: bug #37928, GUI crashes with french locale


bug #37928: GUI crashes with french locale

Submitter:  Pantxo Diribarne <pantxo>
Submitted:  Sat 15 Dec 2012 02:16:35 PM UTC
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Thu 10 Oct 2013 09:18:39 PM UTC, comment #30: 

Good news! Closing this bug

Torsten Lilge <ttl>
Group Member
Thu 10 Oct 2013 09:06:29 PM UTC, comment #29: 

Part of the comment disappeared ...

I hadn't tested this for a while and all now works as expected whether in fr_FR or en_US locale (same system).

Pantxo Diribarne <pantxo>
Group Member
Thu 10 Oct 2013 09:02:36 PM UTC, comment #28: 


>> .5
ans =  0.50000
>> sprintf ("%4f\n", e)
ans = 2.718282

Pantxo Diribarne <pantxo>
Group Member
Mon 11 Mar 2013 07:04:49 PM UTC, comment #27: 

There's something really, really wrong.  The sprintf test shows that you are not in the "C" locale.  I just don't know how that is happening.

For example, If I set my language and run Octave with

setenv LANG fr_FR.utf-8


sprintf ("%4f\n", e)
ans = 2.718282

So the 'C' locale has been properly set for LC_NUMERIC.  However, I can check that the rest of the language settings are still operating in the French locale.  If I look at the "Current Directory" window then the column headers are "Nom" and "Derniere modification".  The date stamp on the files is also correct for the French locale (DD/MM/YY as opposed to MM/DD/YY).

I suppose there is the slight chance of a race condition.  There is a warning message generated by KDE in bug report #38305 which maybe alludes to this.

Basically, though, I'm out of ideas.

Rik <rik5>
Group administrator
Sun 10 Mar 2013 05:01:37 PM UTC, comment #26: 

Rik's tests return this:

octave:1> sprintf ("%4f\n", e) # Test 1
ans = 2,718282

octave:2> 1,5 #Test 2
ans =  1
ans =  5
octave:3> 1.5
ans =  1
octave:4> history 5
 1000 # Octave 3.7.2+, dim. mars 10 17:45:57 2013 CET <pantxo@dibona>
 1001 sprintf ("%4f\n", e) # Test 1
 1002 1,5 #Test 2
 1003 1.5
 1004 history 5
octave:5> + #Test 3
parse error:

  syntax error

>>> + #Test 3


About debugging, can you give me more precise instructions, I have never used  neither gdb  nor debug flags. Which flags (CPP, C, CXX?) do those option belong to? I have made a trial adding CXXFLAGS="-O0 -g" to configure arguments, but in gdb I obtain no stack:

./run-octave -g
(gdb) run
(gdb) bt
No stack.

Pantxo Diribarne <pantxo>
Group Member
Sat 09 Mar 2013 05:10:32 PM UTC, comment #25: 

Thanks for making that change Torsten.

Rik <rik5>
Group administrator
Sat 09 Mar 2013 01:23:14 PM UTC, comment #24: 

The setlocale (LC_ALL, "en_US.UTF-8") is removed with changeset
(tested with german and french locale)

Torsten Lilge <ttl>
Group Member
Thu 07 Mar 2013 07:51:53 PM UTC, comment #23: 

Jordi, who was the last comment addressed to?

If it's the Octave GUI, I agree.  I think we should remove the setlocale (LC_ALL, "en_US.UTF-8") at the start.  It was put in to deal with a radix issue and that only requires setting LC_NUMERIC.  I think we should avoid overriding the rest of the locale parameters.

Rik <rik5>
Group administrator
Thu 07 Mar 2013 07:04:50 PM UTC, comment #22: 

By the way, you should be using the C locale to indicate "no locale" or "default locale", not en_US.

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Thu 07 Mar 2013 07:01:45 PM UTC, comment #21: 

I re-ran your correct test 'a = .5', but it still works just fine on my machine. 

This may be impossible to debug and could be recorded as just an oddity with your particular machine.

From past experiments, we know that it is caused by a mismatch between the locale that the GUI expects (en_US.utf-8) and whatever the current locale is.  Changing the locale (export LC_ALL=en_us.UTF-8) before running Octave works.  Unfortunately, the reverse situation does not provoke the bug.  On my system if I use 'export LC_ALL=fr_FR.UTF-8' and run Octave the GUI still works.

We also know that the problem does not appear to be with output, only input.  We also know that the CLI interface, which doesn't use any setlocale function calls, works.  Without any setlocale calls the program operates in the 'C' locale which has a radix of '.'.

I thought of a few more tests.

Test #1:

sprintf ("%4f\n", e)

This will verify that output is using the correct radix for the 'C' locale.

Test #2:

history 5

This will at least check whether the parser is seeing the full input that the screen is displaying.

Maybe there is some input scheme, like SCIM, that is interfering with things?

Test #3:


This should provoke a syntax error. 

If none of this brings any insight the last step would be to compile with '-g -O0' and run octave under gdb and get a backtrace when it crashes.

Rik <rik5>
Group administrator
Wed 06 Mar 2013 11:15:14 PM UTC, comment #20: 

After a fresh clone, "hg summary" returns:

parent: 16195:b52d2f9294b6 tip
 use class for reading lexer input
branch: default
commit: (clean)
update: (current)

and "locale -a" returns:


Opening the preference dialog I can change the language from "System settings" to "en_US", but the crash persists. My test is not "a = 0.5" but "a = .5" which closes the GUI window(s) and returns to prompt without any error message.

If I change my locale to en_US using

export LC_ALL="en_US.UTF-8"

prior to run-octave, every thing is ok.

Pantxo Diribarne <pantxo>
Group Member
Tue 05 Mar 2013 04:35:10 PM UTC, comment #19: 

Additional questions from Torsten:

- What language is configured in the settings dialog? Does the freeze occur with en_US, too?
- Does the settings dialog cause this freeze, too?

Rik <rik5>
Group administrator
Tue 05 Mar 2013 01:42:53 AM UTC, comment #18: 

Try 'hg summary' to find out exactly where you are.

Also, what is the output of 'locale -a' at a shell prompt?  Do you have the en_US.utf-8 locale installed?  The GUI is unilaterally trying to set that locale and if it does not exist something strange may be happening.

The following works for me

setenv LANG fr_FR.utf-8
a = 0.5

Rik <rik5>
Group administrator
Mon 04 Mar 2013 10:24:18 PM UTC, comment #17: 

Are you actually standing on the stable branch? "hg tip" doesn't tell you where you are, just what the most recent commit on your clone is.


Jordi Gutiérrez Hermoso <jordigh>
Group Member
Mon 04 Mar 2013 10:13:17 PM UTC, comment #16: 

The GUI still crashes (e.g. if I type "a = .5" in the command window) with fresh update and build. My tip is:
changeset:   16192:7fe4ea72ba4d
branch:      stable
tag:         tip
parent:      16091:8a8e04aa3c98
user:        Jordi Gutiérrez Hermoso <jordigh@octave.org>
date:        Mon Mar 04 16:47:22 2013 -0500
summary:     doc: Update 'test' and "fail" documentation

Pantxo Diribarne <pantxo>
Group Member
Sun 03 Mar 2013 09:37:08 AM UTC, comment #15: 

I'll try it out tomorow when I have access to my linux box.

Pantxo Diribarne <pantxo>
Group Member
Fri 01 Mar 2013 06:10:57 PM UTC, comment #14: 

could you please test the patch posted by Rik in bug #38372 (file #27549). I think it also should fix this bug.

Torsten Lilge <ttl>
Group Member
Fri 04 Jan 2013 12:11:19 AM UTC, comment #13: 

The patch does not fix the bug on my system. If I am the only one to report this bug, I should probably check that it is not due to a locale config issue on the system before you make further efforts ... Let me know if I can help with further tests.

Pantxo Diribarne <pantxo>
Group Member
Wed 26 Dec 2012 09:42:51 AM UTC, comment #12: 

Sorry I won't be able to test the patch for 10 days or so.

Pantxo Diribarne <pantxo>
Group Member
Wed 26 Dec 2012 09:10:55 AM UTC, comment #11: 

Following Jordi's post I tested the C locale in octave-main-thread.cc and it works for me regardless the locale's preset (german or french).

Pantxo (and maybe others with a non-en locale), could you please test the attached patch?

(file #27152)

Torsten Lilge <ttl>
Group Member
Wed 19 Dec 2012 09:13:21 AM UTC, comment #10: 

That's very strange, because I thought that the setlocale-command solved the issue by setting a fixed locale (and I did not check, because it worked immediately on my machine). I had the same issues you describe.

However, when I do the getenv command you proposed I still have the de_DE.UTF-8 locale set in my octave terminal, but it works for me.

Jacob Dawid <jacobdawid>
Mon 17 Dec 2012 02:48:28 PM UTC, comment #9: 

> setlocale(LC_ALL, "en_US.UTF-8");

Just to mention something, if our solution is to not support locales and change them all to a "safe" default, then that should be the C locale.

Octave in general has many difficult and deep problems with non-C locales, and the problems witnessed in the GUI are just the tip of the iceberg.

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Sun 16 Dec 2012 12:13:04 PM UTC, comment #8: 

See the following GUI command window session:

octave:1> getenv ("LANG")
ans = fr_FR.UTF-8
octave:2> getenv ("LC_ALL")
ans = fr_FR.UTF-8

Shouldn't the second command return en_US? Or does "setlocale" only change the locale settings for qt stuff?

Pantxo Diribarne <pantxo>
Group Member
Sun 16 Dec 2012 11:46:15 AM UTC, comment #7: 

I applied your patch using the following hg commands (not sure that's the proper way):

$ hg update --clean
$ hg import revert_changesets_15759_15758.diff

I ran "make" which rebuilt only the GUI stuff. The bug is still there.

I recently reinstalled the OS (linux mint 13 cinamon) so it may be a configuration issue on my side that makes the GUI behave differently now. Tell me if you whish me to make further tests.

Pantxo Diribarne <pantxo>
Group Member
Sun 16 Dec 2012 11:08:28 AM UTC, comment #6: 

Unfortunately, I did not succeed to reproduce the error on my system (french, german or english locale and regional settings). The way how Jacob solved some issues with the locale in the gui can be found in this post:
https://mailman.cae.wisc.edu/pipermail/octave-maintainers/2012-July/028900.html. The mentioned

setlocale(LC_ALL, "en_US.UTF-8");

is called in octave-main-thread.cc and has not changed.

I have committed two changesets recently converting charsets between the terminal and the history-/files-widgets. Could you please test the attached patch (reverting my changesets) just to be sure that the bug is no side effect introduced by my changesets?

Do the decimals ignored by the interpreter appear in the history?


(file #27106)

Torsten Lilge <ttl>
Group Member
Sat 15 Dec 2012 05:43:16 PM UTC, comment #5: 

I forgot to mension that this has already happened to me using QtHandles' octave-qt binary. Jacob Dawid told Michael Goffioul (and me but I didn't try to understand :-) the way he had fixed this in octave's gui (and it actually worked untill a few changesets ago).

Pantxo Diribarne <pantxo>
Group Member
Sat 15 Dec 2012 04:15:33 PM UTC, comment #4: 

A session in the GUI command window :

octave:1> pwd
ans = /home/pantxo/media/dev/octavebuild
octave:2> e
ans =  2.7183
octave:3> 1.5
ans =  1
octave:4> 0.5
ans = 0
octave:5> .5

The last line crashes the gui. In previous ones you can see that the interpreter doesn't take decimals into account, but that they are well displayed (predefined value of e).

Pantxo Diribarne <pantxo>
Group Member
Sat 15 Dec 2012 03:45:46 PM UTC, comment #3: 

Does the current directory contains special french characters when the command is entered?

Torsten Lilge <ttl>
Group Member
Sat 15 Dec 2012 03:37:30 PM UTC, comment #2: 

Sorry, it's not a script file but a command I type in the command window.

Pantxo Diribarne <pantxo>
Group Member
Sat 15 Dec 2012 03:04:31 PM UTC, comment #1: 

How do you start the script (with 'run' in the console or via the editor)?
Does the path to the script file does contain special french characters?

Torsten Lilge <ttl>
Group Member
Sat 15 Dec 2012 02:16:35 PM UTC, original submission:  

My locale is fr_FR.UTF-8, which defines comma as default decimal separator. Running the script below crashes the GUI.

a = .1;

I see no problem in --no-gui mode or if I change my locale to en_US.UTF-8.

My tip is :

$ hg tip
changeset:   15793:06832c90ae7d
tag:         tip
user:        Rik <rik@octave.org>
date:        Fri Dec 14 16:03:50 2012 -0800
summary:     build: Include new gui icons in distribution tarball.

Pantxo Diribarne <pantxo>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #27152:  setlocale_C.diff added by ttl (382B - text/x-diff)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by pantxo (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-10 ttl StatusWorks For Me Fixed
        Open/ClosedOpen Closed
    2013-03-05 rik5 StatusNone Works For Me
        SummaryGUI crashes whith french locale GUI crashes with french locale
    2012-12-26 ttl Attached File- Added setlocale_C.diff, #27152
    2012-12-16 ttl Attached File- Added revert_changesets_15759_15758.diff, #27106

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code