Skip to content

Fix length() equality precedence in input validation - #906

Closed
sims1253 wants to merge 1 commit into
r-lib:mainfrom
sims1253:fix/length-equality-precedence
Closed

Fix length() equality precedence in input validation#906
sims1253 wants to merge 1 commit into
r-lib:mainfrom
sims1253:fix/length-equality-precedence

Conversation

@sims1253

@sims1253 sims1253 commented Aug 5, 2026

Copy link
Copy Markdown

In pkg_deps_explain(), pkg_status(), and pkg_deps_tree() the input validation guard was written as length(pkg == 1) instead of length(pkg) == 1. Because the equality test sat inside length(), the expression evaluated to length() and never actually checked that pkg is length 1. Move the closing paren so the comparison is outside length().

Found with ry

In pkg_deps_explain(), pkg_status(), and pkg_deps_tree() the input
validation guard was written as length(pkg == 1) instead of
length(pkg) == 1. Because the equality test sat inside length(), the
expression evaluated to length(<logical>) and never actually checked
that pkg is length 1. Move the closing paren so the comparison is
outside length().
@gaborcsardi

Copy link
Copy Markdown
Member

Duplicate of #902?

@gaborcsardi gaborcsardi closed this Aug 5, 2026
@sims1253

sims1253 commented Aug 5, 2026

Copy link
Copy Markdown
Author

Seems so, sorry for not checking open PRs before filing this one.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants