Question about resolving "symlink/.."

Jared C. Davis jared.c.davis at gmail.com
Thu Sep 8 11:07:03 UTC 2016


Hi,

I have set up the following directory hierarchy:

       lstest-dir
         |
     +---+------------------+
     |                      |
      subdir1                subdir3 ---symlink---+
     |                                        |
       +-+---------+                              |
       |           |                              |
      xxxdir      subdir2  <----------------------+
       |               |
      xxx.txt        yyydir
               |
             yyy.txt

On my linux system, shell commands like "ls" seem to resolve
paths such as "lstest-dir/subdir3/.." to "lstest-dir/subdir1".
For instance:

    $ ls lstest-dir/subdir3/../xxxdir
    xxx.txt

In other words, when a path goes through "<symlink>/..", it seems
to be resolved by first following the symlink, then finding the
parent directory of the symlink's target.

However, it appears that uiop:ensure-directory-pathname resolves
".." in a different way.  For instance, on CCL on Linux, when I
run:

   (uiop:ensure-directory-pathname
      (uiop:parse-native-namestring "lstest-dir/subdir3/.."))

I get #P"lstest-dir/" instead of #P"lstest-dir/subdir1".

Is there a way to configure ensure-directory-pathname to use a
more shell-like behavior, or some other alternative that I might
run to preprocess the path to resolve these obscure cases like
the shell does?

Thanks,
Jared


-- 
Jared C. Davis <jared.c.davis at gmail.com>
11410 Windermere Meadows
Austin, TX 78759
http://www.cs.utexas.edu/users/jared/



More information about the asdf-devel mailing list