[PATCH] Compatibility improvement to reparse point handling, v2

Joe Lowe joe@pismotec.com
Tue Jun 13 18:36:00 GMT 2017


On 2017-06-13 00:57, Corinna Vinschen wrote:> On Jun 12 13:08, Joe Lowe wrote:
>> On 2017-06-12 03:27, Corinna Vinschen wrote:
>>> On Jun  9 15:44, Joe Lowe wrote:
>>>> -	  else
>>>> +	  else if (res == -1)
>>>>    	    {
>>>> -	      /* Volume moint point or unrecognized reparse point type.
>>>> +	      /* Volume moint point or unhandled reparse point.
>>>>    		 Make sure the open handle is not used in later stat calls.
>>>>    		 The handle has been opened with the FILE_OPEN_REPARSE_POINT
>>>>    		 flag, so it's a handle to the reparse point, not a handle
>>>> -		 to the volumes root dir. */
>>>> +		 to the reparse point target. */
>>>>    	      pflags &= ~PC_KEEP_HANDLE;
>>>> -	      /* Volume mount point:  The filesystem information for the top
>>>> -		 level directory should be for the volume top level directory,
>>>> -		 rather than for the reparse point itself.  So we fetch the
>>>> -		 filesystem information again, but with a NULL handle.
>>>> -		 This does what we want because fs_info::update opens the
>>>> -		 handle without FILE_OPEN_REPARSE_POINT. */
>>>> -	      if (res == -1)
>>>> -		fs.update (&upath, NULL);
>>>> +	      /* The filesystem information should be for the target of
>>>> +		 the reparse point rather than for the reparse point itself.
>>>> +		 So we fetch the filesystem information again, but with a
>>>> +		 NULL handle. This does what we want because fs_info::update
>>>> +		 opens the handle without FILE_OPEN_REPARSE_POINT. */
>>>> +	      fs.update (&upath, NULL);
>>>> +	    }
>>>> +	  else
>>>> +	    {
>>>> +	      /* Unknown reparse point type: HSM, dedup, compression, ...
>>>> +	         Treat as normal directory. */
>>>>    	    }
>>>
>>> Nothing against reordering the code, but this drops removing
>>> PC_KEEP_HANDLE from pflags if res == 0, i.e., for unknown reparse
>>> points.
>>
>> Changing the handling for unknown (3rd party) reparse tags is
>> not the primary point of the patch. But the fallback handling
>> for reparse tags should be to do what most win32 apps would do,
>> treat as a normal file/directory and open without the
>> FILE_OPEN_REPARSE_TAG flag.
>>
...
> I don't get what you're arguing for.  Removing the PC_KEEP_HANDLE
> bit will close the (wrong) search handle from path_conv, so that
> subsequent stat calls will stat the target of the reparse point.
> By keeping it in case of unknown reparse points, subsequent stats
> will return the wrong info (reparse point rather than target).

OK. Next pass should be a smaller diff, and I will double check
things. Please check what I end up with in reworked patch and let
me know then if there still is a concern.

Joe L.



More information about the Cygwin-patches mailing list