slowkow / ggrepel

:round_pushpin: Repel overlapping text labels away from each other in your ggplot2 figures.
https://ggrepel.slowkow.com
GNU General Public License v3.0
1.22k stars 96 forks source link

valgrind issue about NA vs NaN #242

Closed slowkow closed 1 year ago

slowkow commented 1 year ago

Prof Brian Ripley reported that valgrind has errors on some packages when it uses NaN instead of NA.

Here is the error log for ggrepel:

* using log directory ‘/data/blackswan/ripley/R/packages/tests-vg/ggrepel.Rcheck’
* using R Under development (unstable) (2023-10-05 r85268)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
    gcc (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1)
    GNU Fortran (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1)
* running under: Fedora Linux 38 (Workstation Edition)
* using session charset: UTF-8
* using options ‘--use-valgrind --no-stop-on-test-error’
* checking for file ‘ggrepel/DESCRIPTION’ ... OK
* this is package ‘ggrepel’ version ‘0.9.3’
* package encoding: UTF-8
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package ‘ggrepel’ can be installed ... [25s/25s] OK
* used C++ compiler: ‘g++ (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1)’
* checking package directory ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking compiled code ... OK
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... [360s/362s] OK
* checking tests ...
  Running ‘testthat.R’ [15m/15m]
 [15m/15m] ERROR
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(withr)
  > library(testthat)
  > library(ggrepel)
  Loading required package: ggplot2
  > 
  > test_check("ggrepel")
  [ FAIL 2 | WARN 0 | SKIP 5 | PASS 70 ]

  ══ Skipped tests (5) ═══════════════════════════════════════════════════════════
  • On CRAN (5): 'test-just-with-angle.R:11:3', 'test-just-with-angle.R:51:3',
    'test-just-with-angle.R:91:3', 'test-just-with-angle.R:130:3',
    'test-just-with-angle.R:174:3'

  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test-seed.R:76:3'): calling geom_text_repel with seed creates identical plots ──
  identical(pos1, pos2) is not TRUE

  `actual`:   FALSE
  `expected`: TRUE 
  ── Failure ('test-seed.R:156:3'): calling geom_label_repel with seed creates identical plots ──
  identical(pos1, pos2) is not TRUE

  `actual`:   FALSE
  `expected`: TRUE 

  [ FAIL 2 | WARN 0 | SKIP 5 | PASS 70 ]
  Error: Test failures
  Execution halted
slowkow commented 1 year ago

This commit has the fix: https://github.com/slowkow/ggrepel/commit/267e52c8c0164daa72a0ab3f4f3b48e8fc41f7a4

The problem is solved by changing expect_true(identical(pos1, pos2)) to expect_equal(pos1, pos2)

Here is a log of a new run of valgrind where the error is no longer appearing: https://github.com/slowkow/ggrepel/actions/runs/6498978607/job/17651398979