Michal Schmidt writes:
On 07/18/2012 12:35 AM, Sam Varshavchik wrote:
> Really? An example of a "symbolic link pointing to a non-existent
> pathname"?
>
> lrwxrwxrwx. 1 root root 15 Jul 17 18:02 /dev/stderr → /proc/self/fd/2
> lrwxrwxrwx. 1 root root 15 Jul 17 18:02 /dev/stdin → /proc/self/fd/0
> lrwxrwxrwx. 1 root root 15 Jul 17 18:02 /dev/stdout → /proc/self/fd/1
>
> You mean to tell me that none of those symlinks exist? Could've fooled me:
Cut the sarcasm.
In your example they existed, but generally they do not have to. Try this:
$ while :; do echo hello; sleep 10; done > /tmp/dumbdumbdumb &
[1] 32595
$ rm /tmp/dumbdumbdumb
$ readlink /proc/32595/fd/1
/tmp/dumbdumbdumb (deleted)
$ cat /proc/32595/fd/1
hello
hello
See? We have an actual magical symlink that points to a non-existing path
and yet it can still be opened.
Ok. I was wondering if there was any other case similar to /proc/pid/exe
where you have a symlink from /proc pointing to a non-existent file, yet
still can be opened.
You said yes, and you offered a different symlink from /proc pointing to a
non-existent file, as an example.
Ok, so we've established that /proc symlinks have the ability to do that.
Great. Now, anything else?