bugGNU Octave - Bugs: bug #57658, [MXE Octave] grey text color after...

 
 

bug #57658: [MXE Octave] grey text color after mkoctfile error message in gui terminal widget

Submitted by:  Hartmut <hardy>
Submitted on:  Thu 23 Jan 2020 08:45:16 AM UTC  
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Need Info Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Microsoft Windows

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

( Jump to the original submission)

Tue 18 Feb 2020 09:49:53 PM UTC, comment #25: 

just to add to this, currently the windows 5.2.0 bundles with geometry 3.0.0.  so anyone running a pkg update will currently pull geometry 4.0.0, which has a warning currently triggering the color change. So until a new geometry without the warning is released (last was 2017) it'll hit everyone who updates once.

It was nice to find that the interpreter has color options. but I hadn't missed it and could do without it for now if that's the easiest hack to fix it.


Nicholas Jankowski <nrjank>
Tue 18 Feb 2020 02:33:50 AM UTC, comment #24: 

Rather than disabling colors, how about changing the color used ? See attached patch.

(file #48439)

John Donoghue <lostbard>
Project Member
Mon 17 Feb 2020 09:55:53 PM UTC, comment #23: 

Running:

system("color F0")

Sets back the correct colors for me - which is what we are setting for SetConsoleTextAttribute

https://hg.savannah.gnu.org/hgweb/octave/file/11072ea6a16c/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp#l393

John Donoghue <lostbard>
Project Member
Mon 17 Feb 2020 06:51:24 PM UTC, comment #22: 

I see that color 7 is the general reset color index, (which in our terminal is light gray).

We set it to be different colors using SetConsoleTextAttribute, which I bet the color reset is then also resetting.

John Donoghue <lostbard>
Project Member
Mon 17 Feb 2020 06:15:00 PM UTC, comment #21: 

hmmm ... you are right.

Its actually stoping colors being used, however the reset of color is still being done which seems to be the one breaking things.

John Donoghue <lostbard>
Project Member
Mon 17 Feb 2020 03:46:28 PM UTC, comment #20: 

John, can you provide a cset for comment #19?  When I patch octave.vbs like this:

If GUI_MODE = 1 then
  AllArgs = AllArgs & " " & chr(34) & "--gui" & chr(34)
  wshSystemEnv("GCC_COLORS") = "error=00:warning=00:note=00:range1=00:range2=00:locus=00:quote=00:fixit-insert=00:fixit-delete=00:diff-filename=00:diff-hunk=00:diff-delete=00:diff-insert=00"
  wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 0
Else
  wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 1
End If

and revert my cset

https://hg.savannah.gnu.org/hgweb/octave/rev/eb46a9f47164

my text still fades to gray.

Kai Torben Ohlhus <siko1056>
Project Member
Mon 17 Feb 2020 01:48:48 PM UTC, comment #19: 

Looking more into GCC_COLORS environment var, setting it go GCC_COLORS="" doesn't seem to disable colors as the docs appear to suggest, however, setting it to

GCC_COLORS="error=00:warning=00:note=00:range1=00:range2=00:locus=00:quote=00:fixit-insert=00:fixit-delete=00:diff-filename=00:diff-hunk=00:diff-delete=00:diff-insert=00"

Does seem to disable it, so maybe we can just set the env var in octave.vbs.

John Donoghue <lostbard>
Project Member
Mon 17 Feb 2020 06:39:10 AM UTC, comment #18: 

Thank you for the hint Mike

diff -r 75a90bfc14b1 scripts/pkg/private/configure_make.m
--- a/scripts/pkg/private/configure_make.m        Fri Jan 31 10:45:13 2020 -0800
+++ b/scripts/pkg/private/configure_make.m        Mon Feb 17 15:36:39 2020 +0900
@@ -57,6 +57,12 @@ function configure_make (desc, packdir,
     cenv = {"MKOCTFILE"; mkoctfile_program;
             "OCTAVE_CONFIG"; octave_config_program;
             "OCTAVE"; octave_binary};
+    if (ispc () && isguirunning ())
+      ## FIXME: Remove this branch when the MS Windows GUI terminal widget can
+      ##        properly handle colors (bug #57658).
+      cenv = [cenv; {"CXXFLAGS";
+                     ["-fdiagnostics-color=never " getenv("CXXFLAGS")]}];
+    endif
     scenv = sprintf ("%s='%s' ", cenv{:});

     ## Configure.

I was also fine with the restart solution Mike ;-)  I do not often install packages, but I am no pkg developer...

Kai Torben Ohlhus <siko1056>
Project Member
Mon 17 Feb 2020 06:32:07 AM UTC, comment #17: 

In my opinion, it would be better to do nothing, and tell users to restart Octave after installing a package if this happens.

But if you think it's important to inject something into the CXXFLAGS, please get the user value, if any, with getenv, and add the -fdiagnostics-color at the beginning or end.

Mike Miller <mtmiller>
Project Administrator
Mon 17 Feb 2020 05:39:47 AM UTC, comment #16: 

pkg is indeed sneaking around Octave's convenience wrapper by calling make directly.

https://hg.savannah.gnu.org/hgweb/octave/file/eb46a9f47164/scripts/pkg/private/configure_make.m#l94

Unless there are more spots like this in Octave, I propose the following additional patch:

diff -r 75a90bfc14b1 scripts/pkg/private/configure_make.m
--- a/scripts/pkg/private/configure_make.m        Fri Jan 31 10:45:13 2020 -0800
+++ b/scripts/pkg/private/configure_make.m        Mon Feb 17 14:29:37 2020 +0900
@@ -57,6 +57,11 @@ function configure_make (desc, packdir,
     cenv = {"MKOCTFILE"; mkoctfile_program;
             "OCTAVE_CONFIG"; octave_config_program;
             "OCTAVE"; octave_binary};
+    if (ispc () && isguirunning ())
+      ## FIXME: Remove this branch when the MS Windows GUI terminal widget can
+      ##        properly handle colors (bug #57658).
+      cenv = [cenv; {"CXXFLAGS"; "-fdiagnostics-color=never"}];
+    endif
     scenv = sprintf ("%s='%s' ", cenv{:});

     ## Configure.

It works at least on my MS Win 10 VM.

We stay on m-code.  Anyone can easily test gcc colors by removing the code.

On mkoctfile.cc level we have no change to detect if a running GUI called the program.  Thus the decision has to be made to forbid colors in MS Windows entirely.  This I find a pity, since in the terminal they look great.

Unfortunately for Octave 5.2.0 it is too late but for Octave 6 it can get in easily.

Kai Torben Ohlhus <siko1056>
Project Member
Fri 14 Feb 2020 08:47:25 PM UTC, comment #15: 

I just realized for the change to mkoctfile.m, thats only going to work for something that calls mkoctfile from a octave script.

The makefile from a pkg install etc will just call the mkoctfile exe directly.

So to disable the colors being sent to gcc would need the gcc command line changed in the mkoctfile.cc sources.

John Donoghue <lostbard>
Project Member
Tue 28 Jan 2020 02:05:14 AM UTC, comment #14: 

I pushed the following hotfix to stable for Octave 5.2.0:

https://hg.savannah.gnu.org/hgweb/octave/rev/eb46a9f47164

This way we can easily try out if the MS Windows GUI terminal colors are working, just by editing an m-file.

The patch regards the idea of Markus (comment #7) to only avoid colors in the GUI terminal.  In the CLI the colors are indeed very nice.

I rename this item and mark it "dev" problem.

Kai Torben Ohlhus <siko1056>
Project Member
Sun 26 Jan 2020 09:43:16 AM UTC, comment #13: 

I can remember these attempts, too, it was patch #9024. It seems, that there were already some problems with the console window under windows.

Torsten Lilge <ttl>
Project Member
Sat 25 Jan 2020 09:57:46 PM UTC, comment #12: 

BTW, there was an attempt several years back to have colored text in the terminal, e.g., red for errors (can't find it now, IIRC Lachlan worked on it). That attempt stranded because -of all places- in Windows the patch didn't work. It was s/th with ANSI sequences IIRC.
But apparently colors do work somehow in the Windows terminal; maybe time to revive that attempt?

Philip Nienhuis <philipnienhuis>
Project Member
Sat 25 Jan 2020 07:26:33 PM UTC, comment #11: 

To answer my own question, seeting that doesnt work.

Perhaps related, using the octave cli:

 printf('\033[1;34m%s\033[m', "This is text")

Prints the text in blue, however in the GUI disabled a symbol for the esc character.

In octave cli, if I run getenv , it will display an error for the usag and then from that point shows a symbol instead of using the esc code.

John Donoghue <lostbard>
Project Member
Sat 25 Jan 2020 06:51:46 PM UTC, comment #10: 

How about setting env var GCC_COLORS = "" ?

John Donoghue <lostbard>
Project Member
Sat 25 Jan 2020 02:15:08 PM UTC, comment #9: 

Yeah I remember this started happening after an mxe-octave update.

For us contributors/ developers a good reason to stay up-to-date :-)

cc-íng JohnD. Perhaps he can mend s/th in mxe-octave.

Philip Nienhuis <philipnienhuis>
Project Member
Fri 24 Jan 2020 09:41:58 PM UTC, comment #8: 

My test in comment #4 (no colors) was with gcc 8.4.0, thus, I havn't updated my mxe environment for quite a long time.

+1 for the workaround proposed by Kai. 

Torsten Lilge <ttl>
Project Member
Fri 24 Jan 2020 09:43:11 AM UTC, comment #7: 

It looks like the colors in the GUI are the same as the ones in the CLI. These colors have a nice contrast to the black background in the CLI. But some of them are poorly visible against the white background in the GUI.

Is there a way to set the default foreground color for the Windows console? I didn't find any.

The command window on Windows has many deficiencies anyway. And I still hope that we might have a true cross-platform replacement sometime in the future. Thus, I think Kai's work-around might be a good intermediate fix. Maybe we could limit the impact by only adding that option on Windows when using the GUI.

Markus Mützel <mmuetzel>
Project Member
Fri 24 Jan 2020 08:55:32 AM UTC, comment #6: 

Very impressive ^^  My idea is that gcc is tampering with the terminal colors since recent versions.

For Octave 5.1.90:

>> system ("gcc -v")
  [...]
gcc version 9.2.0 (GCC)

For Octave 5.1.90:

>> system ("gcc -v")
  [...]
gcc version 7.4.0 (GCC)

To get some sort of "normal" colors back, one can use

system ("COLOR 01")

or has to restart the Octave session.  Maybe there is a smarter command to reset the window colors?  Please share.

To totally avoid this tampering, if I compile with

mkoctfile -fdiagnostics-color=never .......

https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Diagnostic-Message-Formatting-Options.html

Then it looks pretty much "colorless" as in Octave 5.1.0.  Thus an emergency change would be to add "-fdiagnostics-color=never" to the standard options of mkoctfile.

Thoughts?

Kai Torben Ohlhus <siko1056>
Project Member
Thu 23 Jan 2020 09:09:08 PM UTC, comment #5: 

I have just installed the Octave 5.1.90 exe installer (octave-5.1.90-w64-installer.exe from https://octave.space, Jan 16 version, but same md5 hash as the exe installer on alpha.gnu.org) on a Windows 10 machine. No extra tweaks that I would know of. Win 10 itself is some long-term-support Enterprise version (I could find out precisly if someone tells me it's interesting.)

Hartmut <hardy>
Thu 23 Jan 2020 09:02:24 PM UTC, comment #4: 

Linux does not seem to be affected.
When I try to reproduce this in windows, I do not get colored error messages and the text stays black afterwards. Is there a special trick to get colored error messages in windows (in Linux, I see them, too).

Torsten Lilge <ttl>
Project Member
Thu 23 Jan 2020 01:07:06 PM UTC, comment #3: 

Oopps, yes I've uploaded a "good" screenshot twice, and the "bad" one was missing. I'll attach it now. (And the filenames are misleading, there is no "error" anywhere, except for the described gray text color in version 5.1.90 GUI.)


Hartmut <hardy>
Thu 23 Jan 2020 11:35:46 AM UTC, comment #2: 

@Hartmut: All attached screenshots look good to me. You might have unintentionally uploaded the same screenshot twice.

Markus Mützel <mmuetzel>
Project Member
Thu 23 Jan 2020 10:20:14 AM UTC, comment #1: 

Confirmed with dev Octave.

TBH I noted this already some weeks ago while installing earlier versions of the ocl package (which provoked many warnings and errors), but I didn't bother (other priorities).

Philip Nienhuis <philipnienhuis>
Project Member
Thu 23 Jan 2020 08:45:16 AM UTC, original submission:  

I have observed the following in Octave 5.1.90 (and not in Octave 5.1.0). I have seen this under Windows 10, but am unsure if it also happens under Linux.

Here is how to reproduce the behavior:

  • start the Octave GUI (for information on CLI see below)
  • do something that starts a compilation which will throw an error, maybe a "mkoctfile ..." will do, I used a "pkg install ...".
  • the error message will be displayed in nice and useful colors
  • at the end of the error message the text will turn to grey color (I am unsure if this is intentional)
  • but afterwards, the text color will not return to black and STAY IN GRAY text color. This looks wrong.

In CLI Octave this looks alright, the very error will also be displayed in (red and green) color, and afterwards the text color returns to white on black.

I will attach screenshots to show the colorful behavior.

(This might also happen in dev Octave, I haven't tested for it.)

Hartmut <hardy>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #48446:  Capture.PNG added by nrjank (56KiB - image/png - pkg install color change error)
file #48439:  colors.patch added by lostbard (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by philipnienhuis
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by hardy (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 18 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    21:49 nrjank Attached File- => Added Capture.PNG, #48446
    2020-02-18 lostbard Attached File- => Added colors.patch, #48439
    2020-02-17 siko1056 StatusIn Progress => Need Info
    2020-01-28 rik5 Carbon-CopyRemoved 72865 => -
    2020-01-28 rik5 StatusConfirmed => In Progress
    2020-01-28 siko1056 StatusNeed Info => Confirmed
        Release5.1.90 => dev
        Summarygrey text color after error message in gui console => [MXE Octave] grey text color after mkoctfile error message in gui terminal widget
    2020-01-25 philipnienhuis Carbon-Copy- => Added lostbard
    2020-01-24 siko1056 StatusConfirmed => Need Info
    2020-01-23 mtmiller Releaseother => 5.1.90
        Summarygrey text color after error message in gui console (Octave 5.1.90) => grey text color after error message in gui console
    2020-01-23 hardy Attached File- => Added error_in_5.1.90_=_nice_colors_but_stays_gray.png, #48278
    2020-01-23 philipnienhuis Item GroupInaccurate Result => Incorrect Result
        StatusNone => Confirmed
    2020-01-23 hardy Attached File- => Added error@in@5.1.0@GUI=@black+white.png, #48275
        Attached File- => Added error@in@5.1.90@CLI@=@nice@colors.png, #48276
        Attached File- => Added error@in@5.1.0@GUI=@black+white.png, #48277

    Back to the top


    Powered by Savane 3.5