bugGNU Octave - Bugs: bug #55974, Octave hangs on plotting text...

 
 

bug #55974: Octave hangs on plotting text object with invalid UTF-8 byte sequence

Submitted by:  Roland Baudin <roland65>
Submitted on:  Thu 21 Mar 2019 01:57:55 PM UTC  
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  5.1.0 Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 11 Apr 2019 10:28:40 PM UTC, comment #3:

Re-summarizing this bug, and posting your example as an inline snippet.

This works correctly in a UTF-8 locale

The following causes Octave to hang and needs to be killed with SIGKILL

The hang occurs in FreeType, here is the top of the call stack in gdb when stuck

Mike Miller <mtmiller>
Project Administrator
Fri 22 Mar 2019 08:38:16 AM UTC, comment #2:

This is clearly a bug that Octave hangs in this case.

You can find attached another example. This new script 'test_iso88591_2.m' (file encoded as ISO 8859-1) is simpler than the previous one and clearly shows the bug on Linux. It contains only two lines:

display('Fréquence');
xlabel('Fréquence');

On Linux, the first one is executed and the string is displayed as 'Fr�quence', which is what is expected.

The second line makes Octave 5.1.0 hang (OpenGL or fltk graphics toolkit).

In Octave 4.4.1, the second line does silently nothing, which is also a bug.

When a string is not encoded as expected, Octave should display it, with garbage characters where the encoding differs, in console or graphics.

(file #46610)

Roland Baudin <roland65>
Thu 21 Mar 2019 05:01:44 PM UTC, comment #1:

The short answer is that Octave does not currently have a heuristic way to detect the file encoding simply by looking at the bytes.

If you change the setting in the Preferences, Editor tab, that says "Text encoding used for loading and saving" to be "ISO-8859-1", then your test_iso88591 script works correctly but the UTF-8 encoded script shows garbage characters.

Maybe something can be done about Octave hanging when it tries to decode a file that is not valid UTF-8 and hits an invalid byte sequence. Is that what you'd like to see fixed here?

Mike Miller <mtmiller>
Project Administrator
Thu 21 Mar 2019 01:57:55 PM UTC, original submission:

Sometimes I use on Linux some script (m-file) that comes from the Windows world. Such scripts are usually encoded in ISO 8859-1.

If there is in the script some non ASCII character (like 'é', 'à' and other french accents), in a call to functions like xlabel(), ylabel(), title(), etc., then Octave 5.1.0 gets stuck and seems to be lost in an infinite loop.

I attached two scripts to test this issue. Both contain the same code (below, 'Fréquence' is the french word for 'Frequency'):

plot( sin(1 : 1000) );
xlabel('Fréquence');

Note that the script 'test_utf8.m' is encoded in UTF-8 and the script 'test_iso88591.m' is encoded in ISO 8859-1.

In Octave 5.1.0 (system is Ubuntu Linux 18.04 64 bits), test_utf8.m is executed with no error and the word 'Fréquence' is correctly displayed, while test_iso88591.m makes Octave stuck (empty figure window, prompt never returns).

In Octave 4.4.1 (same system), test_iso88591.m runs, but displays the following error message:

warning: ft_text_renderer: failed to decode string `Fr�quence x' with locale `fr_FR.UTF-8'
warning: called from
_axis_label_ at line 31 column 3
xlabel at line 51 column 8
test at line 4 column 1
warning: ft_text_renderer: failed to decode string `Fr�quence x' with locale `fr_FR.UTF-8'
warning: called from
_axis_label_ at line 31 column 3
xlabel at line 51 column 8
test at line 4 column 1

In Windows, both scripts run as expected.

Roland Baudin <roland65>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #46610:  test2.zip added by roland65 (216B - application/zip - Another (simpler) test)
file #46604:  test.zip added by roland65 (423B - application/zip - Scripts to test the issue)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by roland65 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-11 mtmiller StatusNone => Confirmed
        SummaryOctave stuck on Linux when figure contains a string with non ASCII characters encoded in ISO 8859-1 => Octave hangs on plotting text object with invalid UTF-8 byte sequence
    2019-03-22 roland65 Attached File- => Added test2.zip, #46610
    2019-03-21 roland65 Attached File- => Added test.zip, #46604

    Back to the top


    Powered by Savane 3.4