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

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

[Octave-bug-tracker] [bug #33330] fgets hangs octave when reading newlin


From: Rik
Subject: [Octave-bug-tracker] [bug #33330] fgets hangs octave when reading newline
Date: Tue, 17 May 2011 20:17:38 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

Follow-up Comment #1, bug #33330 (project octave):

Confirmed.  The problem seems to be an attempt to mimic Matlab's behavior
exactly.  In this case it forces a kludge which works with files, which are
non-blocking I/O, but fails with pipes where the process blocks and waits for
new input.

If you are building from source, the solution is to comment out the kludge
which begins at line 988 of the file oct-stream.cc and encompasses this
stanza


if (! is.eof () && char_count > 0)
  {
    // GAGME.  Matlab seems to check for EOF even if the last
    // character in a file is a newline character.  This is NOT
    // what the corresponding C-library functions do.
    int disgusting_compatibility_hack = is.get ();
    if (! is.eof ())
      is.putback (disgusting_compatibility_hack);
  }


I'll also post something to the octave-maintainers mailing list.  It may be
that Matlab has changed and we can ditch this hack entirely.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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