a failed .rs.detachConflicts() call is never logged when linting

Open Beginner friendly
#19,934 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
r

Research direction

Read lintRSourceDocument() in SessionDiagnostics.cpp and inspect the .rs.detachConflicts call and its error check. Change the check to use detachError, then verify that a detach failure is logged; the issue notes that this failure case has not yet been reproduced.

Written by the indexing model from the issue text.

Description

bug

Found while surveying callers for #19932 (#19933).

Before linting an R document, lintRSourceDocument() in SessionDiagnostics.cpp detaches the .conflicts environment from the search path, and means to log a failure to do so:

Error detachError = r::exec::RFunction(".rs.detachConflicts")
      .call(&envirsSEXP, &protect);
if (error)
   LOG_ERROR(detachError);

The condition tests error, the variable used by the steps above it, where it should test detachError. Each of those earlier steps returns on failure, so error is always clear at this point and the log line can't run. It has been this way since the code was added in d9222131c8 (for #10093).

So a failure of .rs.detachConflicts() is silent, and linting carries on without it.

Checked by reading the code at 3b8c05c2d5; I have not made .rs.detachConflicts() fail.

Proposed fix: test detachError.

Dominant language
Java
Stars
5.1k
Forks
1.2k
Avg merge
1d 1h
Merged PRs (30d)
253

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rstudio/rstudio

All issues in rstudio/rstudio

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.