* 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
* Re: Issue with resolving symlinks (realpath, readlink, etc)
2017-12-11 19:58 Issue with resolving symlinks (realpath, readlink, etc) João Eiras
@ 2017-12-12 14:14 ` Corinna Vinschen
0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2017-12-12 14:14 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]
On Dec 11 18:18, João Eiras wrote:
> 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."
This is an old problem in the path_conv class, given that POSIX
mandates scanning the patch from left to right.
However, changing this isn't simple. For one thing the path conversion
POSIX<->Windows is already slower than desired, and scanning from left
to right would make it probably worse. But the real problem is that
this would basically mean a re-write of the path_conv class. Given how
much this is a core component it's quite the task.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ 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).