delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/03/05/05:24:50

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=UeqX43NUXyMCFxqn4F2PeK0Eq7oKV0U+awTEBl03tt0FhzwH8UHSX
2+P/oDNe7aI7RvDWkk9eBZ+PtfDO9WyAhwFwoujzudxC0LJRhnEeCCODTu1qis1A
jtcXT4lOy97yMAwRVh7ewYb8reJpKHBN4kTd7k6AGjsRwkDY7B+NiM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=ZBGCb+C5Qk2t0nQRz0UpVvst+zI=; b=MOOnXFCCaBakP6Cd6keTowdBGRTy
d2JiAk91amhcKiwGx++8A2cJq4CYh55pNo9zR/L5f6U9RuLcruvg2oULUP/6SeNK
SZW0IW6KGfDAduKz+8oNiKF/PytSPldZOxo2jqIJmOUoz0Q4hgbsdblxPkctaF8A
O3o+NM3+Cd/TfQg=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Wed, 5 Mar 2014 11:24:27 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Improper symlink resolution
Message-ID: <20140305102427.GA2192@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <5314D08A DOT 3010806 AT Oracle DOT com> <53164A39 DOT 5090008 AT Oracle DOT com>
MIME-Version: 1.0
In-Reply-To: <53164A39.5090008@Oracle.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--ZGiS0Q5IWpPtfppv
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mar  4 14:48, Paul Gilmartin wrote:
> On Windows 7, Cygwin 1.7.28(0.271/5/3), the script:
>=20
> 603 $ cat badsyml
> # #######################################################
> #! /bin/sh -x
>=20
> uname -a
>=20
> mkdir -p wombat/foo1/foo2
> cd wombat
> ln -s foo1/foo2 .
> date >foo1/xyzzy
>=20
> find . -ls
> cat   foo2/../xyzzy
> # #######################################################
>=20
> Fails with:
> # #######################################################
> 604 $ rm -r wombat
> 605 $ ./badsyml
> badsyml 3+ uname -a
> CYGWIN_NT-6.1-WOW64 PGILMART-US 1.7.28(0.271/5/3) 2014-02-04 16:18 i686 C=
ygwin
> badsyml 5+ mkdir -p wombat/foo1/foo2
> badsyml 6+ cd wombat
> badsyml 7+ ln -s foo1/foo2 .
> badsyml 8+ date
> badsyml 10+ find . -ls
> 33495522228574359    0 drwxr-xr-x   1 PGILMART None            0 Mar  3 1=
1:22 .
> 104427216359660155    0 drwxr-xr-x   1 PGILMART None            0 Mar  3 =
11:22 ./foo1
> 310185424335151883    0 drwxr-xr-x   1 PGILMART None            0 Mar  3 =
11:22 ./foo1/foo2
> 90916417477552943    1 -rw-r--r--   1 PGILMART None           27 Mar  3 1=
1:22 ./foo1/xyzzy
> 12103423998567573    1 lrwxrwxrwx   1 PGILMART None            9 Mar  3 1=
1:22 ./foo2 -> foo1/foo2
> badsyml 11+ cat foo2/../xyzzy
> cat: foo2/../xyzzy: No such file or directory
> 606 $
> # #######################################################
>=20
> I believe, rather, that the PWD environment variable is a
> feature of the POSIX shell (implemented by bash) and should
> not affect the operation of utilities such as "cat" or the
> underlying system calls.  The symbolic link to ".." (parent
> directory) should be resolved, not relative to the logical
> path that reached it, but to the directory physically containing
> it, as Linux, Solaris, z/OS, and OS X do:

This is a known problem and nothing we can easily change without a
complete rewrite of the core path handling code.  We described this in
great length on this list already, so, please search the archives.  But,
basically, the code is performing a few non-POSIXy shortcuts to speed up
path conversion from POSIX to Windows paths, mainly:

- checking the path backwards rather than forward as mandated by POSIX,

- and folding ".." path components from the path before checking the
  parent path component for being a symlink.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--ZGiS0Q5IWpPtfppv
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJTFvtbAAoJEPU2Bp2uRE+gn9QP/jusJDI+9WATfz8Yz2wWDvrb
WvRwIFQRDrHrRjhTzYHUHo7yr2sI26VCs6jaPqQ8oTZGpA9lMT6I+ub2YaNSZD59
BaizLk8A0LiZ1+lrrjMra4/5ntHFlCmu1Hye+v+GibOZJXSrf94F2nwqcGz4rBxu
a9E4eGfaBsm1JGuFSkOXr/sUklfVZFnPW2PnXpTNyLUhPXoEV1ptDbpaQ0O0O/We
zEH9Lva7TbCtFZX81W7bmEO13EKS39hBgb8MsSPADb+5M8ztOHK7C97w/AIqD093
1Y2Owu84d80SiwJbRy4fYNivS9IwhSyr27nSRdrovNHy3+rGFfY5uO7ZI6HxYmea
2L4cVol1IIbJ+EE2p9nlc/SEx7CUoLlzEbltwPDOOQt9xvkaB2WIjIf0q5hAUy0X
hzNCVs+KvKc8S5OO9sy1hXra6/uVeHY30rqHvpx8sYnXOHl3qL+MnnbR2uvkkwIE
Y1TZia4J3axUapQFF0F7IAc1YKiDZpFFibNRyqumfYP7ofQjL/OObaVjTO529Pk1
89221VyfS/Cb5cBR+lUphLFull8wInVHabZdjptmDYD327PgnMTICHoqRFmUkRxA
6f7gFzPm/LQCBHA8av1NzZrXR4jJRXWDQ2k7al9s65Y9hX1K+uZH7DbJ62OZNVtn
KqZFBsSfNl0D7jK0UURy
=uH2E
-----END PGP SIGNATURE-----

--ZGiS0Q5IWpPtfppv--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019