Blame 0001-Only-permit-one-thread-at-a-time-in-addFileToTag.patch
|
Igor Gnatenko |
7b8121 |
From 526641ceeca12fbaa878401f8e65d17f240a9ae5 Mon Sep 17 00:00:00 2001
|
|
Igor Gnatenko |
7b8121 |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Igor Gnatenko |
7b8121 |
Date: Tue, 11 Jun 2019 10:50:01 +0300
|
|
Igor Gnatenko |
7b8121 |
Subject: [PATCH] Only permit one thread at a time in addFileToTag()
|
|
Igor Gnatenko |
7b8121 |
|
|
Igor Gnatenko |
7b8121 |
When creating packages in parallel, more than one thread can call
|
|
Igor Gnatenko |
7b8121 |
this at once. As it's modifying global macro state to update file
|
|
Igor Gnatenko |
7b8121 |
name and line number, things will get garbled if we permit more than
|
|
Igor Gnatenko |
7b8121 |
one thread.
|
|
Igor Gnatenko |
7b8121 |
|
|
Igor Gnatenko |
7b8121 |
While this is necessary for the above reason, and should fix #742,
|
|
Igor Gnatenko |
7b8121 |
it shouldn't crash even without this so there's probably something
|
|
Igor Gnatenko |
7b8121 |
else wrong too.
|
|
Igor Gnatenko |
7b8121 |
|
|
Igor Gnatenko |
7b8121 |
Closes: #742
|
|
Igor Gnatenko |
7b8121 |
---
|
|
Igor Gnatenko |
7b8121 |
build/pack.c | 3 +++
|
|
Igor Gnatenko |
7b8121 |
1 file changed, 3 insertions(+)
|
|
Igor Gnatenko |
7b8121 |
|
|
Igor Gnatenko |
7b8121 |
diff --git a/build/pack.c b/build/pack.c
|
|
Igor Gnatenko |
7b8121 |
index 447e3ec94..ab72750be 100644
|
|
Igor Gnatenko |
7b8121 |
--- a/build/pack.c
|
|
Igor Gnatenko |
7b8121 |
+++ b/build/pack.c
|
|
Igor Gnatenko |
7b8121 |
@@ -113,6 +113,8 @@ static rpmRC addFileToTag(rpmSpec spec, const char * file,
|
|
Igor Gnatenko |
7b8121 |
if (file == NULL)
|
|
Igor Gnatenko |
7b8121 |
return RPMRC_OK;
|
|
Igor Gnatenko |
7b8121 |
|
|
Igor Gnatenko |
7b8121 |
+ #pragma omp critical
|
|
Igor Gnatenko |
7b8121 |
+ {
|
|
Igor Gnatenko |
7b8121 |
fn = rpmGetPath("%{_builddir}/%{?buildsubdir:%{buildsubdir}/}", file, NULL);
|
|
Igor Gnatenko |
7b8121 |
|
|
Igor Gnatenko |
7b8121 |
f = fopen(fn, "r");
|
|
Igor Gnatenko |
7b8121 |
@@ -151,6 +153,7 @@ exit:
|
|
Igor Gnatenko |
7b8121 |
}
|
|
Igor Gnatenko |
7b8121 |
free(fn);
|
|
Igor Gnatenko |
7b8121 |
freeStringBuf(sb);
|
|
Igor Gnatenko |
7b8121 |
+ } /* omp critical */
|
|
Igor Gnatenko |
7b8121 |
|
|
Igor Gnatenko |
7b8121 |
return rc;
|
|
Igor Gnatenko |
7b8121 |
}
|
|
Igor Gnatenko |
7b8121 |
--
|
|
Igor Gnatenko |
7b8121 |
2.22.0
|
|
Igor Gnatenko |
7b8121 |
|