[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53034] Octave GUI fails to open when stdin cl

From: anonymous
Subject: [Octave-bug-tracker] [bug #53034] Octave GUI fails to open when stdin closed. Patch included
Date: Thu, 1 Feb 2018 08:37:07 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.10.0 Chrome/61.0.3163.140 Safari/537.36


                 Summary: Octave GUI fails to open when stdin closed.  Patch
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 01 Feb 2018 01:37:05 PM UTC
                Category: GUI
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: jmcclure
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux



The Octave gui checks to see whether stdin is a tty prior to launching to gui
itself.  It seems the goal is to check whether octave is being sent a script
it should run in which case the gui need not launch.

The current implemented logic is, if stdin is a tty, run the gui, otherwise
assume stdin is a file and do not run the gui.  This is rather absurd.  Check
if stdin is a file, and if it is, not launch the gui, otherwise do so.

This faulty logic fails on all cases where stdin is neither a file nor a tty
(e.g., when stdin has been closed by a launcher such as one of the gnu gspawn

This appeared on our distros forums here:

A gnu developer even chimed in, but seemed to take no note of the actual
solution.  I see updates have been made in the intervening time, but this
problem has not been address.

The following minimal patch with avoid the problem when stdin is closed.  For
a longer term solution I'd encourage the above: if you want to know if stdin
is a file, check if it is a file with `stat`; don't just check if it's a tty
and assume it's a file otherwise.

--- a/octave-gui.cc
+++ b/octave-gui.cc
@@ -115,7 +115,7 @@
     // with no terminal) and you want to start the GUI, you may use the
     // --force-gui option to start the GUI.
-    if (! octave_isatty_wrapper (fileno (stdin)))
+    if (fileno(stdin) != -1 && !octave_isatty_wrapper (fileno (stdin)))
       return false;
     // If we have code to eval or execute from a file, and we are going


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]