octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #50108] Matlab fullfile behavior is different


From: Rik
Subject: [Octave-bug-tracker] [bug #50108] Matlab fullfile behavior is different from documentation
Date: Sat, 21 Jan 2017 22:50:46 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Update of bug #50108 (project octave):

                Severity:              3 - Normal => 1 - Wish               
                Priority:              5 - Normal => 1 - Later              
                  Status:                    None => Need Info              
                 Summary: fullfile does not work as it does in Matlab =>
Matlab fullfile behavior is different from documentation

    _______________________________________________________

Follow-up Comment #1:

fullfile() is used to create a valid path from multiple components, not for
changing relative references to absolute ones.  The use case, from the Octave
documentation, is


FILENAME = fullfile (DIR1, DIR2, ..., FILE)


If your interest is in removing relative references, try the
canonicalize_file_name() function.  On a Linux machine,


octave:1> fullfile ('/usr/../bin/')
ans = /usr/../bin/
octave:2> canonicalize_file_name ('/usr/../bin/')
ans = /bin


The documentation reference from The Mathworks is at
http://www.mathworks.com/help/matlab/ref/fullfile.html.  In particular, see
the last sentence of the paragraph below.


fullfile does not trim leading or trailing separators. fullfile collapses
inner repeated file separators unless they appear at the beginning of the full
file specification. fullfile also collapses relative directories indicated by
the dot symbol, unless they appear at the end of the full file specification.
Relative directories indicated by the double-dot symbol are not collapsed.


This implies that Matlab is not even following its own documentation.  Octave
usually doesn't bother to follow undocumented behavior because it could change
at any time.

It would be helpful, since you have access to Matlab, to try the following
test:


fullfile ('/usr', '..', 'bin')


What does that return?


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50108>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]