[Rd] system() and system2() do not use long filenames on Windows

2018-04-30 Thread Hong Ooi via R-devel
Hi,

On Windows, it appears that system() and system2() both use the 8.3 filename to 
run the supplied command, even if the full name is used. Most of the time this 
doesn't matter, but for .NET programs, it stops the program from finding its 
app.config file (which has the same name as the app, with '.config' appended).

Here is a simple test program, compiled with: g++ -o longfilename.exe test.cpp


#include 

int main(int argc, char **argv)
{
std::cout << argv[0] << '\n';
return 0;
}


When I run this from a command prompt, it prints the full name:

C:\>\users\hongooi\longfilename.exe
\users\hongooi\longfilename.exe


But when I run it from R (3.4.3) via system() or system2(), it prints the 8.3 
filename:

> system2("c:\\users\\hongooi\\longfilename.exe")
c:\users\hongooi\LONGFI~1.EXE


And here is a question on StackOverflow where this cropped up: 
https://stackoverflow.com/questions/50090450/config-file-is-ignored-when-net-executable-is-called-from-r

Would it be possible to modify system() and system2() to respect long filenames?

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Unexpected interaction between missing() and a blank expression

2017-06-06 Thread Hong Ooi via R-devel
This is something I came across just now:

f <- function(x) missing(x)
z <- quote(expr=)

f(z)
# TRUE

The object z contains the equivalent of a missing function argument. Another 
method for generating a missing arg would be alist(a=)$a .

Should f(z) return TRUE in this case? I interpret missing() as checking whether 
the parent function call had a value supplied for the given argument. Here, I 
have supplied an argument (z), so I would expect f to return FALSE.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Odd behaviour in within.list() when deleting 2+ variables

2017-06-26 Thread Hong Ooi via R-devel
The behaviour of within() with list input changes if you delete 2 or more 
variables, compared to deleting one:

l <- list(x=1, y=2, z=3)

within(l,
{
rm(z)
})
#$x
#[1] 1
#
#$y
#[1] 2


within(l, {
rm(y)
rm(z)
})
#$x
#[1] 1
#
#$y
#NULL
#
#$z
#NULL


When 2 or more variables are deleted, the list entries are instead set to NULL. 
Is this intended?

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Unexpected behaviour with download.packages on Windows

2017-09-29 Thread Hong Ooi via R-devel
If no 'type' is specified, download.packages("pkgname") will download source 
packages (.tar.gz files), even on Windows. However, the help says


  type   character string, indicate which type of packages: see 
install.packages.


and on Windows, install.packages defaults to downloading binary packages.

Is this intended behaviour on the part of download.packages? This is on R 3.3.3 
and 3.4.1; I haven't tested on 3.4.2 but there's no indication the function has 
changed.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel