octave segfault under AIX/shared
John W. Eaton
jwe at bevo.che.wisc.edu
Tue Dec 4 18:02:59 CST 2007
On 4-Dec-2007, G.. wrote:
| John W. Eaton wrote:
| >
| > On 4-Dec-2007, G.. wrote:
| >
| > | G.. wrote:
| > | >
| > | > ~/octave-2.9.17> ./run-octave
| > | > ./run-octave[67]: 500156 Segmentation fault(coredump)
| > | >
| > |
| > | I can make it work now! The problem was the generation of the history
| > | filename. If OCTAVE_HISTFILE was set it works. Alternatively, one can
| > | comment out the "file_ops::is_dir_sep"-clause in the function
| > | default_history_file below (probably related to: file[file.length()-1]).
| >
| > I'm not sure I see the problem with the code below. If
| > OCTAVE_HISTFILE is not set, then env_file should be empty, so file is
| > not set from it. Then file is empty, so we look for the home
| > directory. If it is not empty, then file is set to home_dir, and
| > file.length() should be greater than zero, so file.length()-1 should
| > be the last character of file.
| >
| > What does file.length() return on your system?
| >
| 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?
jwe
More information about the Bug-octave
mailing list