You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(1) available.packages is given a non-file repository URL, and
(2) that repository responds to requests for /src/contrib/PACKAGES.rds or /src/contrib/PACKAGES.gz with 404, but /src/contrib/PACKAGES responds normally
(3) method is 'curl', 'libcurl', or not provided on an R with capabilities('libcurl') == TRUE (i.e. defaults to 'libcurl')
then the expected fallback to src/contrib/PACKAGES at src/library/utils/R/packages.R#L113 is skipped, and read.dcf at src/library/utils/R/packages.R#L123 attempts to parse the 404 response to the request for /src/contrib/PACKAGES.gz from the repository, which raises a warning, and skips over that repo entirely.
This is due to curl/libcurl returning a status code of 0 for 4xx responses. At src/library/utils/R/packages.R#L113 z is then 0 and does not inherit from 'error', so the attempt to grab /src/contrib/PACKAGES, which would have succeeded is skipped.
The issue can be resolved by setting options(download.file.extra=c('-f')), which instructs curl to return non-zero status for HTTP response codes >=400.
If
(1) available.packages is given a non-file repository URL, and
(2) that repository responds to requests for /src/contrib/PACKAGES.rds or /src/contrib/PACKAGES.gz with 404, but /src/contrib/PACKAGES responds normally
(3) method is 'curl', 'libcurl', or not provided on an R with capabilities('libcurl') == TRUE (i.e. defaults to 'libcurl')
then the expected fallback to src/contrib/PACKAGES at src/library/utils/R/packages.R#L113 is skipped, and read.dcf at src/library/utils/R/packages.R#L123 attempts to parse the 404 response to the request for /src/contrib/PACKAGES.gz from the repository, which raises a warning, and skips over that repo entirely.
This is due to curl/libcurl returning a status code of 0 for 4xx responses. At src/library/utils/R/packages.R#L113 z is then 0 and does not inherit from 'error', so the attempt to grab /src/contrib/PACKAGES, which would have succeeded is skipped.
The issue can be resolved by setting options(download.file.extra=c('-f')), which instructs curl to return non-zero status for HTTP response codes >=400.
However, this is unexpected, and appears to run counter to the documented behavior in the Admin manual (https://cran.r-project.org/doc/manuals/R-admin.html#Setting-up-a-package-repository) which implies that the .gz/.rds PACKAGES variants are optional.
Happy to submit a patch as well, if this is indeed a bug.
METADATA
The text was updated successfully, but these errors were encountered: