bugGNU Octave - Bugs: bug #53707, mfilename returns empty for...

 
 

bug #53707: mfilename returns empty for filenames beginning with period

Submitter:  Ceral Paquet <octavebugs>
Submitted:  Fri 20 Apr 2018 08:51:59 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 22 Apr 2018 01:13:46 AM UTC, comment #3: 

I checke in a change to the development branch along the lines you suggested.  I also modified the documentation to be a little clearer.  See http://hg.savannah.gnu.org/hgweb/octave/rev/01ad54f997f5.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 20 Apr 2018 11:22:19 AM UTC, comment #2: 

Checked it and yes that works.

Ceral Paquet <octavebugs>
Fri 20 Apr 2018 09:43:28 AM UTC, comment #1: 

My C++ might be up to this challengs :)

I think the only change needed is in libinterp/parse-tree/oct-parse.yy on line 4727.

This


      if (epos <= dpos)
        epos = std::string::npos;

      fname = (epos != std::string::npos) ? fname.substr (0, epos) : fname;


becomes


      if (epos <= dpos+1)
        epos = std::string::npos;

      fname = (epos != std::string::npos) ? fname.substr (0, epos) : fname;


I'm currently recompiling to see if this does what I think it does. I.e. if the last period '.' is also the first character then don't strip off the extension.

Ceral Paquet <octavebugs>
Fri 20 Apr 2018 08:51:59 AM UTC, original submission:  

I like to use the following command in my startup file.

fprintf('Executing startup file: %s\n',mfilename)

Unfortunately mfilename returns empty for the .octaverc file. Would it be possible to handle the starting period as a special case, i.e. not as an extension.

Note that MATLAB is much more fussy and won't even execute functions with a starting period.

Ceral Paquet <octavebugs>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 octavebugs (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-22 rik5 CategoryNone Octave Function
        Item GroupNone Inaccurate Result
        StatusNone Fixed
        Open/ClosedOpen Closed
        Release4.2.1 dev

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code