Bug in R CMD INSTALL when handling invalid LazyData DESCRIPTION field

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

Bug in R CMD INSTALL when handling invalid LazyData DESCRIPTION field

Aaron Wells
Hi, I think I've found a bug in R CMD INSTALL. When it tries to parse a
DESCRIPTION file with an invalid LazyData field, it errors out while
trying to print the correct error message:

> R CMD INSTALL .
* installing to library ‘/home/example/R/x86_64-pc-linux-gnu-library/3.4’
* installing *source* package ‘samplepackage’ ...
** data
Error in errmsg("invalid value of ", field, " field in DESCRIPTION") :
  could not find function "errmsg"
* removing ‘/home/example/R/x86_64-pc-linux-gnu-library/3.4/samplepackage’


It should instead be using that errmsg() function to print the more
helpful error message: "invalid value of LazyData field in DESCRIPTION".

I've traced it down to this line of code in tools:::.install_packages()
https://github.com/wch/r-source/blob/trunk/src/library/tools/R/install.R#L977
. The errmsg() function actually is defined earlier on in the function,
but there seems to be a scoping issue that makes it not available here.

I've uploaded a sample project to reproduce the bug here:
https://github.com/agwells/R-CMD-INSTALL-bug

I'm running R version 3.4.2 (2017-09-28), on Ubuntu 16.04.

Cheers,
Aaron

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

Re: Bug in R CMD INSTALL when handling invalid LazyData DESCRIPTION field

Martin Maechler
>>>>> Aaron Wells <[hidden email]>
>>>>>     on Fri, 24 Nov 2017 12:46:48 +1300 writes:

    > Hi, I think I've found a bug in R CMD INSTALL. When it tries to parse a
    > DESCRIPTION file with an invalid LazyData field, it errors out while
    > trying to print the correct error message:

    >> R CMD INSTALL .
    > * installing to library ‘/home/example/R/x86_64-pc-linux-gnu-library/3.4’
    > * installing *source* package ‘samplepackage’ ...
    > ** data
    > Error in errmsg("invalid value of ", field, " field in DESCRIPTION") :
    > could not find function "errmsg"
    > * removing ‘/home/example/R/x86_64-pc-linux-gnu-library/3.4/samplepackage’


    > It should instead be using that errmsg() function to print the more
    > helpful error message: "invalid value of LazyData field in DESCRIPTION".

    > I've traced it down to this line of code in tools:::.install_packages()
    > https://github.com/wch/r-source/blob/trunk/src/library/tools/R/install.R#L977
    > . The errmsg() function actually is defined earlier on in the function,
    > but there seems to be a scoping issue that makes it not available here.

    > I've uploaded a sample project to reproduce the bug here:
    > https://github.com/agwells/R-CMD-INSTALL-bug

    > I'm running R version 3.4.2 (2017-09-28), on Ubuntu 16.04.

    > Cheers,
    > Aaron

Thank you very much, Aaron.
This is indeed a bug, and it looks that I had caused it when
introducing the internal str_parse() utlity.

It's too bad this is so close before release of R 3.4.3 and the
fix to the bug is not trivial (not very hard either) such that
it most probably will not make it into 3.4.3.

Martin Maechler
ETH Zurich

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

Re: Bug in R CMD INSTALL when handling invalid LazyData DESCRIPTION field

Aaron Wells
Well, on the positive side, it seems to be a fairly limited bug. :)

You have to actually have a syntax error in your DESCRIPTION file, and
it needs to be in one of the fields passed to parse_description_field()
as defined in tools:::.install_packages(); which is only Biarch,
LazyData, ByteCompile, and KeepSource.

Cheers,
Aaron


On 11/24/2017 09:18 PM, Martin Maechler wrote:

>>>>>> Aaron Wells <[hidden email]>
>>>>>>     on Fri, 24 Nov 2017 12:46:48 +1300 writes:
>
>     > Hi, I think I've found a bug in R CMD INSTALL. When it tries to parse a
>     > DESCRIPTION file with an invalid LazyData field, it errors out while
>     > trying to print the correct error message:
>
>     >> R CMD INSTALL .
>     > * installing to library ‘/home/example/R/x86_64-pc-linux-gnu-library/3.4’
>     > * installing *source* package ‘samplepackage’ ...
>     > ** data
>     > Error in errmsg("invalid value of ", field, " field in DESCRIPTION") :
>     > could not find function "errmsg"
>     > * removing ‘/home/example/R/x86_64-pc-linux-gnu-library/3.4/samplepackage’
>
>
>     > It should instead be using that errmsg() function to print the more
>     > helpful error message: "invalid value of LazyData field in DESCRIPTION".
>
>     > I've traced it down to this line of code in tools:::.install_packages()
>     > https://github.com/wch/r-source/blob/trunk/src/library/tools/R/install.R#L977
>     > . The errmsg() function actually is defined earlier on in the function,
>     > but there seems to be a scoping issue that makes it not available here.
>
>     > I've uploaded a sample project to reproduce the bug here:
>     > https://github.com/agwells/R-CMD-INSTALL-bug
>
>     > I'm running R version 3.4.2 (2017-09-28), on Ubuntu 16.04.
>
>     > Cheers,
>     > Aaron
>
> Thank you very much, Aaron.
> This is indeed a bug, and it looks that I had caused it when
> introducing the internal str_parse() utlity.
>
> It's too bad this is so close before release of R 3.4.3 and the
> fix to the bug is not trivial (not very hard either) such that
> it most probably will not make it into 3.4.3.
>
> Martin Maechler
> ETH Zurich
>

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