Skip to content

url, readLines, source behind a proxy

7 messages · Joshua Ulrich, Brian Ripley, Renaud Gaujoux +1 more

#
Hi,

when I run R CMD check with flag --as-cran, the process hangs at stage:

* checking CRAN incoming feasibility ...

I am pretty sure it is a proxy issue.
I looked at the check code in the tools package and it seems that the 
issue is in the local function `.repository_db()` (defined in 
`tools:::.check_package_CRAN_incoming()`), which eventually calls 
`url()` with argument open="rb", that hangs probably because it does not 
use the proxy settings.
I had a similar issue with `source()`, which apparently uses internal 
network functions (not as download.file), but is supposed to work behind 
a proxy (correct?).
Does anybody else have this problem?

I was wondering if there is a way around, as I would like to be able to 
use --as-cran for my checks.
Thank you.

Renaud
#
On Tue, Apr 17, 2012 at 1:01 AM, Renaud Gaujoux
<renaud at mancala.cbio.uct.ac.za> wrote:
Doesn't it time-out eventually?  I'm not behind a proxy but when I've
been running 'R CMD check' whenon very poor 3G connection, it had
eventually timed out.

/Henrik
#
Hi Henrik,

I am sure it would time out indeed. I am fine with time out due to poor 
connection, but get a bit frustrated if my connection is fine and timeout 
occurs because proxy settings are not read. All the more if I have to run 
R CMD check multiple times and wait for the timeout.
But the issue might also be coming from my proxy, which somehow does not 
like the way url() reads remote content.

Could anybody behind a proxy check if the issue can be reproduced?
My proxy is in fact provided by cntml, which acts as a local proxy that 
takes care of tricky authentication protocols with the actual university 
proxy, not natively supported by my system (Ubuntu). Anybody in this case?

Thanks.

Renaud
On Tue, 17 Apr 2012, Henrik Bengtsson wrote:

            
#
Hi Renaud,

On Wed, Apr 18, 2012 at 12:22 AM, Renaud Gaujoux
<renaud at mancala.cbio.uct.ac.za> wrote:
<snip>
I can replicate this on a WinXP system, where I normally have to use
the --internet2 flag to get internet access through a proxy.

?download.file has a section on "Setting Proxies", which describes how
to use environment variables to set proxy information.  Setting
http_proxy='http://my.proxy.com/' was enough for me to get R CMD
check to run successfully with the --as-cran flag.
Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com

R/Finance 2012: Applied Finance with R
www.RinFinance.com
5 days later
#
On 18/04/2012 16:04, Joshua Ulrich wrote:
I guess that the simplest way on Windows is to ensure that --internet2 
is set.  In R-patched there is a new environment variable 
R_WIN_INTERNET2 which lets you do that (set it in ~/.R/check.Renviron).

[Setting proxies is so 20th century -- even moderately competent 
sysadmins worked out how to use transparent caching proxies ca 1995. 
Which is why the R developers give it a low priority.]

  
    
#
On 23/04/2012 17:39, Prof Brian Ripley wrote:
I completely understand the low priority -- fast-illimited-internet 
based --  point of view. I wish I could live without such a fussy proxy, 
but I have not much choice.
I like to understand why things work and do not work though.
Is there any special feature my proxy should have to allow 
readLines/source to correctly read remote data? What makes its access 
different from wget?

Thank you for your insights on this.
#
Looking at the source code (src/library/tools/R/check.R and
src/library/tools/R/QC.R), I found that...

WORKAROUND:
You can trick 'R CMD check' to quickly skip the
"check_package_CRAN_incoming" test by providing it with invalid URLs
to repositories by setting system environment
'_R_CHECK_XREFS_REPOSITORIES_' to a non-empty URL. For example:

% export _R_CHECK_XREFS_REPOSITORIES_="invalidURL"
% R CMD check --as-cran ...

gives:

* checking CRAN incoming feasibility ...NB: need Internet access to
use CRAN incoming checks
 OK

/Henrik

On Tue, Apr 24, 2012 at 5:46 AM, Renaud Gaujoux
<renaud at mancala.cbio.uct.ac.za> wrote: