bugGNU Octave - Bugs: bug #50108, Matlab fullfile behavior is...

 
 

bug #50108: Matlab fullfile behavior is different from documentation

Submitted by:  None
Submitted on:  Sat 21 Jan 2017 08:29:29 AM UTC  
 
Category: Octave FunctionSeverity: 1 - Wish
Priority: 1 - LaterItem Group: Matlab Compatibility
Status: Wont FixAssigned to: None
Originator Name: MakhnoOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.0.0
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Mon 23 Jan 2017 05:11:14 PM UTC, comment #9:

FTR, Matlab r2017a prerelease on Win7 64 bit:

Is fullpath only supported on Linux?
I could try to install the prerelease on Linux as well and try there.

Philip Nienhuis <philipnienhuis>
Project Member
Mon 23 Jan 2017 04:28:32 PM UTC, comment #8:

This definitely illustrates why we only try to follow the documented behavior because Matlab changes fairly often (for a mature piece of software). I think Octave is good enough as is. Maybe if they re-define their behavior again in R2017 or R2018 we can follow it then.

Rik <rik5>
Project Administrator
Mon 23 Jan 2017 10:03:28 AM UTC, comment #7:

It seems Matlab ~2015 introduced a new fullpath which still has bugs. Eg

>>fullpath('C:\','\')

ans=C:\\

Surprisingly unprofessional.

Anonymous
Mon 23 Jan 2017 09:45:38 AM UTC, comment #6:

Ah ha:

>>version

ans=9.1.0.441655 (R2016b)

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

and=\usr\..\bin

So it looks like they've fixed this 'bug', which is unfortunate.

Anonymous
Mon 23 Jan 2017 07:25:20 AM UTC, comment #5:

On Windows:

>> version

ans =
8.3.0.532 (R2014a)

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

ans =
\bin\

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

ans =
\bin\

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

ans =
\bin

>>


Paths don't have to really exist, this is just a strings manipulation.

Anonymous
Sun 22 Jan 2017 04:50:43 PM UTC, comment #4:

Another thing to check is whether Matlab is just collapsing ".." or if it is also resolving symbolic links. I.e., does it do the full job of canonicalize_file_name or just the relative path part.

Also, does it only collapse ".." when it is in the middle of a file name? What about at the end or beginning? And what does it do with things like "./foo" or "~/foo"?

As long as Octave concatenates the parts and returns a valid filename, then I don't really see a bug here.

John W. Eaton <jwe>
Project Administrator
Sun 22 Jan 2017 03:15:01 PM UTC, comment #3:

We treat inconsistency with documented Matlab behavior as a bug. Their documentation seems reasonably clear about what is supposed to happen, and that's why I need the results of

from a recent version of Matlab. This looks to be a Matlab bug, not an Octave one.

Rik <rik5>
Project Administrator
Sun 22 Jan 2017 12:42:39 PM UTC, comment #2:

Well, whether you treat this as a bug depends on whether you treat being inconsistent with Matlab bugs as a bug.
If not then feel free to close. Having '..' in the path doesn't seem to cause any problems anyway.

Anonymous
Sat 21 Jan 2017 10:50:46 PM UTC, 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

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

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.

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:

What does that return?

Rik <rik5>
Project Administrator
Sat 21 Jan 2017 08:29:29 AM UTC, original submission:

Octave:

>> fullfile('/one/../two')

ans = /one/../two

Matlab:

>> fullfile('/one/../two')

ans = /two

Which seems to be the whole point of fullfile really.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 23 Jan 2017 04:28:32 PM UTCrik5StatusNeed Info=>Wont Fix
      Open/ClosedOpen=>Closed
    Sat 21 Jan 2017 10:50:46 PM UTCrik5Severity3 - Normal=>1 - Wish
      Priority5 - Normal=>1 - Later
      StatusNone=>Need Info
      Summaryfullfile does not work as it does in Matlab=>Matlab fullfile behavior is different from documentation

    Back to the top


    Powered by Savane 3.1-cleanup1