Skip to content

Package and file size checks do not fire when BiocCheck() is given a tarball #259

Description

@seandavi

Summary

When BiocCheck() is given a source tarball, all three size checks are silent regardless of
how large the package is:

  • checkPackageSize() (the 10 MB tarball ERROR) never fires — on any input, tarball or
    source directory.
  • checkIndivFileSizes() and checkDataFileSizes() (the 5 MB WARNINGs) never fire on
    tarball input; they work correctly on source-directory input.

Tested with BiocCheck 1.49.30.

Cause

checkPackageSize() sizes a directory, not the tarball. It reads
.BiocPackage$sourceDir:

checkPackageSize <- function(.BiocPackage, size = 10L) {
    pkg <- .BiocPackage$sourceDir
    ...
    pkgSize <- file.size(pkg)

For tarball input, getPackageDir() untars the archive and sets sourceDir to the unpacked
directory
, keeping the tarball path in tarFilename. file.size() on a directory returns the
directory entry size (tens of bytes to a few KB), so pkgSize > maxSize is never true. For
source-directory input sourceDir is likewise a directory, so the check cannot fire there
either.

.findLargeFiles() has no branch that tarball input can reach.
It takes either the
gert::git_ls() branch when isGitClone is TRUE, or the list.files() branch when
isSourceDir is TRUE. A tarball is neither — isSourceDir is set to
!isTar && <is a directory> — so the function falls off the end and returns NULL.

Reproducible example

A minimal Software-type package with one 30 MB file in inst/extdata, built with
R CMD build into a 30,005,481-byte tarball:

bp <- BiocCheck:::.BiocPackage$copy()
bp$initialize("bigpkg_0.99.0.tar.gz")

bp$isTar                                            #> TRUE
bp$packageType                                      #> "Software"
file.size(bp$sourceDir)                             #> 83          <- a directory
file.size(bp$tarFilename)                           #> 30005481    <- the tarball

BiocCheck:::checkPackageSize(bp)                    #> (silent)
BiocCheck:::.findLargeFiles(bp, data_only = FALSE)  #> NULL

A full run confirms it end to end — the two errors and two warnings are unrelated to size:

r <- BiocCheck::BiocCheck("bigpkg_0.99.0.tar.gz")
#> * Checking package size...
#> * Checking individual file sizes...
#> ✖ 2 ERRORS | ⚠ 2 WARNINGS | ℹ 4 NOTES
names(r$error)    #> "checkBiocViews"  "checkVignetteDir"
names(r$warning)  #> "checkDescFieldLength"  "checkBiocDepsDESC"

On the same package as a source directory, the per-file check behaves as documented while the
tarball check still does not:

bp2 <- BiocCheck:::.BiocPackage$copy()
bp2$initialize("bigpkg")

file.size(bp2$sourceDir)                             #> 77
BiocCheck:::checkPackageSize(bp2)                    #> (silent)
BiocCheck:::.findLargeFiles(bp2, data_only = FALSE)  #> .../inst/extdata/blob.bin

Why it matters

Checking a tarball is the documented and common way to run BiocCheck, and it is what automated
pipelines use. In particular, r-universe runs BiocCheck against the built tarball for the
Bioconductor universes
(r-universe-org/actions/bioc-check),
so no size feedback reaches maintainers there at all. The only size limit in force in that
pipeline is r-universe's own 100 MiB per published file — about ten times the Bioconductor
tarball guidance, with no per-file component.

This looks like the same family as #167 (per-file check not firing), which was addressed for
the source-directory path; the tarball path appears to have been left behind, and
checkPackageSize() seems never to have measured the tarball.

Suggested fix

  • In checkPackageSize(), size .BiocPackage$tarFilename when isTar is TRUE, and skip (or
    size the unpacked contents) otherwise — the message text, "Package tarball exceeds the
    Bioconductor size requirement", already implies the tarball is what was intended.
  • In .findLargeFiles(), allow the tarball case by walking the unpacked sourceDir. The
    gert::git_ls() branch cannot apply there, but the list.files() branch works unchanged.

Happy to open a PR if that would be useful.

Minor, in passing: in the list.files() branch of .findLargeFiles(), the folder list from
list.dirs() contains both "" and its subdirectories, so files under a nested directory are
returned more than once — blob.bin above is reported twice in source-directory mode.

Environment

R version 4.6.1 (2026-06-24)
BiocCheck 1.49.30
BiocManager 1.30.27

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