public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "João Eiras" <joao.eiras@gmail.com>
To: cygwin@cygwin.com
Subject: Issue with resolving symlinks (realpath, readlink, etc)
Date: Mon, 11 Dec 2017 19:58:00 -0000	[thread overview]
Message-ID: <CAJ+sA07Ek0oFmmXJHqgsiciOJ2=fH3QNFPA0rAfnmev-TMU++A@mail.gmail.com> (raw)

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

             reply	other threads:[~2017-12-11 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 19:58 João Eiras [this message]
2017-12-12 14:14 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ+sA07Ek0oFmmXJHqgsiciOJ2=fH3QNFPA0rAfnmev-TMU++A@mail.gmail.com' \
    --to=joao.eiras@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).