Skip to content

after turning off tracebug, in debugging, ESS continues to send <newline> to R. #973

@mmaechler

Description

@mmaechler

Because of the source(*, echo=TRUE) breaking bug, I've turned off tracebug completely in ESS for the time being. Now, e.g.,

debug(ts)
ts(1:100, start = as.Date("2019-12-12"), frequency=12)

(which reveals a bug in current R-devel from one my own recent commits !),
then in the debugger, typing 'n', occasionally inspecting variables, or typing ls.str(),
I several times have ESS sending <newline> or <enter> to R "behind my back"; here's part of a transcript (using R 3.6.2 where ts() does not show any bug, of course):

debugging in: ts(1:100, start = as.Date("2019-12-12"), frequency = 12)
debug: {
    if (is.data.frame(data)) 
        data <- data.matrix(data)
    if (is.matrix(data)) {
        nseries <- ncol(data)
        ndata <- nrow(data)
        dimnames(data) <- list(NULL, names)
    }
    else {
        nseries <- 1
        ndata <- length(data)
    }
    if (ndata == 0) 
        stop("'ts' object must have one or more observations")
    if (missing(frequency)) 
        frequency <- 1/deltat
    else if (missing(deltat)) 
        deltat <- 1/frequency
    if (frequency > 1 && abs(frequency - round(frequency)) < 
        ts.eps) 
        frequency <- round(frequency)
    if (length(start) > 1L) {
        start <- start[1L] + (start[2L] - 1)/frequency
    }
    if (length(end) > 1L) {
        end <- end[1L] + (end[2L] - 1)/frequency
    }
    if (missing(end)) 
        end <- start + (ndata - 1)/frequency
    else if (missing(start)) 
        start <- end - (ndata - 1)/frequency
    if (start > end) 
        stop("'start' cannot be after 'end'")
    nobs <- floor((end - start) * frequency + 1.01)
    if (nobs != ndata) 
        data <- if (NCOL(data) == 1) {
            if (ndata < nobs) 
                rep_len(data, nobs)
            else if (ndata > nobs) 
                data[1L:nobs]
        }
        else {
            if (ndata < nobs) 
                data[rep_len(1L:ndata, nobs), ]
            else if (ndata > nobs) 
                data[1L:nobs, ]
        }
    attr(data, "tsp") <- c(start, end, frequency)
    if (!is.null(class) && class[[1]] != "none") 
        attr(data, "class") <- class
    data
}
Browse[2]> n
debug: if (is.data.frame(data)) data <- data.matrix(data)
Browse[2]> n
debug: if (is.matrix(data)) {
    nseries <- ncol(data)
    ndata <- nrow(data)
    dimnames(data) <- list(NULL, names)
} else {
    nseries <- 1
    ndata <- length(data)
}
Browse[2]> ls.str()
class : <missing>
data :  int [1:100] 1 2 3 4 5 6 7 8 9 10 ...
deltat :  num 1
end :  num(0) 
frequency :  num 12
names : <missing>
start :  Date[1:1], format: "2019-12-12"
ts.eps :  num 1e-05
Browse[2]> debug: nseries <- 1
Browse[2]> n
debug: ndata <- length(data)
Browse[2]> n
debug: if (ndata == 0) stop("'ts' object must have one or more observations")
Browse[2]> debug: if (missing(frequency)) frequency <- 1/deltat else if (missing(deltat)) deltat <- 1/frequency
Browse[2]> missing(start)
[1] FALSE
Browse[2]> debug: if (missing(deltat)) deltat <- 1/frequency
Browse[2]> 

note in the last 6-7 lines above, that two of them have debug: <.. R code ..> and these were caused by ESS entirely, without me any typing at all; so there were line advances that I did not cause by typing Enter (aka "return" aka "newline") or n at all.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions