realpath of a symlink under a symlink returns parent realpath. #167

Closed
Nthalk opened this Issue Jun 4, 2010 · 2 comments

Projects

None yet

2 participants

@Nthalk
Nthalk commented Jun 4, 2010

When symlinking a library under the symlink of the libraries path, running fs.realpathSync returns the parent's realpath. When the child path is further under a directory, this is still the case, making it difficult to find the real path of the intended child.

    carl@orbital-lin ~
    $ cat test.js 
    var sys = require("sys");
    var fs = require("fs");

    var lib = "/home/carl/.node_libraries";
    sys.puts("Node Library Path: " + lib);
    sys.puts("Node Library Real: " + fs.realpathSync(lib));

    var lnmm = "/home/carl/.node_libraries/lnmm";
    sys.puts("Node Library Symlink Path: " + lnmm);
    sys.puts("Node Library Symlink Real: " + fs.realpathSync(lnmm));

    carl@orbital-lin ~
    $ node test.js 
    Node Library Path: /home/carl/.node_libraries
    Node Library Real: /home/carl/local/lib/node
    Node Library Symlink Path: /home/carl/.node_libraries/lnmm
    Node Library Symlink Real: /home/carl/local/lib/node
    carl@orbital-lin ~
    $ ls -la /home/carl/.node_libraries/lnmm
    lrwxrwxrwx 1 carl carl 35 2010-06-04 10:08 /home/carl/.node_libraries/lnmm -> /home/carl/local/workspaces/js/lnmm
@Nthalk
Nthalk commented Jun 4, 2010

Note how:
Node Library Symlink Path: /home/carl/.node_libraries/lnmm
Node Library Symlink Real: /home/carl/local/lib/node
Does not match:
/home/carl/.node_libraries/lnmm -> /home/carl/local/workspaces/js/lnmm

@ry
ry commented Nov 16, 2010

fixed in 3c9746d

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment