rpm5 & ts.hdrFromFdno from .hdr file

Elan Ruusamäe glen at pld-linux.org
Mon May 20 21:50:39 CEST 2013


On 05/20/2013 10:24 PM, Jeffrey Johnson wrote:
> Try to pin down the exact return code in yum/anaconda that is failing.
> One way to do this is to turn on RPMIO debugging, another way is
from code debug, it hits line 770, which sets whole return value to None

rpm-5.4.10/python $ PYTHONPATH=. python -c "import sys, rpm; print 
rpm.readHeaderListFromFile(sys.argv[1])" blockdev-2.22.2-4.i686.hdr

add h:0x1047560
notfound set to none
end while
LIST IT ALL: 0x7f6329d76080
LIST: 0x7f6329d76080, ''
None



  730 /**
  731  */
  732 PyObject * rpmReadHeaders (FD_t fd)
  733 {
  734     PyObject * list;
  735     Header h;
  736     hdrObject * hdr;
  737
  738     if (!fd) {
  739         PyErr_SetFromErrno(pyrpmError);
  740         return NULL;
  741     }
  742
  743     list = PyList_New(0);
  744     if (!list) {
  745         return NULL;
  746     }
  747
  748     ...
  749
  750     while (h) {
  751     printf("add h:%p\n", h);
  752         hdr = hdr_Wrap(h);
  753         if (PyList_Append(list, (PyObject *) hdr)) {
  754             Py_XDECREF(list);
  755             Py_XDECREF(hdr);
  756             return NULL;
  757         }
  758         Py_XDECREF(hdr);
  759
  760         (void)headerFree(h);    /* XXX ref held by hdr */
  761         h = NULL;
  762
  763         Py_BEGIN_ALLOW_THREADS
  764         {   const char item[] = "Header";
  765             const char * msg = NULL;
  766             rpmRC rc = rpmpkgRead(item, fd, &h, &msg);
  767             if(rc == RPMRC_NOTFOUND) {
  768                     Py_INCREF(Py_None);
  769     printf("notfound set to none\n");
  770                     list = Py_None;
  771             }
  772             else if (rc != RPMRC_OK)
  773                 rpmlog(RPMLOG_ERR, "%s: %s: %s : error code: 
%d\n", "rpmpkgRead", item, msg, rc);
  774             msg = _free(msg);
  775         }
  776         Py_END_ALLOW_THREADS
  777     printf("end while\n");
  778     }
  779
  780     printf("LIST IT ALL: %p\n", list);
  781     return list;
  782 }

-- 
glen



More information about the pld-devel-en mailing list