From d23480d85dea973d9a03b6e2d51b71410dbd7b0c Mon Sep 17 00:00:00 2001 From: jbj Date: Sun, 12 Jan 2003 21:23:49 +0000 Subject: [PATCH] - file: *really* read elf64 notes correctly. - python: restore thread context on errorCB (#80744). CVS patchset: 6007 CVS date: 2003/01/12 21:23:49 --- CHANGES | 2 ++ file/readelf.c | 11 +++-------- python/rpmmodule.c | 7 +++++++ rpm.spec.in | 6 +++++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 7104724ee..c4c277b5c 100644 --- a/CHANGES +++ b/CHANGES @@ -106,6 +106,8 @@ - add brp-strip-static-archive build root policy helper. - add -lelf to rpm LDFLAGS, not LDADD, since there is no libelf.la now. - fix: obscure corner case(s) with rpmvercmp (#50977). + - file: *really* read elf64 notes correctly. + - python: restore thread context on errorCB (#80744). 4.0.4 -> 4.1: - loosely wire beecrypt library into rpm. diff --git a/file/readelf.c b/file/readelf.c index 9dd688d4e..b5abf84fa 100644 --- a/file/readelf.c +++ b/file/readelf.c @@ -93,8 +93,8 @@ getu64(const fmagic fm, uint64_t value) ? getu32(fm, ph32.p_offset) \ : getu64(fm, ph64.p_offset)) #define ph_align (fm->cls == ELFCLASS32 \ - ? getu32(fm, ph32.p_align) \ - : getu64(fm, ph64.p_align)) + ? (ph32.p_align ? getu32(fm, ph32.p_align) : 4) \ + : (ph64.p_align ? getu64(fm, ph64.p_align) : 4)) #define nh_size (fm->cls == ELFCLASS32 \ ? sizeof *nh32 \ : sizeof *nh64) @@ -156,7 +156,6 @@ dophn_exec(fmagic fm, off_t off, int num, size_t size) char nbuf[BUFSIZ]; int bufsize; size_t offset, nameoffset; - off_t savedoffset; if (lseek(fm->fd, off, SEEK_SET) == -1) { error(EXIT_FAILURE, 0, "lseek failed (%s).\n", strerror(errno)); @@ -168,10 +167,6 @@ dophn_exec(fmagic fm, off_t off, int num, size_t size) error(EXIT_FAILURE, 0, "read failed (%s).\n", strerror(errno)); /*@notreached@*/ } - if ((savedoffset = lseek(fm->fd, 0, SEEK_CUR)) == -1) { - error(EXIT_FAILURE, 0, "lseek failed (%s).\n", strerror(errno)); - /*@notreached@*/ - } switch (ph_type) { case PT_DYNAMIC: @@ -297,7 +292,7 @@ dophn_exec(fmagic fm, off_t off, int num, size_t size) /* Content of note is always 0 */ } } - if ((lseek(fm->fd, savedoffset + offset, SEEK_SET)) == -1) { + if ((lseek(fm->fd, ph_offset + offset, SEEK_SET)) == -1) { error(EXIT_FAILURE, 0, "lseek failed (%s).\n", strerror(errno)); /*@notreached@*/ } diff --git a/python/rpmmodule.c b/python/rpmmodule.c index d1de9790c..2ac4aba8b 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -186,6 +186,7 @@ static PyObject * findUpgradeSet(PyObject * self, PyObject * args) */ static PyObject * errorCB = NULL; static PyObject * errorData = NULL; +static PyThreadState * errorThread = NULL; /** */ @@ -193,6 +194,8 @@ static void errorcb (void) { PyObject * result, * args = NULL; + PyEval_RestoreThread(errorThread); + if (errorData) args = Py_BuildValue("(O)", errorData); @@ -203,6 +206,9 @@ static void errorcb (void) PyErr_Print(); PyErr_Clear(); } + + errorThread = PyEval_SaveThread(); + Py_DECREF (result); } @@ -240,6 +246,7 @@ static PyObject * errorSetCallback (PyObject * self, PyObject * args) errorCB = newCB; errorData = newData; + errorThread = PyEval_SaveThread(); Py_INCREF (errorCB); Py_XINCREF (errorData); diff --git a/rpm.spec.in b/rpm.spec.in index 9dffd25ab..6d790715b 100644 --- a/rpm.spec.in +++ b/rpm.spec.in @@ -20,7 +20,7 @@ Name: rpm %define version @VERSION@ Version: %{version} %{expand: %%define rpm_version %{version}} -Release: 0.55 +Release: 0.56 Group: System Environment/Base Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz Copyright: GPL @@ -464,6 +464,10 @@ exit 0 %{__includedir}/popt.h %changelog +* Sun Jan 12 16:17:17 EST 2003 +- file: *really* read elf64 notes correctly. +- python: restore thread context on errorCB (#80744). + * Fri Jan 10 2003 Jeff Johnson 4.2-0.55 - fix: obscure corner case(s) with rpmvercmp (#50977).