This is the mail archive of the cygwin-developers 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: Seeking developer to assist with adding OpenAFS Reparse Tag Support to Cygwin


On Feb 28 13:02, Corinna Vinschen wrote:
> On Feb 28 06:52, Jeffrey Altman wrote:
> > On 2/28/2013 4:03 AM, Corinna Vinschen wrote:
> > 
> > > The core routine is symlink_info::check_reparse_point in path.cc.
> > > 
> > > Actually, Cygwin always opens files with FILE_OPEN_REPARSE_POINT
> > > and then, if it *is* a reparse point, it reads the contents of the
> > > reparse point and expects it to be of type IO_REPARSE_TAG_SYMLINK
> > > or IO_REPARSE_TAG_MOUNT_POINT.  Those are handled as symlinks.
> > > Other types are not recognized and the FILE_ATTRIBUTE_REPARSE_POINT
> > > attribute is deleted from the DOS attributes.  The later file open
> > > call in fhandler.cc will omit the FILE_OPEN_REPARSE_POINT flag from
> > > the open flags, so it will open the file transparently via the
> > > reparse redirector.
> > > 
> > > But there's a chance that this doesn't happen in all circumstances as
> > > expected.  As a first cut, look for usage of FILE_OPEN_REPARSE_POINT and
> > > the usage of the path_conv::is_rep_symlink method thoughout fhandler*.cc
> > > and syscalls.cc.
> > 
> > Thank you Corinna.
> > 
> > In my initial e-mail I pointed to an MSDN document which describes the
> > inconsistent behavior of the Win32 API with regards to reparse points.
> > The key thing to take away from that is that regardless of what the
> > application (in this case Cygwin) wants, FILE_OPEN_REPARSE_POINT will be
> > included in the underlying CreateFile() call for operations such
> > as
> > 
> >   GetFileAttributes[Ex]
> >   GetFileSecurity
> >   Directory enumeration
> 
> Did you look into the code?  Cygwin doesn't use WIn32 functions to
> access the file system.  It uses the underlying native NT functions.
> 
> > but Cygwin lists it as:
> > 
> >   -rwxr-xr-x 1 jaltman None       63 Nov  1 01:27 ti.exe
> > 
> > where 63 bytes is the size of the reparse point data not the target.  If
> > Cygwin is going to discard FILE_ATTRIBUTE_REPARSE_POINT, then it must
> > also resolve the target attributes when collecting stat info.
> 
> http://cygwin.com/acronyms/#PTC

Btw.  The right thing to do here is not to tweak stat or any other API
call.  The right thing to do is to fix symlink_info::check_reparse_point
to recognize the AFS reparse point and treat it as a symlink, just like
the IO_REPARSE_TAG_SYMLINK and IO_REPARSE_TAG_MOUNT_POINT types.
The returned path should be a Cygwin-compatible POSIX path pointing to
the real file.  In your above example, Cygwin's ls should handle
ti.exe as a symlink to the AFS file.


Corinna

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


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