[Rd] Bug 17159 - recursive dir.create() fails on windows shares due to permissions

Thompson, Pete Pete.Thompson at iqvia.com
Mon Jan 8 13:43:14 CET 2018


Hi, I’d like to ask about bug 17159:

https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17159

I can confirm that I see exactly this bug when using dir.create on paths of UNC form (\\server\share\xxx), with the recursive flag set. I’m seeing this when attempting to use install.packages with such a path (which I know isn’t supported, but would be great if it was!). I can see that a patch has been suggested for the problem and from looking at the source code I believe it’s a correct fix. Is there a possibility of getting this patch included?

The existing logic for Windows recursive dir.create (platform.c lines 2209-22203) appears to be:
- Skip over any \\share at the start of the directory name
- Loop while there are pieces of directory name left (i.e. we haven’t hit the last \ character)
  = Find the next portion of the directory name (up to the next \ character)
  = Attempt to create the directory (unless it is of the form x: - i.e. a drive name)
  = Ignore any ‘already exists’ errors, otherwise throw an error

This logic appears flawed in that it skips \\share which isn’t a valid path format (according to https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx ). Dredging my memory, it’s possible that \\share was a supported format in very old versions of Windows, but it’s been a long time since the UNC format came in. It’s also possible that \\share is a valid format in some odd environments, but the UNC format is far more widely used.

The patch suggested by Evan Cortens is simply to change the skip logic to skip over \\server\share instead of \\share. This will certainly fix the common use case of using UNC paths, but doesn’t attempt to deal with all the more complex options in Microsoft’s documentation. I doubt many users would ask for the complex cases, but the basic UNC format would be of wide applicability.

Thanks
Pete Thompson
Director, Information Technology
Head of Spotfire Centre of Excellence
IQVIA




________________________________________
IMPORTANT - PLEASE READ: This electronic message, including its attachments, is CONFIDENTIAL and may contain PROPRIETARY or LEGALLY PRIVILEGED or PROTECTED information and is intended for the authorized recipient of the sender. If you are not the intended recipient, you are hereby notified that any use, disclosure, copying, or distribution of this message or any of the information included in it is unauthorized and strictly prohibited. If you have received this message in error, please immediately notify the sender by reply e-mail and permanently delete this message and its attachments, along with any copies thereof, from all locations received (e.g., computer, mobile device, etc.). Thank you.


More information about the R-devel mailing list