public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Issue with resolving symlinks (realpath, readlink, etc)
@ 2017-12-11 19:58 João Eiras
  2017-12-12 14:14 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: João Eiras @ 2017-12-11 19:58 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-12  9:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-11 19:58 Issue with resolving symlinks (realpath, readlink, etc) João Eiras
2017-12-12 14:14 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).