diff options
author | Timo Teräs <timo.teras@iki.fi> | 2023-04-17 14:19:09 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-04-17 14:25:26 +0300 |
commit | 61c8a731b6d01cefbf746e538be5f086b1af4b97 (patch) | |
tree | b98123b110ad8ddf548a203944c364e0c8485945 | |
parent | 97e2a10884f2887724ec6d27a15043dea38998a9 (diff) | |
download | apk-tools-61c8a731b6d01cefbf746e538be5f086b1af4b97.tar.gz apk-tools-61c8a731b6d01cefbf746e538be5f086b1af4b97.tar.bz2 apk-tools-61c8a731b6d01cefbf746e538be5f086b1af4b97.tar.xz apk-tools-61c8a731b6d01cefbf746e538be5f086b1af4b97.zip |
db: suppress warning about missing checksum for special files
fixes #10889
-rw-r--r-- | src/database.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/database.c b/src/database.c index e311953..dd64014 100644 --- a/src/database.c +++ b/src/database.c @@ -2504,6 +2504,19 @@ static int contains_control_character(const char *str) return 0; } +static int need_checksum(mode_t mode) +{ + switch (mode & S_IFMT) { + case S_IFSOCK: + case S_IFBLK: + case S_IFCHR: + case S_IFIFO: + return FALSE; + default: + return TRUE; + } +} + static int apk_db_install_v2meta(struct apk_extract_ctx *ectx, struct apk_istream *is) { struct install_ctx *ctx = container_of(ectx, struct install_ctx, ectx); @@ -2733,19 +2746,21 @@ static int apk_db_install_file(struct apk_extract_ctx *ectx, const struct apk_fi ipkg->sha256_160 = 1; file->csum.type = APK_CHECKSUM_SHA1; memcpy(file->csum.data, ae->digest.data, file->csum.type); - } else if (ae->digest.alg == APK_DIGEST_NONE && !ctx->missing_checksum) { - apk_warn(out, - PKG_VER_FMT": support for packages without embedded " - "checksums will be dropped in apk-tools 3.", - PKG_VER_PRINTF(pkg)); - ipkg->broken_files = 1; - ctx->missing_checksum = 1; - } else if (file->csum.type == APK_CHECKSUM_NONE && !ctx->missing_checksum) { - apk_warn(out, - PKG_VER_FMT": unknown v3 checksum", - PKG_VER_PRINTF(pkg)); - ipkg->broken_files = 1; - ctx->missing_checksum = 1; + } else if (need_checksum(ae->mode) && !ctx->missing_checksum) { + if (ae->digest.alg == APK_DIGEST_NONE) { + apk_warn(out, + PKG_VER_FMT": support for packages without embedded " + "checksums will be dropped in apk-tools 3.", + PKG_VER_PRINTF(pkg)); + ipkg->broken_files = 1; + ctx->missing_checksum = 1; + } else if (file->csum.type == APK_CHECKSUM_NONE) { + apk_warn(out, + PKG_VER_FMT": unknown v3 checksum", + PKG_VER_PRINTF(pkg)); + ipkg->broken_files = 1; + ctx->missing_checksum = 1; + } } break; case -ENOTSUP: |