bugGNU Octave - Bugs: bug #67004, help of a function not found in...

 
 

bug #67004: help of a function not found in some cases

Submitter:  F. Cuvelier <cuvelierp13>
Submitted:  Thu 10 Apr 2025 06:18:04 AM UTC
   
 
Category:  Octave Function Severity:  5 - Blocker
Priority:  7 - High Item Group:  Regression
Status:  Fixed Assigned to:  jwe
Originator Name:  Open/Closed:  * Closed
Release:  * 10.1.0 Release: 
Operating System:  * Any Fixed Release:  10.2.0 (current stable)
Planned Release:  10.2.0 (current stable)
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 15 Apr 2025 05:33:05 PM UTC, comment #6: 

New code works for the example in this report, and help on ordinary files (ls.m, inputParser.m, @audiorecorder/audiorecorder.m).

Marking as Fixed and closing report.

Rik <rik5>
Group administrator
Fri 11 Apr 2025 04:16:20 PM UTC, comment #5: 

Thanks. I followed up with a change that removes the visibility attribute from a function that is defined in the header:
https://hg.savannah.gnu.org/hgweb/octave/rev/c399206e30ba

That lead to compilation errors on Windows:
https://github.com/gnu-octave/octave/actions/runs/14404694929/job/40398232902#step:10:4071

../libinterp/octave-value/ov-usr-fcn.h:252:38: error: function 'octave::comment_list octave_user_function::leading_comments() const' definition is marked dllimport
  252 |   OCTINTERP_API octave::comment_list leading_comments () const { return m_fcn_tok.leading_comments (); }
      |                                      ^~~~~~~~~~~~~~~~


Markus Mützel <mmuetzel>
Group administrator
Fri 11 Apr 2025 02:03:00 PM UTC, comment #4: 

Thanks for the review.  I pushed a changeset on stable, merged with default.

https://hg.savannah.gnu.org/hgweb/octave/rev/06a66318a46b

Regarding library versions, yes, this change should be backward compatible so fine to go on stable.  When 10.2 is released, we should increment the libtool current and age versions for liboctinterp.

The explanation about what should happen with these library versions still seems a bit confusing.  I'm considering a change to make it clear that the libtool version info determines the shared library file version number but they are not the same thing.  Maybe the following statements would also help with understanding the intent of the libtool versions:

  • Backwards-incompatible change: bump current, set revision and age to 0.
  • Backwards-compatible change: bump current and age, set revision to 0.
  • No API change: bump revision.



John W. Eaton <jwe>
Group administrator
Fri 11 Apr 2025 01:30:21 PM UTC, comment #3: 

That patch looks good to me. 👍

Making `leading_comments` a pure virtual function in the `octave::tree` class is probably a good idea to make sure that there is an actual implementation for this member function in all parse tree elements.

I don't think that making this a pure virtual function would count as removing a function from the API.
Also, adding `trailing_comments` probably means that the "effective soversion" (current - age) of liboctinterp wouldn't change.
So, I think this should be fine to go on the stable branch in its current form (without angering distributors 😉).

Markus Mützel <mmuetzel>
Group administrator
Fri 11 Apr 2025 05:19:52 AM UTC, comment #2: 

Here is a more complete patch that handles many more (all?) of the parse tree elements.

Also, moving the help text before the function keyword instead of having it in the body of the function should be another way of avoiding the error with Octave 10.1.



(file #57129)

John W. Eaton <jwe>
Group administrator
Thu 10 Apr 2025 07:20:20 AM UTC, comment #1: 

It's not the fileparts function, it's the "[...] = ..." assignment syntax immediately following the help text comment block.  This problem can also happen if the first expression after the comment block is a simple constant.

It looks like I introduced this problem when I was working on improving the way Octave's parser stores comments and location info.

I'm attaching a possible patch for these two cases (unfortunately, there may be more).

I know that it's not ideal, but you can also work around the problem by modifying your function to look something like this:


function filepath = foo (filename)
% help of foo
%
% some help

% dummy statement to work around embarrassing
% parser bug in Octave 10.1
filename;

[filepath,...] = ...

end



(file #57123)

John W. Eaton <jwe>
Group administrator
Thu 10 Apr 2025 06:18:04 AM UTC, original submission:  

With a simple function foo.m using <fileparts> function:

function filepath=foo(filename)
% help of foo
%
%  some help

[filepath,shortfilename,fileext]=fileparts(filename);
% ...
end

the command <help foo> does not work with Octave 10.1.0 (OK with previous) :

> help foo
'foo' is a function from the file /home/<user>/foo.m

undocumented function: filepath = foo (filename)
...


F. Cuvelier <cuvelierp13>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #57129:  parser-comments-diff.txt added by jwe (32KiB - text/plain)
file #57123:  parser-comments-diff.txt added by jwe (2KiB - text/plain)
file #57122:  foo.m added by cuvelierp13 (126B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by cuvelierp13 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-04-15 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 10.2.0 (current stable)
    2025-04-11 jwe StatusPatch Reviewed Ready For Test
    2025-04-11 mmuetzel StatusNone Patch Reviewed
        Operating SystemGNU/Linux Any
    2025-04-11 jwe Attached File- Added parser-comments-diff.txt, #57129
    2025-04-10 jwe Severity3 - Normal 5 - Blocker
        Priority5 - Normal 7 - High
        Assigned toNone jwe
        Planned ReleaseNone 10.2.0 (current stable)
        Summaryhelp of a function not found when the function use &lt;fileparts&gt; function!? help of a function not found in some cases
    2025-04-10 jwe Attached File- Added parser-comments-diff.txt, #57123
    2025-04-10 cuvelierp13 Attached File- Added foo.m, #57122

    Back to the top

    Powered by Savane 3.14-962f.
    Corresponding source code