This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Issue with resolving symlinks (realpath, readlink, etc)

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.
> 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 Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]