[Rd] download.file crashes on OSX

Seth Falcon sfalcon at fhcrc.org
Sun Jul 30 05:23:15 CEST 2006


I'm seeing a 'memory not mapped' crash on OSX (10.4.7) with R-devel
(r38715) when calling download.file() with a URL that doesn't exist.

Here is what reproduces it for me:

    u404 <- "http://bioconductor.org/packages/doesnotexist.aaaa.3"
    f <- "output.u404.txt"
    download.file(u404, f)
    trying URL 'http://bioconductor.org/packages/doesnotexist.aaaa.3'
     *** caught segfault ***
    address 0x522e6d6c, cause 'memory not mapped'

And here is a patch that resolves this for me.  I'm pretty sure the
context should be closed after the query is made as to its status, but
maybe I'm missing something...

+ seth

Index: src/modules/internet/internet.c
--- src/modules/internet/internet.c     (revision 38715)
+++ src/modules/internet/internet.c     (working copy)
@@ -489,10 +489,10 @@
        int rc = RxmlNanoHTTPReturnCode(ctxt);
        if(rc != 200) {
            char *msg;
-           RxmlNanoHTTPClose(ctxt);
            /* bug work-around: it will crash on OS X if passed directly */
            msg = _("cannot open: HTTP status was '%d %s'");
            warning(msg, rc, RxmlNanoHTTPStatusMsg(ctxt));
+           RxmlNanoHTTPClose(ctxt);
            return NULL;
        } else {
            type = RxmlNanoHTTPContentType(ctxt);

More information about the R-devel mailing list