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

オープン 初心者向け
#76 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
r
領域
backend

調査の方向性

BiocFileCache の R ソースにある .verify_download_checksum() から始めます。これは省略可能な <url>.sha256 と <url>.md5 のリクエストを httr2 経由で処理します。miRBase の URL に対して bfcadd() の例で再現し、その後、非 2xx のチェックサム応答とリクエストエラーを「チェックサムが利用できない」という意味に変更します。ただし、実際の不一致や部分ダウンロードに対する失敗は保持します。完了とは、GFF3 のダウンロードが中止される代わりにメッセージ/警告付きで成功し、パッケージのテストが引き続き通ることです。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
R
スター
14
フォーク
9
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Bioconductor/BiocFileCache のほかの issue

Bioconductor/BiocFileCache の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。