Unix interpretation of symlinks?

时间:2018-03-22 23:21:41

标签: linux shell filepath symlink bsd

I'm working on hybrid semantic-hierarchical filesystem using FUSE and VFS-only interface. One of primary solutions to simplify i/o is to use symlinks in search results instead of actual files/ It also gets rid of i/o middleware.

While files are quite simple I'm having some doubts about directories symlinks - their behavior doesn't seem to be really standardized across applications. I've set up simple test hierarchy with following directories and symlink:

./test
./test/subtest
./test/link -> ./subtest
./test/subtest/sub

And tested it in number of shells and file managers:

  • All graphical file managers (PCManFM, Thunar, Nautilus, Konqueror, Dolphin) remember path of symlinks as expected
  • bash, sh,ksh and zsh seem to also remember all symlinks
  • csh, tcsh and fish seem to perform naive symlink resolution so that:

    $ cd ./test/link
    $ pwd
    /.../test/subtest
    

Is there any "standard" way to behave in such scenario? Selection of csh and tcsh sounds quite... not accidental to me. Is it related to UNIX System V vs. BSD way of handling things? It's quite confusing and I sense some potential incompatibility caused by such different behavior of mentioned shells...

0 个答案:

没有答案