Re: [Rd] minor iconvlist() bug in r-devel

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed 16 Mar 2005 - 16:57:56 GMT

On Wed, 16 Mar 2005, Deepayan Sarkar wrote:

> On Wednesday 16 March 2005 10:11, Prof Brian Ripley wrote:
>> That file is created by
>>
>> $(top_builddir)/library/$(pkg)/iconvlist: most
>> @iconv -l > $@ 2> /dev/null || touch $@
>>
>> What version of iconv -l is that produces such a list? That in glibc
>> 2.3.4 does not produce the header when redirected.
>
> I have version '2.3.2.ds1-20' on Debian testing. '--silent' doesn't
> help.

I found an old RH9 system that did the same thing.

>> Your fix is not safe: iconv in libiconv produces items separated by
>> space or newline. Looks like we will have to work harder to
>> distinguish the two.
>
> Can anything with a lowercase letter be safely rejected? That would
> bring the spurious names down to 2 (FROM and TO).

No. I think what we can do is to look to see if most lines end in //, and if so assume glibc format.

Brian

>
> Deepayan
>
>> Brian
>>
>> On Wed, 16 Mar 2005, Deepayan Sarkar wrote:
>>> This is on r-devel from 2005-03-15. iconvlist() uses (at least some
>>> of the time)
>>>
>>> icfile <- system.file("iconvlist", package = "utils")
>>>
>>> which looks like
>>>
>>> """
>>> The following list contain all the coded character sets known.
>>> This does not necessarily mean that all combinations of these names
>>> can be used for the FROM and TO command line parameters. One coded
>>> character set can be listed with several different names (aliases).
>>>
>>> 437//
>>> 500//
>>> .
>>> .
>>> .
>>> """
>>>
>>> which leads to
>>>
>>>> tail(iconvlist(), n = 40)
>>>
>>> [1] "WS2" "YU" "all" "all"
>>> "and" [6] "be" "be" "can" "can"
>>> "character" [11] "character" "coded" "coded"
>>> "combinations" "command" [16] "contain" "different" "does"
>>> "following" "for" [21] "known." "line"
>>> "list" "listed" "mean" [26] "names" "names"
>>> "necessarily" "not" "of" [31] "parameters." "set"
>>> "sets" "several" "that" [36] "the"
>>> "the" "these" "used" "with"
>>>
>>> A possible fix seems to be to replace
>>>
>>> ext <- readLines(icfile)
>>>
>>> by
>>>
>>> ext <- grep("/$", readLines(icfile), value = TRUE)
>>>
>>> but I don't know if that's guaranteed to work.
>>>
>>> -Deepayan
>>>
>>> ______________________________________________
>>> R-devel@stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu Mar 17 04:06:49 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:02 GMT