[Rd] utils::unzip ignores overwrite argument, effectively

2017-12-20 Thread Gábor Csárdi
It does give a warning, but then it overwrites the files, anyway.
Reproducible example below.

This is R 3.4.3, but it does not seem to be fixed in R-devel:
https://github.com/wch/r-source/blob/4a9ca3e5ac6b19d7faa7c9290374f7604bf0ef64/src/main/dounzip.c#L171-L174

FYI,
Gábor

dir.create(tmp <- tempfile())
setwd(tmp)

cat("old1\n", file = "file1")
cat("old2\n", file = "file2")

utils::zip("files.zip", c("file1", "file2"))
#>   adding: file1 (stored 0%)
#>   adding: file2 (stored 0%)

unlink("file2")
cat("new1\n", file = "file1")
readLines("file1")
#> [1] "new1"

utils::unzip("files.zip", overwrite = FALSE)
#> Warning message:
#> In utils::unzip("files.zip", overwrite = FALSE) :
#>not overwriting file './file1

readLines("file1")
#> [1] "old1"

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

[Rd] R CMD check warning about compiler warning flags

2017-12-20 Thread Winston Chang
On recent builds of R-devel, R CMD check gives a WARNING when some
compiler warning flags are detected, such as -Werror, because they are
non-portable. This appears to have been added in this commit:
  https://github.com/wch/r-source/commit/2e80059

I'm working on a package where these compiler warning flags are
present in a Makefile generated by a configure script -- that is, the
configure script detects whether the compiler supports these flags,
and if so, puts them in the Makefile. (The configure script is for a
third-party C library which is in a subdirectory of src/.)

Because the flags are added only if the system supports them, there
shouldn't be any worries about portability in practice.

Is there a way to get R CMD check to not raise warnings in cases like
this? I know I could modify the C library's configure.ac (which is
used to generate the configure script) but I'd prefer to leave the
library's code untouched if possible.

-Winston

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


[Rd] R_RegisterCCallable

2017-12-20 Thread Therneau, Terry M., Ph.D.

I've just converted all the C symbols in bdsmatrix to use the more modern form, 
e.g.,

   .C("charle",     changed to .C( Ccharlie, 

along with defining RCMethodDef in my initfile and adding .register=TRUE to the NAMESPACE 
file.  All due to a request from CRAN to modernize one aspect, which then cascaded into 
more via suggestions from R CMD check --as-cran.


My question concerns the crosstalk with coxme.  Currently bdsmatrix has lines like the 
following:


    R_RegisterCCallable("bdsmatrix","cholesky4", (DL_FUNC) &cholesky4);

while coxme has

    fun= (int(*)) R_GetCCallable("bdsmatrix", "cholesky4");


Should these also change to use the pseudo name, or is it fine as is?

Terry Therneau

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

Re: [Rd] R CMD check warning about compiler warning flags

2017-12-20 Thread Prof Brian Ripley

On 20/12/2017 17:42, Winston Chang wrote:

On recent builds of R-devel, R CMD check gives a WARNING when some
compiler warning flags are detected, such as -Werror, because they are
non-portable. This appears to have been added in this commit:
   https://github.com/wch/r-source/commit/2e80059


That is not the canonical R sources.  And your description seems wrong: 
there is now an _optional_ check controlled by an environment variable, 
primarily for CRAN checks.



I'm working on a package where these compiler warning flags are
present in a Makefile generated by a configure script -- that is, the
configure script detects whether the compiler supports these flags,
and if so, puts them in the Makefile. (The configure script is for a
third-party C library which is in a subdirectory of src/.)

Because the flags are added only if the system supports them, there
shouldn't be any worries about portability in practice.


Please read the explanation in the manual: there are serious concerns 
about such flags which have bitten CRAN users several times.


To take your example, you cannot know what -Werror does on all compilers 
(past, present or future) where it is supported (and -W flags do do 
different things on different compilers).  On current gcc it does


   -Werror
   Make all warnings into errors.

and so its effect depends on what other flags are used (people typically 
use -Wall, and most new versions of both gcc and clang add more warnings 
to -Wall -- I read this week exactly such a discussion about the 
interaction of -Werror with -Wtautological-constant-compare as part of 
-Wall in clang trunk).



Is there a way to get R CMD check to not raise warnings in cases like
this? I know I could modify the C library's configure.ac (which is
used to generate the configure script) but I'd prefer to leave the
library's code untouched if possible.
You don't need to (and most likely should not) use the C[XX]FLAGS it 
generates ... just use the flags which R passes to the package to use.




-Winston


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford

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


Re: [Rd] R CMD check warning about compiler warning flags

2017-12-20 Thread Hadley Wickham
On Wed, Dec 20, 2017 at 4:26 PM, Prof Brian Ripley
 wrote:
> On 20/12/2017 17:42, Winston Chang wrote:
>>
>> On recent builds of R-devel, R CMD check gives a WARNING when some
>> compiler warning flags are detected, such as -Werror, because they are
>> non-portable. This appears to have been added in this commit:
>>https://github.com/wch/r-source/commit/2e80059
>
>
> That is not the canonical R sources.  And your description seems wrong:
> there is now an _optional_ check controlled by an environment variable,
> primarily for CRAN checks.

Are the canonical R sources made available in such a way that one can
link to them?

Hadley

-- 
http://hadley.nz

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


Re: [Rd] R CMD check warning about compiler warning flags

2017-12-20 Thread Duncan Murdoch

On 20/12/2017 5:48 PM, Hadley Wickham wrote:

On Wed, Dec 20, 2017 at 4:26 PM, Prof Brian Ripley
 wrote:

On 20/12/2017 17:42, Winston Chang wrote:


On recent builds of R-devel, R CMD check gives a WARNING when some
compiler warning flags are detected, such as -Werror, because they are
non-portable. This appears to have been added in this commit:
https://github.com/wch/r-source/commit/2e80059



That is not the canonical R sources.  And your description seems wrong:
there is now an _optional_ check controlled by an environment variable,
primarily for CRAN checks.


Are the canonical R sources made available in such a way that one can
link to them?


Yes, the sources are available.  To link to revision 73909 of R on the 
trunk branch (which I think is the one referred to above), use


https://svn.r-project.org/R/trunk/?r=73909

I'm not sure if there's an easy way to see the diff between that and 
73908 (which is what the github link showed).  I also don't know if 
there's a way to show the diff between commit N and N-1 in github if I 
only know N.


Duncan Murdoch

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