# HG changeset patch # User Rik # Date 1475189094 25200 # Node ID 121e9639b604808d12c993c09e08fd627a154a77 # Parent 53209d4c94218904af4808369c5e48ed8f29fc0d doc: Correctly get last entry from DOCSTRINGS file (bug #49224). * help.cc (raw_help_from_docstrings_file): If eof is hit, seek the file pointer back to the end of the data in the file. Compute the length of the last DOCSTRING entry as the difference between the end of the file and the start of the last entry. Reset the eof flag manually so that the while loop will exit. diff -r 53209d4c9421 -r 121e9639b604 libinterp/corefcn/help.cc --- a/libinterp/corefcn/help.cc Thu Sep 29 13:55:26 2016 -0400 +++ b/libinterp/corefcn/help.cc Thu Sep 29 15:44:54 2016 -0700 @@ -421,7 +421,16 @@ file.ignore (std::numeric_limits::max(), 0x1d); // Position of end of help text. - std::streamoff len = file.tellg () - beg - 1; + std::streamoff len; + + if (! file.eof ()) + len = file.tellg () - beg - 1; + else + { + file.seekg (0, file.end); + len = file.tellg () - beg - 1; + file.setstate (file.eofbit); // reset eof flag + } help_txt_map[name] = txt_limits_type (beg, len); }