- file: *really* read elf64 notes correctly.
authorjbj <devnull@localhost>
Sun, 12 Jan 2003 21:23:49 +0000 (21:23 +0000)
committerjbj <devnull@localhost>
Sun, 12 Jan 2003 21:23:49 +0000 (21:23 +0000)
- python: restore thread context on errorCB (#80744).

CVS patchset: 6007
CVS date: 2003/01/12 21:23:49

CHANGES
file/readelf.c
python/rpmmodule.c
rpm.spec.in

diff --git a/CHANGES b/CHANGES
index 7104724..c4c277b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
        - 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.
index 9dd688d..b5abf84 100644 (file)
@@ -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@*/
                        }
index d1de979..2ac4aba 100644 (file)
@@ -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);
index 9dffd25..6d79071 100644 (file)
@@ -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 <jbj@redhat.com> 4.2-0.55
 - fix: obscure corner case(s) with rpmvercmp (#50977).