names lost in functions from packages installed by R-devel r74500

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

names lost in functions from packages installed by R-devel r74500

François Rousset
Dear list members,

If I install with R-devel r74500 on Windows (sessionInfo below) the
attached 'bugdemo' package with the single function

foo <- function() {
   named <- c("bar"=TRUE)
   print(named)
   return(named)
}

then run

 > bugdemo::foo()
[1] TRUE
[1] TRUE

The "bar" name is lost. It is not lost when I define foo in the R
session instead of using its packaged version.

To reproduce:

=======================================

install.packages("bugdemo_0.1.1.tar.gz",type="source",repos=NULL)

bugdemo::foo()

=======================================

I also tested whether this was a problem with the "R CMD build" step or
the "install.packages()" step by building with R 3.4.4 and installing
with R-devel, and reciprocally, and the problem appears to be in the
install step of R-devel.

F.

=============

 > sessionInfo()
R Under development (unstable) (2018-03-31 r74500)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                   LC_TIME=French_France.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods base

other attached packages:
[1] bugdemo_0.1.1

loaded via a namespace (and not attached):
[1] compiler_3.6.0  tools_3.6.0     withr_2.1.2 memoise_1.1.0  
digest_0.6.15   devtools_1.13.5
 >


--
François Rousset
CNRS research scientist
<http://www.isem.univ-montp2.fr/recherche/teams/evolutionary-genetics/staff/roussetfrancois/?lang=en>
- Institut des Sciences de l'Evolution (ISE-M)
Université de Montpellier - Dept. Scientifique B3ESTE


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

bugdemo_0.1.1.tar.gz (998 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: names lost in functions from packages installed by R-devel r74500

Martin Maechler
>>>>> Francois Rousset <[hidden email]>
>>>>>     on Tue, 3 Apr 2018 16:38:42 +0200 writes:

    > Dear list members,
    > If I install with R-devel r74500 on Windows (sessionInfo below) the
    > attached 'bugdemo' package with the single function

    > foo <- function() {
    >   named <- c("bar"=TRUE)
    >   print(named)
    >   return(named)
    > }

    > then run

    >> bugdemo::foo()
    > [1] TRUE
    > [1] TRUE

    > The "bar" name is lost. It is not lost when I define foo in the R
    > session instead of using its packaged version.

    > To reproduce:

    > =======================================

    > install.packages("bugdemo_0.1.1.tar.gz",type="source",repos=NULL)

    > bugdemo::foo()



    > =======================================

    > I also tested whether this was a problem with the "R CMD build" step or
    > the "install.packages()" step by building with R 3.4.4 and installing
    > with R-devel, and reciprocally, and the problem appears to be in the
    > install step of R-devel.

Confirmed.

It is a bug somewhere between the byte compiler and
(de)serialization .. really beyond my own expertise:

If you install  without byte compilation *),  foo() behaves as
expected, i.e., does not "lose" the names.

On the other hand, as you mention, if you define foo in the
globalenv, and call it, the JIT kicks in pretty quickly and you
can see that 'foo' is byte compiled as well, but it still does not break.

This is pretty important, so thank you very much for the nice
reproducible report!

Martin Maechler
ETH Zurich

---
*) R-devel CMD INSTALL --no-byte-compile -l ...

    > F.

    > =============

    >> sessionInfo()
    > R Under development (unstable) (2018-03-31 r74500)
    > Platform: x86_64-w64-mingw32/x64 (64-bit)
    > Running under: Windows 7 x64 (build 7601) Service Pack 1

    > Matrix products: default

    > locale:
    > [1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
    > LC_MONETARY=French_France.1252
    > [4] LC_NUMERIC=C                   LC_TIME=French_France.1252

    > attached base packages:
    > [1] stats     graphics  grDevices utils     datasets  methods base

    > other attached packages:
    > [1] bugdemo_0.1.1

    > loaded via a namespace (and not attached):
    > [1] compiler_3.6.0  tools_3.6.0     withr_2.1.2 memoise_1.1.0  
    > digest_0.6.15   devtools_1.13.5
    >>


    > --
    > François Rousset
    > CNRS research scientist
    > <http://www.isem.univ-montp2.fr/recherche/teams/evolutionary-genetics/staff/roussetfrancois/?lang=en>
    > - Institut des Sciences de l'Evolution (ISE-M)
    > Université de Montpellier - Dept. Scientifique B3ESTE

    > x[DELETED ATTACHMENT external: bugdemo_0.1.1.tar.gz, application/gzip]
    > ______________________________________________
    > [hidden email] mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: names lost in functions from packages installed by R-devel r74500

Martin Maechler
>>>>> Martin Maechler <[hidden email]>
>>>>>     on Tue, 3 Apr 2018 17:03:02 +0200 writes:

>>>>> Francois Rousset <[hidden email]>
>>>>>     on Tue, 3 Apr 2018 16:38:42 +0200 writes:

    >> Dear list members,
    >> If I install with R-devel r74500 on Windows (sessionInfo below) the
    >> attached 'bugdemo' package with the single function

    >> foo <- function() {
    >>   named <- c("bar"=TRUE)
    >>   print(named)
    >>   return(named)
    >> }

    >> then run

    >>> bugdemo::foo()
    >> [1] TRUE
    >> [1] TRUE

    >> The "bar" name is lost. It is not lost when I define foo in the R
    >> session instead of using its packaged version.

    >> To reproduce:

    >> =======================================

    >> install.packages("bugdemo_0.1.1.tar.gz",type="source",repos=NULL)

    >> bugdemo::foo()



    >> =======================================

    >> I also tested whether this was a problem with the "R CMD build" step or
    >> the "install.packages()" step by building with R 3.4.4 and installing
    >> with R-devel, and reciprocally, and the problem appears to be in the
    >> install step of R-devel.

    > Confirmed.

    > It is a bug somewhere between the byte compiler and
    > (de)serialization .. really beyond my own expertise:

    > If you install  without byte compilation *),  foo() behaves as
    > expected, i.e., does not "lose" the names.

    > On the other hand, as you mention, if you define foo in the
    > globalenv, and call it, the JIT kicks in pretty quickly and you
    > can see that 'foo' is byte compiled as well, but it still does not break.

    > This is pretty important, so thank you very much for the nice
    > reproducible report!

    > Martin Maechler
    > ETH Zurich

    > ---
    > *) R-devel CMD INSTALL --no-byte-compile -l ...

