0

Let's assume that the root folder of what I'm working with is frameworks/av, and this folder have the following content:

-rw-rw-r--  1 <user> <user>    94 Mar 21 14:34 Android.bp
drwxrwxr-x  8 <user> <user>  4096 Mar 21 14:34 camera/
-rw-rw-r--  1 <user> <user>  5394 Jul 16  2018 CleanSpec.mk
drwxrwxr-x  4 <user> <user>  4096 Jul 16  2018 cmds/
drwxrwxr-x  8 <user> <user>  4096 Jul 16  2018 drm/
drwxrwxr-x  2 <user> <user>  4096 Mar 26 21:30 .git/
drwxrwxr-x  8 <user> <user>  4096 Mar 21 14:34 include/
drwxrwxr-x 25 <user> <user>  4096 Mar 21 14:34 media/
-rw-rw-r--  1 <user> <user>     0 Mar  2  2018 MODULE_LICENSE_APACHE2
-rw-rw-r--  1 <user> <user> 17680 Mar  2  2018 NOTICE
-rw-rw-r--  1 <user> <user>    76 Jul 16  2018 OWNERS
drwxrwxr-x  3 <user> <user>  4096 Mar 21 14:34 packages/
drwxrwxr-x 14 <user> <user>  4096 Mar 21 14:34 services/
drwxrwxr-x  2 <user> <user>  4096 Jul 16  2018 soundtrigger/
drwxrwxr-x  3 <user> <user>  4096 Mar 21 14:34 tools/

In frameworks/av/include/media/stagefright, I find this link, foundation, which by its description should point to frameworks/av/foundation/...:

lrwxrwxrwx 1 <user> <user> 57 Jul 16 2018 foundation -> ../../../foundation/include/media/stagefright/foundation//

What really puzzles me is that there is no folder foundation in frameworks/av, yet I can follow the link just fine. The real target, as given by readlink -f foundation, is frameworks/av/media/libstagefright/foundation/include/media/stagefright/foundation.

What is going on here? How can foundation magically translate into media/libstagefright/foundation?

thomas_f
  • 103

1 Answers1

1

When you descend into frameworks/av/include/media/stagefright there is at least one symlink you go through. In effect the logical path is frameworks/av/include/media/stagefright but the physical one is not.

Then the symlink in question goes three levels up (../../../) and further from there, but this uses the physical directory structure you're obviously not aware of. Your shell may still track the logical path though.

Compare Why does ls .. show real parent content when I'm inside a symbolic link directory?