This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Issue with resolving symlinks (realpath, readlink, etc)
- From: João Eiras <joao dot eiras at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 11 Dec 2017 18:18:30 +0100
- Subject: Issue with resolving symlinks (realpath, readlink, etc)
- Authentication-results: sourceware.org; auth=none
Hi.
Programs and functions that rely in realpath() are broken.
Example:
$ cd
$ ln -s /var symlink
$ cd symlink
$ readlink -m .
/var
$ mkdir subfolder
$ cd subfolder
$ readlink -m .
/home/user/symlink/subfolder
# should be /var/subfolder
This is the block I think is causing problems, as it breaks the loop
as soon as a real file is found, instead of iterating further upwards
resolving ancestors.
https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/path.cc#l994
There also a comment at line 736 that says:
"Scan path_copy from right to left looking either for a symlink or an
actual existing file. If an existing file is found, just return. If a
symlink is found, exit the for loop."
Thank you.
--
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