This has been fixed now, both in R-devel (svn rev 74511)
and in R 3.5.0 alpha (r 74513).

I was wrong in that this was related to (de)serialization.
Rather I had forgotten that JIT (just in time) compilation and
explicit compilation may differ in their results.

Thank you again for the report!

Martin Maechler
ETH Zurich



    >> =============

    >>> sessionInfo()
    >> R Under development (unstable) (2018-03-31 r74500)

    [ ........... ]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: names lost in functions from packages installed by R-devel r74500

luke-tierney
On Tue, 3 Apr 2018, Martin Maechler wrote:

>>>>>> Martin Maechler <[hidden email]>
>>>>>>     on Tue, 3 Apr 2018 17:03:02 +0200 writes:
>
>>>>>> Francois Rousset <[hidden email]>
>>>>>>     on Tue, 3 Apr 2018 16:38:42 +0200 writes:
>
>    >> Dear list members,
>    >> If I install with R-devel r74500 on Windows (sessionInfo below) the
>    >> attached 'bugdemo' package with the single function
>
>    >> foo <- function() {
>    >>   named <- c("bar"=TRUE)
>    >>   print(named)
>    >>   return(named)
>    >> }
>
>    >> then run
>
>    >>> bugdemo::foo()
>    >> [1] TRUE
>    >> [1] TRUE
>
>    >> The "bar" name is lost. It is not lost when I define foo in the R
>    >> session instead of using its packaged version.
>
>    >> To reproduce:
>
>    >> =======================================
>
>    >> install.packages("bugdemo_0.1.1.tar.gz",type="source",repos=NULL)
>
>    >> bugdemo::foo()
>
>
>
>    >> =======================================
>
>    >> I also tested whether this was a problem with the "R CMD build" step or
>    >> the "install.packages()" step by building with R 3.4.4 and installing
>    >> with R-devel, and reciprocally, and the problem appears to be in the
>    >> install step of R-devel.
>
>    > Confirmed.
>
>    > It is a bug somewhere between the byte compiler and
>    > (de)serialization .. really beyond my own expertise:
>
>    > If you install  without byte compilation *),  foo() behaves as
>    > expected, i.e., does not "lose" the names.
>
>    > On the other hand, as you mention, if you define foo in the
>    > globalenv, and call it, the JIT kicks in pretty quickly and you
>    > can see that 'foo' is byte compiled as well, but it still does not break.
>
>    > This is pretty important, so thank you very much for the nice
>    > reproducible report!
>
>    > Martin Maechler
>    > ETH Zurich
>
>    > ---
>    > *) R-devel CMD INSTALL --no-byte-compile -l ...
>
> This has been fixed now, both in R-devel (svn rev 74511)
> and in R 3.5.0 alpha (r 74513).
>
> I was wrong in that this was related to (de)serialization.
> Rather I had forgotten that JIT (just in time) compilation and
> explicit compilation may differ in their results.

Actually the difference is that a function defined in a package is
compiled with more optimizations than one defined at session top
level.  A change had broken a piece of the optimization code, and has
now been fixed. Thanks for the report.

Best,

luke

>
> Thank you again for the report!
>
> Martin Maechler
> ETH Zurich
>
>
>
>    >> =============
>
>    >>> sessionInfo()
>    >> R Under development (unstable) (2018-03-31 r74500)
>
>    [ ........... ]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   [hidden email]
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel