octave-bug-tracker
[Top][All Lists]
Advanced

[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 13:55:34 -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

Follow-up Comment #9, bug #53034 (project octave):

Mike is correct - and he is saying what I've said from the beginning.

But first some sad corrections: the g_spawn functions to not redirect
/dev/null to stdin, that's nonsense.  They have options to redirect stdout and
stderr to /dev/null, but stdin is simply closed by a call to
close_and_invalidate which in turn calls g_close which in turn calls close on
the file descriptor.

close_and_invalidate further ensures that the stdin filenumber is set to -1.

So my initial patch will make the currently horrible assumption slightly less
horrible.  But like I said in the beginning, it is not the right solution. 
There is no way to polish the turd of an idea of assuming that a failure of
isatty means that stdin is a file.  That's just wrong from the start.

If you want to know if stdin is a file, just check if it's a file.  You may
need a octave_isfile_wrapper or perhaps octave_isfilelike_wrapper if you need
to ensure cross OS support, and I can't help with non-POSIX systems, but the
POSIX version of octave_isfile_wrapper would just call stat, check for EBADF,
and on success check a couple stat macros S_IS*

But *shrug*, I don't care how this goes.  I don't use octave and avoid gnu
tools in general.  I thought I'd give you a heads up on what is plainly a very
bad assumption in your code (that the failure of isatty implies it must be a
file).  Do with it what you will.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53034>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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