Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_R_CHECK_LENGTH_1_LOGIC2_ #238

Closed
bastistician opened this issue Nov 2, 2018 · 3 comments
Closed

_R_CHECK_LENGTH_1_LOGIC2_ #238

bastistician opened this issue Nov 2, 2018 · 3 comments

Comments

@bastistician
Copy link

With current R-devel, we can use the experimental environment variable _R_CHECK_LENGTH_1_LOGIC2_ to detect code where && or || encounter arguments of length more than one.
For xml2, I see

Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" = TRUE)
xml2::read_html("<html><title>Hi<title></html>")
#> Error in is.null(arg) || !nzchar(arg) : 
#>   'length(x) = 3 > 1' in coercion to 'logical(1)'
traceback()
#> 3: parse_options(options, xml_parse_options())
#> 2: read_html.default("<html><title>Hi<title></html>")
#> 1: xml2::read_html("<html><title>Hi<title></html>")

I stumbled upon this problem when R-devel CMD checking my own packages in an environment with enabled _R_CHECK_LENGTH_1_LOGIC2_:

  • checking CRAN incoming feasibility ... NOTE
    Checking URLs failed with message:
    'length(x) = 3 > 1' in coercion to 'logical(1)'

This is because CRAN incoming check functions make use of xml2::read_html() (see https://github.com/wch/r-source/blob/83a4b1391b0bc98aa3b8d786b1ddf952e5bb773f/src/library/tools/R/urltools.R#L72).

Session Info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                                             
#>  version  R Under development (unstable) (2018-11-02 r75535)
#>  os       Ubuntu 16.04.5 LTS                                
#>  system   x86_64, linux-gnu                                 
#>  ui       X11                                               
#>  language de_DE                                             
#>  collate  de_DE.UTF-8                                       
#>  ctype    de_DE.UTF-8                                       
#>  tz       Europe/Berlin                                     
#>  date     2018-11-02                                        
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date       lib source        
#>  assertthat    0.2.0   2017-04-11 [1] CRAN (R 3.6.0)
#>  backports     1.1.2   2017-12-13 [1] CRAN (R 3.6.0)
#>  base64enc     0.1-3   2015-07-28 [1] CRAN (R 3.6.0)
#>  callr         3.0.0   2018-08-24 [1] CRAN (R 3.6.0)
#>  cli           1.0.1   2018-09-25 [1] CRAN (R 3.6.0)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
#>  debugme       1.1.0   2017-10-22 [1] CRAN (R 3.6.0)
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 3.6.0)
#>  devtools      2.0.1   2018-10-26 [1] CRAN (R 3.6.0)
#>  digest        0.6.18  2018-10-10 [1] CRAN (R 3.6.0)
#>  fs            1.2.6   2018-08-23 [1] CRAN (R 3.6.0)
#>  glue          1.3.0   2018-07-17 [1] CRAN (R 3.6.0)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.0)
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 3.6.0)
#>  pkgbuild      1.0.2   2018-10-16 [1] CRAN (R 3.6.0)
#>  pkgload       1.0.2   2018-10-29 [1] CRAN (R 3.6.0)
#>  prettyunits   1.0.2   2015-07-13 [1] CRAN (R 3.6.0)
#>  processx      3.2.0   2018-08-16 [1] CRAN (R 3.6.0)
#>  ps            1.2.0   2018-10-16 [1] CRAN (R 3.6.0)
#>  R6            2.3.0   2018-10-04 [1] CRAN (R 3.6.0)
#>  Rcpp          0.12.19 2018-10-01 [1] CRAN (R 3.6.0)
#>  remotes       2.0.2   2018-10-30 [1] CRAN (R 3.6.0)
#>  rlang         0.3.0.1 2018-10-25 [1] CRAN (R 3.6.0)
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.6.0)
#>  sessioninfo   1.1.0   2018-09-25 [1] CRAN (R 3.6.0)
#>  testthat      2.0.1   2018-10-13 [1] CRAN (R 3.6.0)
#>  usethis       1.4.0   2018-08-14 [1] CRAN (R 3.6.0)
#>  withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)
#>  xml2          1.2.0   2018-01-24 [1] CRAN (R 3.6.0)
#> 
#> [1] /opt/R/R-devel/site-library
#> [2] /opt/R/R-devel/build/library
@sckott
Copy link

sckott commented Jan 11, 2019

@jimhester

Same issue with a package of mine on R-devel with _R_CHECK_LENGTH_1_LOGIC2_ set - see travis build https://travis-ci.org/ropensci/wikitaxa/jobs/478124455#L3397

@patr1ckm
Copy link

patr1ckm commented May 14, 2019

arg here is set by options in the methods read_html.response and read_html.default. The default value for options set by these methods is "RECOVER" "NOERROR" "NOBLANKS", so !nzchar(arg) returns a vector.

@jimhester
Copy link
Member

Fixed by c041227

clrpackages pushed a commit to clearlinux-pkgs/R-wikitaxa that referenced this issue Jun 30, 2020
…n 0.4.0

Scott Chamberlain (29):
      update docs
      bump to dev version
      use dev vcr, run _R_CHECK_LENGTH_1_LOGIC2_ on r-devel
      use build matrix on appveyor, and do _R_CHECK_LENGTH_1_LOGIC2_ on r-devel [skip travis]
      --no-build-vignettes  on travis so we can proceed to tests where hopefully stack trace
      fix travis
      all vignette chunks  eval=FALSE
      put test_taht blocks inside of use_cassette blocks
      set _R_CHECK_LENGTH_1_LOGIC2_ to FALSE for now - problem is in xml2, see r-lib/xml2#238
      contributing file tweaks
      add makefile
      remove vignette cmds from makefile
      delete rstudio file
      bump year in license file
      remove docs link to httr since not imported in pkg fix #19
      update docs for new roxygen2 version
      set utf8=FALSE for now across pkg due to curl::curl_escape segfault jeroen/curl#228
      re-record test fixtures
      remove email option in contributing file
      gh actions
      pkg level man file needs a description tag
      fix tests
      windows vcr fixes
      add gh actions badge to readme
      different vignette setup. remove egs from readme
      update revdep checks
      update news and cran comments, update codemeta.json
      update readme.md
      remove Remotes from DESCRIPTION, update cran comments

rOpenSci Bot (1):
      Add links to official docs site.
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 a pull request may close this issue.

4 participants