From macrakis at alum.mit.edu  Sun Nov  1 05:00:12 2009
From: macrakis at alum.mit.edu (macrakis at alum.mit.edu)
Date: Sun,  1 Nov 2009 05:00:12 +0100 (CET)
Subject: [Rd] Internal error in 'ls' for pathological environments (PR#14035)
Message-ID: <20091101040013.149F2282EF3D@mail.pubhealth.ku.dk>

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]]



[Rd] Internal error in 'ls' for pathological environments (PR#14035)
macrakis at alum.mit.edu