[Rd] Internal error in 'ls' for pathological environments (PR#14035)

From: <macrakis_at_alum.mit.edu>
Date: Sun, 01 Nov 2009 05:00:12 +0100 (CET)


nchar(with(list(2),ls())) gives an internal error. This is of course a peculiar call (no names in the list), but the error is not caught cleanly.

It is not clear from the documentation whether with(list(2)...) is allowable; if it is not, it should presumably give an error. If it is, then ls
shouldn't have problems with the resulting environment.

> qq <- with(list(2),ls()) # An incorrect call (no
names in list)
> nchar(qq)

Error in nchar(qq) : 'getEncChar' must be called on a CHARSXP # ls returned a bad object
> qq

[1]Error: 'getEncChar' must be called on a CHARSXP
> qq[1]

[1]Error: 'getEncChar' must be called on a CHARSXP
> qq[2]

[1] NA

Apparently related:

> with(list(a=1,2),ls())

Error in ls() : 'getEncChar' must be called on a CHARSXP

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status =
 major = 2
 minor = 9.2
 year = 2009
 month = 08
 day = 24
 svn rev = 49384
 language = R
 version.string = R version 2.9.2 (2009-08-24)

Windows Vista x64 (build 6002) Service Pack 2

Locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

Search Path:
 .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun 01 Nov 2009 - 04:07:24 GMT

This archive was generated by hypermail 2.2.0 : Sun 01 Nov 2009 - 12:30:18 GMT