[Rd] Package (PR#13475)

William Dunlap wdunlap at tibco.com
Tue Jan 27 20:02:07 CET 2009


You can put a trace on normalizePath to get the name of the offending
input file name.  E.g.,

   > trace(normalizePath, Quote(cat("normalizePath: path=", path,
"\n")))
   Tracing function "normalizePath" in package "utils"
   [1] "normalizePath"
   > install.packages("sn")
   trying URL
'http://cran.fhcrc.org/bin/windows/contrib/2.8/sn_0.4-10.zip'
   Content type 'application/zip' length 320643 bytes (313 Kb)
   opened URL
   downloaded 313 Kb

   Tracing normalizePath(lib) on entry 
   normalizePath: path= E:/PROGRA~1/R/R-28~1.1/library 
   package 'sn' successfully unpacked and MD5 sums checked
   Tracing normalizePath(tmpd) on entry 
   normalizePath: path=
C:\DOCUME~1\wdunlap\LOCALS~1\Temp\Rtmp2XNJo1/downloaded_packages 

   The downloaded packages are in
           C:\Documents and Settings\wdunlap\Local
Settings\Temp\Rtmp2XNJo1\downloaded_packages
   updating HTML package descriptions

It looks like your second call to normalizePath caused the problem.
If the error message from normalizePath included the offending file
name it would be easier to track down the problem.  E.g.,
   > normalizePath(c(".", "no such file.txt"))
   Error in normalizePath(path) :
     path[2]="no such file.txt": The system cannot find the file
specified
instead of just
   > normalizePath(c(".", "no such file.txt"))
   Error in normalizePath(path) :
     path[2]: The system cannot find the file specified

The following, barely tested, patch does this on Windows.  I don't
know if
   ...[printf]... "%ls", filenameToWchar(string,FALSE)
is the proper way to display an R string.

Index: extra.c
===================================================================
--- extra.c	(revision 47193)
+++ extra.c	(working copy)
@@ -1107,13 +1107,13 @@
 	    if (!GetFullPathNameW(filenameToWchar(el, FALSE), MAX_PATH,
 			     wtmp, &wtmp2)
 	    	|| !GetLongPathNameW(wtmp, wlongpath, MAX_PATH))
-	    	errorcall(call, "path[%d]: %s", i+1,
formatError(GetLastError()));
+	    	errorcall(call, "path[%d]=\"%ls\": %s", i+1,
filenameToWchar(el,FALSE), formatError(GetLastError()));
 	    wcstoutf8(longpath, wlongpath, wcslen(wlongpath)+1);
 	    SET_STRING_ELT(ans, i, mkCharCE(longpath, CE_UTF8));
 	} else {
 	    if (!GetFullPathName(translateChar(el), MAX_PATH, tmp,
&tmp2)
 	        || !GetLongPathName(tmp, longpath, MAX_PATH))
-	        errorcall(call, "path[%d]: %s", i+1,
formatError(GetLastError()));
+	        errorcall(call, "path[%d]=\"%ls\": %s", i+1,
filenameToWchar(el, FALSE), formatError(GetLastError()));
 	    SET_STRING_ELT(ans, i, mkChar(longpath));
 	}
     }
It might be nice to include the current directory also.
  
Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com  

> -----Original Message-----
> From: r-devel-bounces at r-project.org 
> [mailto:r-devel-bounces at r-project.org] On Behalf Of 
> partho_bhowmick at ml.com
> Sent: Tuesday, January 27, 2009 7:15 AM
> To: r-devel at stat.math.ethz.ch
> Cc: R-bugs at r-project.org
> Subject: [Rd] Package (PR#13475)
> 
> Full_Name: Partho Bhowmick
> Version: 2.8.1
> OS: Windows XP
> Submission from: (NULL) (199.43.48.131)
> 
> 
> While trying to install package sn (I have tried multiple mirrors),
> I get the following message
> 
> trying URL 
> 'http://www.revolution-computing.com/cran/bin/windows/contrib/
2.8/sn_0.4-10.zip'
> Content type 'application/zip' length 320643 bytes (313 Kb)
> opened URL
> downloaded 313 Kb
> 
> package 'sn' successfully unpacked and MD5 sums checked
> Error in normalizePath(path) : 
>   path[1]: The system cannot find the file specified
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 



More information about the R-devel mailing list