[Rd] suggestion to fix packageDescription() for Windows users

Martin Maechler maechler at stat.math.ethz.ch
Tue Jun 27 12:34:28 CEST 2017


>>>>> Nathan Sosnovske via R-devel <r-devel at r-project.org>
>>>>>     on Mon, 26 Jun 2017 18:22:25 +0000 writes:

    > I'd be curious to know what others think of Rich's
    > patch. If it is acceptable, I can spend time that I was
    > going to look at it this week on another bug. 

It is a bit kludgy (*) of course, but I confirm it solves the
problem in a "robust" way.

*) Of course I'd hoped you'd find why the underlying
packageDescription() function is not "getting the right thing" in this
case directly -- in Windows only in some locales -- and provide a
Windows-only patch for the underlying problem there, rather than
the workaround patch in citation().
The patch does solve the problem at hand, alright, so thank you,
Rich and Nathan!

Note that Duncan Murdoch did mention in this thread to file 
an official bug report and Ben Marwick gave the URL

> From: Ben Marwick ...
> Subject: Re: [Rd] suggestion to fix packageDescription() for Windows users
> Date: Sun, 18 Jun 2017 08:34:56 +1000

> Thanks very much, I see your bug report here:
> https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17291

so ideally almost all of this follow up should have happened there.
I have followed up there and also there attached a Windows-only
+ commented version of Rich's patch. As mentioned, I've tested
it and confirmed to work for the use case in the mean time, so
plan to commit soon.

This will be too late for the release of R 3.4.1 tomorrow,
of course [code freeze was on June 23].

Martin Maechler
ETH Zurich

    > -----Original Message-----
    > From: Rich Calaway 
    > Sent: Friday, June 23, 2017 6:34 PM
    > To: Nathan Sosnovske <nsosnov at microsoft.com>; Duncan Murdoch <murdoch.duncan at gmail.com>; Andrie de Vries <apdevries at gmail.com>
    > Cc: Ben Marwick <bmarwick at uw.edu>; R-devel Mailing List (r-devel at r-project.org) <r-devel at r-project.org>
    > Subject: RE: [Rd] suggestion to fix packageDescription() for Windows users

    > The following patch is not the most elegant, but it restores the Authors when "LC_CTYPE" is set to either "Chinese" or "Arabic":

    >> Sys.setlocale("LC_CTYPE", "Chinese")
    > [1] "Chinese (Simplified)_China.936"
    >> citation("readr")

    > To cite package ‘readr’ in publications use:

    > (2016). readr: Read Tabular Data. R package version 1.0.0.
    > https://CRAN.R-project.org/package=readr

    > A BibTeX entry for LaTeX users is

    > @Manual{,
    > title = {readr: Read Tabular Data},
    > year = {2016},
    > note = {R package version 1.0.0},
    > url = {https://CRAN.R-project.org/package=readr},
    > }

    > ATTENTION: This citation information has been auto-generated from the package DESCRIPTION file and may need manual editing, see ‘help("citation")’.

    >> Sys.setlocale("LC_CTYPE", "Arabic")
    > [1] "Arabic_Saudi Arabia.1256"
    >> citation("readr")

    > To cite package ‘readr’ in publications use:

    > (2016). readr: Read Tabular Data. R package version 1.0.0.
    > https://CRAN.R-project.org/package=readr

    > A BibTeX entry for LaTeX users is

    > @Manual{,
    > title = {readr: Read Tabular Data},
    > year = {2016},
    > note = {R package version 1.0.0},
    > url = {https://CRAN.R-project.org/package=readr},
    > }

    > ATTENTION: This citation information has been auto-generated from the package DESCRIPTION file and may need manual editing, see ‘help("citation")’.

    >> citation <- newCitation
    >> citation("readr")

    > To cite package ‘readr’ in publications use:

    > Hadley Wickham, Jim Hester and Romain Francois (2016). readr: Read
    > Tabular Data. R package version 1.0.0.
    > https://CRAN.R-project.org/package=readr

    > A BibTeX entry for LaTeX users is

    > @Manual{,
    > title = {readr: Read Tabular Data},
    > author = {Hadley Wickham and Jim Hester and Romain Francois},
    > year = {2016},
    > note = {R package version 1.0.0},
    > url = {https://CRAN.R-project.org/package=readr},
    > }



    > The patch is:

    > Index: citation.R
    > ===================================================================
    > --- citation.R	(revision 72852)
    > +++ citation.R	(working copy)
    > @@ -1162,8 +1162,11 @@
    > if(dir == "")
    > stop(gettextf("package %s not found", sQuote(package)),
    > domain = NA)
    > -        meta <- packageDescription(pkg = package,
    > -                                   lib.loc = dirname(dir))
    > +	    args <- list(pkg = package, lib.loc = dirname(dir))
    > +	    if (!is.na(enc <- packageDescription(pkg = package, lib.loc=dirname(dir), field="Encoding")))
    > +		    args$enc <- enc
    > +        meta <- do.call("packageDescription", args=args)
    > +
    > ## if(is.null(auto)): Use default auto-citation if no CITATION
    > ## available.
    > citfile <- file.path(dir, "CITATION")


    > Nathan says he can look into this further next week...

    > Cheers,

    > Rich Calaway
    > Microsoft R Product Team
    > 24/1341
    > +1 (425) 4219919 X19919

    > -----Original Message-----
    > From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of Nathan Sosnovske via R-devel
    > Sent: Friday, June 23, 2017 7:36 AM
    > To: Duncan Murdoch <murdoch.duncan at gmail.com>; Andrie de Vries <apdevries at gmail.com>
    > Cc: r-devel at r-project.org; Ben Marwick <bmarwick at uw.edu>
    > Subject: Re: [Rd] suggestion to fix packageDescription() for Windows users

    > Hi Duncan,

    > I'm guessing I'll be able to look at this over the weekend/next week (probably closer to next week). It is on my list of things to do and I've just had a few other prior commitments that I have to finish first.

    > Sorry for the delay. I'll chime in with a status update next week.

    > Nathan

    > -----Original Message-----
    > From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of Duncan Murdoch
    > Sent: Friday, June 23, 2017 5:16 AM
    > To: Andrie de Vries <apdevries at gmail.com>
    > Cc: r-devel at r-project.org; Ben Marwick <bmarwick at uw.edu>
    > Subject: Re: [Rd] suggestion to fix packageDescription() for Windows users

    > On 18/06/2017 5:57 AM, Andrie de Vries wrote:
    >> Hi, Duncan
    >> 
    >> i have forwarded this thread to Nathan, who promised to look into it.

    > Any progress on this?

    > Duncan Murdoch

    >> 
    >> Andrie
    >> 
    >> On 17 Jun 2017 17:26, "Duncan Murdoch" <murdoch.duncan at gmail.com 
    >> <mailto:murdoch.duncan at gmail.com>> wrote:
    >> 
    >> On 17/06/2017 9:13 AM, Ben Marwick wrote:
    >> 
    >> Hi Duncan,
    >> 
    >> Thanks for your reply. Yes, it does seem to be specific to the CTYPE
    >> setting to Chinese on Windows. If I set it to English using
    >> Sys.setlocale() there is no problem, then back to Chinese and the
    >> authors disappear:
    >> 
    >> Sys.setlocale("LC_ALL","English")
    >> citation("readr")
    >> 
    >> 
    >> Thanks, that makes the problem reproducible.  I'll submit it as a
    >> bug report.  Maybe someone from Microsoft will fix it.
    >> 
    >> Duncan Murdoch

    [.........]



More information about the R-devel mailing list