summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm/files/0001-rpmfc.c-do-not-run-file-classification-in-parallel.patch
blob: d8d338792d34a41080615a6e3ee1749e3ee9285f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 */