www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/04/07/18:09:05

From: noer AT cygnus DOT com (Geoffrey Noer)
Subject: Patch: directory symlink bug
7 Apr 1998 18:09:05 -0700 :
Message-ID: <199804080037.RAA28288.cygnus.cygwin32.developers@skaro.cygnus.com>
References: <352cbbba DOT 72492356 AT smtp DOT goodnet DOT com>
To: jeffdb AT goodnet DOT com
Cc: rkim AT ElectronicDNA DOT com, cygwin32-developers AT cygnus DOT com,
noer AT cygnus DOT com (Geoffrey Noer)

Mikey wrote:
> 
> Symlinks to Directories are now supported
> according to the B19 FAQ, but not according to
> the source.
> 
> In fact symlinks to directories weren't "officially"
> supported before, they just worked. I had assumed
> that when B19 came out, and they stopped working
> there was a reason for it, but I don't see one.
> 
> path.cc winsup-980401
> 
>   /* A symlink will have the `system' file attribute. */
>   /* Directories cannot be symlinks. */
>   if ((fileattr & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY)) !=
>         FILE_ATTRIBUTE_SYSTEM)
>     return 0;
> 
> Geoff is there a reason why this is still in the source, when in the
> FAQ it says

This looks and smells like a bug.  :-)

Here's the patch that I think ought to fix it.  On the other hand, I
tried testing the changed dll and get the same result as before.
(Although both shells follow the symlink, bash prints out the symlink
in the output of pwd whereas ash does not).

I'll probably commit the change since it looks right...

Geoff



Index: path.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/path.cc,v
retrieving revision 1.59
diff -c -p -r1.59 path.cc
*** path.cc	1998/03/25 23:22:42	1.59
--- path.cc	1998/04/08 00:19:25
*************** symlink_check_one (const char *path, cha
*** 1378,1386 ****
      }
  
    /* A symlink will have the `system' file attribute. */
!   /* Directories cannot be symlinks. */
!   if ((fileattr & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY)) !=
!         FILE_ATTRIBUTE_SYSTEM)
      return 0;
  
    /* Check the file's extended attributes, if it has any.  */
--- 1378,1384 ----
      }
  
    /* A symlink will have the `system' file attribute. */
!   if ((fileattr & FILE_ATTRIBUTE_SYSTEM) != FILE_ATTRIBUTE_SYSTEM)
      return 0;
  
    /* Check the file's extended attributes, if it has any.  */

-- 
Geoffrey Noer
noer AT cygnus DOT com

- Raw text -


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