bfcadd() fails when checksum URL returns a non-404 error (e.g., HTTP 500)

Aperta Adatta ai principianti
#76 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
r
Ambito
backend

Direzione di ricerca

Inizia da .verify_download_checksum() nei sorgenti R di BiocFileCache, che gestisce le richieste opzionali <url>.sha256 e <url>.md5 tramite httr2. Riproduci con l’esempio bfcadd() contro l’URL miRBase, poi modifica le risposte checksum non-2xx e gli errori di richiesta in modo che significhino “nessun checksum disponibile”, preservando i fallimenti per discrepanze reali o download parziali. Fatto significa che il download GFF3 riesce con un messaggio/avviso invece di interrompersi, e che i test del pacchetto continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

Since 3.3.1 ("Check md5sum or sha if available"), .verify_download_checksum()
requests <url>.sha256 and <url>.md5 after a download. Only HTTP 404/410
are treated as "checksum not available"; any other non-2xx status raises an
error. That makes the whole download fail, and the resource is removed from
the cache.

Some servers return 5xx (or 403, etc.) for files that don't exist. miRBase
is one example:

https://www.mirbase.org/download/hsa.gff3         -> 200
https://www.mirbase.org/download/hsa.gff3.sha256  -> 500
https://www.mirbase.org/download/hsa.gff3.md5     -> 500

Reproducible example

library(BiocFileCache)
bfc <- BiocFileCache(tempfile(), ask = FALSE)
bfcadd(bfc, rname = "https://www.mirbase.org/download/hsa.gff3",
       rtype = "web", download = TRUE)
#> Error: bfcadd() failed; see warnings()
warnings()
#>   download failed
#>   web resource path: 'https://www.mirbase.org/download/hsa.gff3'
#>   ...
#>   reason: Could not retrieve sha256 checksum: HTTP 500

The file itself downloads fine (curl, download.file(), and BiocFileCache
before 3.3.1 all work).

Expected behavior

The checksum is optional ("if available"), so failing to retrieve one
should not abort a download that succeeded. Only an actual checksum
mismatch (or a partial download) should be an error. Suggested change: in
.verify_download_checksum(), treat any non-2xx status for the checksum URL,
and any request error (e.g., wrap req_perform() in tryCatch()), as "no
checksum available" and move on to the next algorithm, perhaps with a
message()/warning(), rather than calling stop().

This currently breaks downstream vignettes on the devel build (e.g., Bioc.gff,
which caches the miRBase GFF3 with bfcadd()).

Session info

  • BiocFileCache 3.3.2
  • httr2 1.3.0
  • R 4.6 / Bioconductor devel
Lingua principale
R
Stelle
14
Fork
9
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Bioconductor/BiocFileCache

Tutte le issue di Bioconductor/BiocFileCache

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.