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]

Compatibility improvement to reparse point handling.


Greetings,


Attached is a proposed patch that improves Cygwin reparse point handling, to be compatible with reparse points whose SubstituteName does not begin with one of the 3 prefixes specifically recognized in the current code.

With the patch, Cygwin validates that the SubstituteName has one of the two prefixes that Cygwin can correctly convert to a working readlink() result, otherwise the reparse point is treated as a normal file or folder. The new behavior is already similar to how Cygwin handles unknown reparse point types and volume mount points, so the required code changes were minimal and well isolated.


Example of current Cygwin behavior:

A junction with this SubstituteName value "\Device\HarddiskVolume4\Users\joe\Documents" works in windows applications to open my documents folder, but in Cygwin applications it does not work. Cygwin treats the junction as a posix symlink with a target of "/cygdrive/c/Device/HarddiskVolume4/Users/joe/Documents", which does not exist.


Testing:

Testing the change against the currently supported types of reparse points is straightforward. I did basic tests with symlink to UNC, mount point, and a relative symlink, and behavior was unchanged from current code.

I also tested against currently broken cases using Pismo File Mount Audit Package and by using a custom tool to create arbitrary reparse points. Other testing options include EncFSMP and VirtualSynth. I can provide additional info for testing to whoever is interested.


Background:

There are reasons that mount points or symlinks to 3rd party file systems may not have one of the three prefixes that Cygwin currently requires:

1) The UNC prefix causes the reparse target to go through the MUP (Multi-UNC-Provider) arbitration process. This process involves network IO and timeouts that for 3rd party file systems are likely unnecessary. This negatively effects user experience and it leaks local system activity onto the network. Also, the UNC prefix is not appropriate for local volumes.

2) Drive letters are limited. Junctions and symlinks to volumes without drive letters cannot have the drive letter prefix.

3) The volume GUID prefix implies a mount point for a local volume managed by the windows plug-and-play system and volume manager. Some applications will interpret volumes with mount points in this format as having certain attributes or features. At a minimum, the volume GUID prefix is not appropriate for reparse points targeting network volumes, and is not handled by Cygwin for symbolic link type reparse points.


License:

The patch is entirely my own work. I do not consider the patch substantial enough for copyright to apply, but if licensing is considered necessary then the patch is licensed as follows.

2-clause BSD:
=========================================================================
Copyright (c) 2017, Joe Lowe
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================


Feedback appreciated.


Joe L.

Attachment: patch.txt
Description: Text document


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