[Rd] (PR#13487) Segfault when mistakenly calling [.data.frame
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jan 29 22:44:40 CET 2009
What did your actual application do? This seems a very strange thing
to do, and the segfault is in trying to construct the traceback.
Only by using do.call on the object (and not even by name) do I get
this error. E.g.
> `[.data.frame`(1:10, 3)
Error in NextMethod("[") : object not specified
> do.call("[.data.frame", list(1:10, 3))
Error in NextMethod("[") : object not specified
are fine.
Obviously it would be nice to fix this, but I'd like to understand the
actual circumstances: there is more to it than the subject line.
On Thu, 29 Jan 2009, brechbuehler at gmail.com wrote:
> Full_Name: Christian Brechbuehler
> Version: 2.7.2, 2.8.1
> OS: linux-gnu
> Submission from: (NULL) (24.128.51.18)
>
>
> Calling [.data.frame on an object that's not a data frame, specifically 1:10,
> causes segmentation fault.
>
> Context
> =======
> We can subscript with a number of different notations:
>
> > (1:10)[3]
> [1] 3
> > do.call(get("[",pos="package:base"),list(1:10,3))
> [1] 3
> > do.call(get("[.numeric_version",pos="package:base"),list(1:10,3))
> [1] 3
>
> Problem
> =======
> If we mistakenly believe the object is a data frame (as we did in a much more
> complicated real situation), this happens:
>
> > do.call(get("[.data.frame",pos="package:base"),list(1:10,3))
> Error in NextMethod("[") :
> no calling generic was found: was a method called directly?
>
> *** caught segfault ***
> address (nil), cause 'unknown'
>
> Process R:2 segmentation fault (core dumped) at Thu Jan 29 09:26:29 2009
>
> The Error message is appropriate. But the segmentation fault is unexpected.
>
>
> Versions
> ========
> I reproduced the problem on R 2.7.2 and 2.8.1. Details:
>
>> version
> _
> platform x86_64-unknown-linux-gnu
> arch x86_64
> os linux-gnu
> system x86_64, linux-gnu
> status Patched
> major 2
> minor 7.2
> year 2008
> month 09
> day 20
> svn rev 46776
> language R
> version.string R version 2.7.2 Patched (2008-09-20 r46776)
>
> ==========================================================
>
>> version
> _
> platform x86_64-unknown-linux-gnu
> arch x86_64
> os linux-gnu
> system x86_64, linux-gnu
> status Patched
> major 2
> minor 8.1
> year 2009
> month 01
> day 26
> svn rev 47743
> language R
> version.string R version 2.8.1 Patched (2009-01-26 r47743)
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at 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
More information about the R-devel
mailing list