octave segfault under AIX/shared

G.. gail at tnp-online.de
Wed Dec 5 06:42:48 CST 2007



John W. Eaton wrote:
> 
> | You're right. The error is not in file.length. It occurs in the function
> | file_ops::is_dir_sep from liboctave:
> | -----------
> | bool
> | file_ops::is_dir_sep (char c)
> | {
> |   return dir_sep_chars.find (c) != NPOS;                                                                                                                                      
> | }
> | -----------
> | If that function generally returns 0 (for example) everything works.
> 
> So how is this function buggy?  On an AIX system, I would expect
> dir_sep_chars to be a std::string object containing the single
> character '/' and NPOS should be defined in config.h to be
> std::string::npos.  The call to std::string::find should return NPOS
> if the character C is not found and the function should return false
> in that case and true if C is equal to '/'.  So how does this fail on
> your system?
> 

I don't know as my C++ skills are limited. But I know that if I add the
definition of file_ops::is_dir_sep *before* it is called in
default_history_file (see patch), then it works.

G.

-----------------------------------
--- oct-hist.cc 2007-10-12 23:27:30.000000000 +0200
+++ /tmp/oct-hist.cc    2007-12-05 13:37:06.000000000 +0100
@@ -76,6 +76,16 @@
 // TRUE means input is coming from temporary history file.
 bool input_from_tmp_history_file = false;
 
+char file_ops::dir_sep_char = '/';
+std::string file_ops::dir_sep_str ("/");
+std::string file_ops::dir_sep_chars (file_ops::dir_sep_str);
+
+bool
+file_ops::is_dir_sep (char c)
+{
+  return dir_sep_chars.find (c) != NPOS;
+}
+
 static std::string
 default_history_file (void)
 {
-----------------------------------------------

-- 
View this message in context: http://www.nabble.com/octave-segfault-under-AIX-shared-tf4886987.html#a14170876
Sent from the Octave - Bugs mailing list archive at Nabble.com.



More information about the Bug-octave mailing list