This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
[Fwd: symboilc link does not expand if followed by /..]
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: cygwin-developers at cygwin dot com
- Date: Wed, 14 Jul 2004 13:55:55 +0200
- Subject: [Fwd: symboilc link does not expand if followed by /..]
- Reply-to: cygwin-developers at cygwin dot com
----- Forwarded message from Vinay Kumar -----
> Date: Tue, 13 Jul 2004 21:06:08 +0000 (GMT)
> From: Vinay Kumar
> Subject: symboilc link does not expand if followed by /..
> To: cygwin-list
>
> Hi all,
> I found a problem with symbolic link expansion in cygwin. Symbolic
> link does not expand properly if it is followed by /.. . To see it at
> your place please do the following.
> cd /tmp
> mkdir dir1
> mkdir dir2
> touch dir1/1.c
> cd dir2
> ln -s ../dir1 symlink
>
> if we do ls symlink it gives 1.c as expected.
> But if we do ls symlink/.. then it list contents of present directory.
>
> @/tmp/dir2
> $ ls symlink
> 1.c
>
> @/tmp/dir2
> $ ls symlink/..
> symlink
>
> I think it should list contents of /tmp directory.
> Could somebody throw some light over it.
>
> regards
> Vinay
----- End forwarded message -----
Looks like he has his point. Under Linux it works as he describes it.
In Cygwin the following happens.
normalize_posix_path simplifies the path first and strippes ".." by
removing the previous entry in the path. Then path_conv::check checks
for symlinks and directories. So, the incoming path /tmp/dir2/symlink/..
becomes /tmp/dir2 after the call to normalize_posix_path and the symlink
expansion in path_conv::check doesn't even see a symlink.
That reflects the typical behaviour in tcsh with the setting
`set symlinks expand', but it doesn't allow any other behaviour.
It looks like a fix would require to change the order in path_conv::check.
The symlink expansion would have to be done before the path gets normalized.
Or the symlink expansion could be moved into normalize_posix_path.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Co-Project Leader mailto:cygwin@cygwin.com
Red Hat, Inc.