[R-SIG-Mac] download.file crashes R when 404 is returned

Seth Falcon sfalcon at fhcrc.org
Thu Jul 27 18:49:34 CEST 2006


Hi all,

I know this has come up before, but I don't know if the problem has
been identified and fixed.

I'm running R-devel built from source from svn rev 38702 on ppc OS X
ver 10.4.7.

Calling download.file with a URL that does not exist causes a crash.
Below is an example with gdb trace.

I noticed these comments in internet.c:

	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));
	    return NULL;

Reproduce with:

    u404 <- "http://bioconductor.org/packages/doesnotexist.aaaa.3"
    f <- "output.u404.txt"
    download.file(u404, f)

gdb bt:

(gdb) bt
#0  0x900030e8 in strlen ()
#1  0x90011f3c in __vfprintf ()
#2  0x9002a6ac in vsnprintf ()
#3  0x01085b84 in Rvsnprintf (buf=0xbfffa558 "\002 z¨\002\227¹\004ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223ÂKÁ\225\207\205\223\223@}FkÂT­\005>¬;)\200", size=1000, format=0x3 <Address 0x3 out of bounds>, ap=0x34 <Address 0x34 out of bounds>) at ../../../../R-devel/src/main/errors.c:211
#4  0x01085bfc in Rf_warning (format=0x522e6d6f <Address 0x522e6d6f out of bounds>) at ../../../../R-devel/src/main/errors.c:223
#5  0x01664404 in in_R_HTTPOpen (url=0x16697b4 "cannot open: HTTP status was '%d %s'", cacheOK=404) at ../../../../../R-devel/src/modules/internet/internet.c:495
#6  0x01664050 in in_do_download (call=0x522e6d6f, op=0xbfff99fb, args=0x0, env=0x34) at ../../../../../R-devel/src/modules/internet/internet.c:322
#7  0x010ca1e0 in do_internal (call=0x0, op=0xbfff99fb, args=0x2857394, env=0x2a8084c) at ../../../../R-devel/src/main/names.c:1093

Ideas for tracking this down?

+ seth



More information about the R-SIG-Mac mailing list