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

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

[Octave-bug-tracker] [bug #49536] many functions that expect a "string"


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #49536] many functions that expect a "string" silently truncate char matrix arguments (octave_value::string_value)
Date: Sat, 17 Dec 2016 20:36:10 -0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0

Follow-up Comment #7, bug #49536 (project octave):

I made the following change in my local build


diff --git a/libinterp/octave-value/ov-str-mat.cc
b/libinterp/octave-value/ov-str-mat.cc
--- a/libinterp/octave-value/ov-str-mat.cc
+++ b/libinterp/octave-value/ov-str-mat.cc
@@ -234,6 +234,9 @@ octave_char_matrix_str::string_value (bo
 
   charMatrix chm (matrix);
 
+  if (chm.rows () > 1)
+    warning ("evaluating a character matrix as a string, only the first row
is used");
+
   // FIXME: Is this correct?
   return chm.row_as_string (0);
 }


The good news: I can run `make check RUN_OCTAVE_OPTIONS=-cli` and I get no new
test failures or warnings printed on the console or in the log file.

The bad news: I can't run `make check` or run the test suite inside of the
GUI. The test suite errors out completely when it gets to
libinterp/corefcn/error.cc. The octave_qt_link appears to be doing something
whenever a value is in the workspace that always evaluates a char matrix as a
string. I haven't tracked that down yet. Even something as simple as `x =
["one"; "two"];` starts printing the warning message after every prompt until
the value is cleared from the workspace.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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