bugGNU Octave - Bugs: bug #33723, Relative to absolute pathname...

 
 

bug #33723: Relative to absolute pathname invalid when symbolic links involved

Submitted by:  Joshua Nekl <joshnekl>
Submitted on:  Wed 06 Jul 2011 06:41:10 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Other
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sat 16 May 2015 06:48:05 PM UTC, comment #1:

I am going through old bugs and found this report still open with no activity.

I tested this in the current version of Octave, it is still as you describe. I got someone to also test this in Matlab and the behavior is actually the same, so we are no worse than the competition.

As a workaround, if you use full paths it does work correctly, i.e.:

which is the better solution anyway, because now you can chdir and not break your function load path.

I'm not sure this is worth fixing, and since no one else has commented or considered fixing this in several years, closing as won't fix. But feel free to follow up with more information or a patch and this can be easily reopened.

Mike Miller <mtmiller>
Project Administrator
Wed 06 Jul 2011 06:41:10 PM UTC, original submission:

liboctave/oct-env.cc
octave_env::do_make_absolute()
// FIXME -- this is probably not correct for all systems

This function makes relative paths absolute. If a '../' is encountered, it removes the previous directory component using pathname_backup() and skips the ../ component.

If the directory being removed is a symbolic link that contains more path components, symlink/.. != .

For example

The ls command shows hello.m exists in mylink/../hello.m since it is located in mydir/tmp/../hello.m == mydir/hello.m, but do_make_absolute strips mylink/.. and tries to look for hello.m in the current directory.

In this simple example I could have used addpath('mydir'), but in the case where I uncovered this problem my symbolic link points to a test directory within another project hierarchy and I need to dereference symlink/.. to get to the source directory.

A solution might be to use realpath() from stdlib.h in do_make_absolute().

Joshua Nekl <joshnekl>

 

(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 mtmiller (Posted a comment)
  • -unavailable- added by joshnekl (Submitted the item)
  •  

    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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 16 May 2015 06:48:05 PM UTCmtmillerStatusNone=>Wont Fix
      Open/ClosedOpen=>Closed
      Release3.4.2=>dev
      Operating SystemGNU/Linux=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1