blob: d8d338792d34a41080615a6e3ee1749e3ee9285f [file] [log] [blame]
From 93c3c7f043f62e96941274e957c4ad9432032af1 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Mon, 18 Nov 2019 16:22:56 +0100
Subject: [PATCH] rpmfc.c: do not run file classification in parallel
This is causing freezes with libmagic when the file in question is compressed:
https://github.com/rpm-software-management/rpm/issues/756
Upstream-Status: Inappropriate [upstream wants a proper fix]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
build/rpmfc.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 3db7a9352..17afdd57a 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -680,7 +680,6 @@ static void rpmfcAttributes(rpmfc fc, int ix, const char *ftype, const char *ful
/* Add attributes on libmagic type & path pattern matches */
if (matches(&(*attr)->incl, ftype, path, is_executable)) {
argvAddTokens(&fc->fattrs[ix], (*attr)->name);
- #pragma omp critical(fahash)
fattrHashAddEntry(fc->fahash, attr-fc->atypes, ix);
}
}
@@ -1105,7 +1104,6 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
/* Build (sorted) file class dictionary. */
fc->cdict = rpmstrPoolCreate();
- #pragma omp parallel
{
/* libmagic is not thread-safe, each thread needs to a private handle */
magic_t ms = magic_open(msflags);
@@ -1113,15 +1111,12 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
if (ms == NULL) {
rpmlog(RPMLOG_ERR, _("magic_open(0x%x) failed: %s\n"),
msflags, strerror(errno));
- #pragma omp cancel parallel
}
if (magic_load(ms, NULL) == -1) {
rpmlog(RPMLOG_ERR, _("magic_load failed: %s\n"), magic_error(ms));
- #pragma omp cancel parallel
}
- #pragma omp for ordered reduction(+:nerrors)
for (int ix = 0; ix < fc->nfiles; ix++) {
rpmsid ftypeId;
const char * ftype;
@@ -1185,14 +1180,11 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
fc->fcolor[ix] = fcolor;
/* Add to file class dictionary and index array */
- #pragma omp ordered
if (fcolor != RPMFC_WHITE && (fcolor & RPMFC_INCLUDE)) {
ftypeId = rpmstrPoolId(fc->cdict, ftype, 1);
- #pragma omp atomic
fc->fknown++;
} else {
ftypeId = rpmstrPoolId(fc->cdict, "", 1);
- #pragma omp atomic
fc->fwhite++;
}
/* Pool id's start from 1, for headers we want it from 0 */