diff options
3 files changed, 44 insertions, 24 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch b/meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch index 809e54e9cb..3a6f8746cc 100644 --- a/meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch +++ b/meta/recipes-devtools/rpm/rpm/rpmdb-more-verbose-error-logging-in-rpmTempFile.patch | |||
| @@ -5,32 +5,10 @@ Upstream-Status: Inappropriate [debugging] | |||
| 5 | Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> | 5 | Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> |
| 6 | 6 | ||
| 7 | diff --git a/rpmdb/signature.c b/rpmdb/signature.c | 7 | diff --git a/rpmdb/signature.c b/rpmdb/signature.c |
| 8 | index dce6c4e..a1d0f06 100644 | 8 | index 100204b..e56ab3d 100644 |
| 9 | --- a/rpmdb/signature.c | 9 | --- a/rpmdb/signature.c |
| 10 | +++ b/rpmdb/signature.c | 10 | +++ b/rpmdb/signature.c |
| 11 | @@ -37,6 +37,7 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) | 11 | @@ -72,12 +72,16 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) |
| 12 | int temput; | ||
| 13 | FD_t fd = NULL; | ||
| 14 | unsigned int ran; | ||
| 15 | + int ret = 0; | ||
| 16 | |||
| 17 | if (!prefix) prefix = ""; | ||
| 18 | |||
| 19 | @@ -44,8 +45,11 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) | ||
| 20 | if (!_initialized) { | ||
| 21 | _initialized = 1; | ||
| 22 | tempfn = rpmGenPath(prefix, tpmacro, NULL); | ||
| 23 | - if (rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1)) | ||
| 24 | - goto errxit; | ||
| 25 | + ret = rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1); | ||
| 26 | + if (ret) { | ||
| 27 | + rpmlog(RPMLOG_ERR, _("error creating temporary directory %s: %d\n"), tempfn, ret); | ||
| 28 | + goto errxit; | ||
| 29 | + } | ||
| 30 | } | ||
| 31 | |||
| 32 | /* XXX should probably use mkstemp here */ | ||
| 33 | @@ -68,12 +72,16 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) | ||
| 34 | #endif | 12 | #endif |
| 35 | 13 | ||
| 36 | temput = urlPath(tempfn, &tfn); | 14 | temput = urlPath(tempfn, &tfn); |
diff --git a/meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch b/meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch new file mode 100644 index 0000000000..f483f3ad90 --- /dev/null +++ b/meta/recipes-devtools/rpm/rpm/rpmdb-prevent-race-in-tmpdir-creation.patch | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | rpmdb: prevent race in tmpdir creation | ||
| 2 | |||
| 3 | If two (or more) instances of rpm are running at the same time they may | ||
| 4 | be trying to create the same (base-)temporary directory at the same time | ||
| 5 | which causes the other mkdir to fail with EEXIST. This patch prevents a | ||
| 6 | failure caused by this race by ignoring EEXIST error on directory | ||
| 7 | creation. | ||
| 8 | |||
| 9 | Upstream-Status: Pending | ||
| 10 | |||
| 11 | Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> | ||
| 12 | |||
| 13 | diff --git a/rpmdb/signature.c b/rpmdb/signature.c | ||
| 14 | index dce6c4e..100204b 100644 | ||
| 15 | --- a/rpmdb/signature.c | ||
| 16 | +++ b/rpmdb/signature.c | ||
| 17 | @@ -37,6 +37,7 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) | ||
| 18 | int temput; | ||
| 19 | FD_t fd = NULL; | ||
| 20 | unsigned int ran; | ||
| 21 | + int ret = 0; | ||
| 22 | |||
| 23 | if (!prefix) prefix = ""; | ||
| 24 | |||
| 25 | @@ -44,8 +45,11 @@ int rpmTempFile(const char * prefix, const char ** fnptr, void * fdptr) | ||
| 26 | if (!_initialized) { | ||
| 27 | _initialized = 1; | ||
| 28 | tempfn = rpmGenPath(prefix, tpmacro, NULL); | ||
| 29 | - if (rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1)) | ||
| 30 | - goto errxit; | ||
| 31 | + ret = rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1); | ||
| 32 | + if (ret && ret != EEXIST) { | ||
| 33 | + rpmlog(RPMLOG_ERR, _("error creating temporary directory %s: %d\n"), tempfn, ret); | ||
| 34 | + goto errxit; | ||
| 35 | + } | ||
| 36 | } | ||
| 37 | |||
| 38 | /* XXX should probably use mkstemp here */ | ||
| 39 | -- | ||
| 40 | 2.6.6 | ||
| 41 | |||
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.16.bb b/meta/recipes-devtools/rpm/rpm_5.4.16.bb index dd6e103b22..1332397120 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.16.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.16.bb | |||
| @@ -154,6 +154,7 @@ SRC_URI += " \ | |||
| 154 | file://rpm-rpmdb-grammar.patch \ | 154 | file://rpm-rpmdb-grammar.patch \ |
| 155 | file://rpm-disable-blaketest.patch \ | 155 | file://rpm-disable-blaketest.patch \ |
| 156 | file://rpm-autogen-force.patch \ | 156 | file://rpm-autogen-force.patch \ |
| 157 | file://rpmdb-prevent-race-in-tmpdir-creation.patch \ | ||
| 157 | file://rpmdb-more-verbose-error-logging-in-rpmTempFile.patch \ | 158 | file://rpmdb-more-verbose-error-logging-in-rpmTempFile.patch \ |
| 158 | " | 159 | " |
| 159 | 160 | ||
