Skip to content

tp_compile_options() throws on tpplc 0.4's --help output (stale "Options:" header assumption) #23

Description

@maribraga

Environment

  • treepplr 0.14.0
  • tpplc 0.4

Bug

library(treepplr)
tp_compile_options()
#> Error in (x + 1):length(cmd_opt) : argument of length 0

Root cause

tp_compile_options <- function() {
    tpplc_path <- tp_installing_treeppl()
    cmd_opt <- system2(command = tpplc_path, args = "--help", ...)
    x <- which(cmd_opt == "Options:")
    cmd_opt <- cmd_opt[(x + 1):length(cmd_opt)]
    ...

It looks for a line that is exactly "Options:" in tpplc --help's output. The current tpplc 0.4--help output uses section headers "Debug options:", "Compile options:", "Runtime options:", "Inference methods:" instead — none of which match "Options:" exactly — so which() returns integer(0), and (x + 1):length(cmd_opt) becomes a nonsensical range, throwing immediately.

This function isn't called internally anywhere (compile/runtime option classification uses a hardcoded tpplcCompileOptions character vector instead), so it appears to be stale/unmaintained relative to the current CLI — but it's exported, so a user calling it directly (e.g. to discover available options) hits an immediate, confusing error with no indication that the function itself is out of date.

Suggested fix

Either update the parsing to match the current --help section headers, or deprecate/remove the function if the hardcoded tpplcCompileOptions approach is now the intended source of truth.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions