[Rd] available.packages function and UNC paths

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Thu Apr 21 15:25:43 CEST 2022


On 4/6/22 18:07, mark.lee--- via R-devel wrote:
> Hello,
>
> I'm responsible for maintaining a mirrored internal CRAN repository for my organization. We have a script that uses the miniCRAN library to add and update packages within the repository and since the repository is stored on a network drive I have to use UNC paths when calling miniCRAN functions such as this:
>
> updatePackages(path = '\\\\my-network-drive.net\\repos\\packages', ...)
>
> updatePackages function in turns call pkgAvail, another miniCRAN function, which calls available.packages and then read.dcf function. However I discovered that this line in available.packages transforms the UNC path to a form that read.dcf can't use:
>
> if (startsWith(repos, "file:///")) {tmpf <- paste0('/', substring(repos, 8L), "/PACKAGES")
>
> This line transforms my UNC path to //\\\\my-network-drive.net\\repos\\packages, which read.dcf can't use. During debugging I found that pkgAvail transformed my UNC path to 'file:///\\\\ my-network-drive.net\\repos\\packages' and that is the path being passed to available.packages. To fix my issue I re-defined my own available.packages function and changed the line to:
>
> if (startsWith(repos, "file:///")) {tmpf <- paste0('/', substring(repos, 10L), "/PACKAGES")
>
> This way the UNC path being passed to read.dcf will be '/\\my-network-drive.net\\repos\\packages', which read.dcf can use. I'm wondering if similar changes can be made in the available.packages function for the next R release to automatically detect UNC paths and modify it so that it can work with UNC paths.

R does not support UNC paths, even though they work in some functions 
(as stated at least in R-intro documentation). You can use e.g. a mapped 
drive as a reliable work-around.

Transforming the file URIs is tricky enough even without UNC support, 
and as UNC is only used on Windows, and there is an easy work-around, 
support for it in update.packages would have very low priority. The cost 
is not only implementing it, but also maintaining and testing. Still, to 
increase the chances, you can submit a bug (wishlist) report to R 
bugzilla, referring only to base R packages (so not e.g. miniCRAN) and 
add a well-tested patch to be considered.

Best
Tomas

> Thanks,
>
> Mark
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list