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

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

[Octave-bug-tracker] [bug #33723] Relative to absolute pathname invalid


From: Joshua Nekl
Subject: [Octave-bug-tracker] [bug #33723] Relative to absolute pathname invalid when symbolic links involved
Date: Wed, 06 Jul 2011 18:41:11 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

URL:
  <http://savannah.gnu.org/bugs/?33723>

                 Summary: Relative to absolute pathname invalid when symbolic
links involved
                 Project: GNU Octave
            Submitted by: joshnekl
            Submitted on: Wed 06 Jul 2011 06:41:10 PM GMT
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.4.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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

mkdir -p mydir/tmp
ln -s mydir/tmp mylink
echo "disp('Hello World');" >>mydir/hello.m
octave -q <<EOF
addpath('mylink/..');
ls mylink/..
hello
EOF


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().





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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