Stumbled upon relative name resolution across symlinks
Ken Brown
kbrown@cornell.edu
Fri Nov 2 12:15:00 GMT 2018
On 11/1/2018 6:39 PM, Andrey Repin wrote:
> Greetings, All!
>
> $ pwd
> /home/anrdaemon/Documents/NIX/CA-tutorial/test
>
> $ ls -ld bin ca-profile
> lrwxrwxrwx 1 anrdaemon None 61 ноя 2 01:15 bin -> /home/anrdaemon/Documents/NIX/CA-tutorial/svn-working/scripts
> -rwx--x--x 1 anrdaemon None 588 дек 24 2017 ca-profile
>
> $ cat bin/../ca-profile
> cat: bin/../ca-profile: No such file or directory
>
> $ cat $( realpath -Le "bin/../ca-profile" )
> # @version $Id: ca-profile 82 2014-02-08 05:24:12Z anrdaemon $
> ...
>
> In simpler words, the bin directory is symlinked from elsewhere.
> realpath -Le resolves correctly, but all other filesystem functions fail.
I might be misunderstanding you, but are you saying that you think 'bin/..'
should resolve to the current working directory? This is not what Posix says.
See http://pubs.opengroup.org/onlinepubs/9699919799/, starting at "If a symbolic
link is encountered during pathname resolution...". The reason you got what you
wanted using 'realpath -L' is that the -L option specifically asks for that:
$ man realpath
[...]
-L, --logical
resolve '..' components before symlinks
Ken
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list