diff --git a/fileattrs.diff b/fileattrs.diff index a122d87..35f2335 100644 --- a/fileattrs.diff +++ b/fileattrs.diff @@ -37,9 +37,9 @@ Index: fileattrs/ksyms.attr --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ fileattrs/ksyms.attr 2011-12-15 13:47:26.787456907 +0100 @@ -0,0 +1,4 @@ -+%__ksyms_provides %{__set_helper_env}%{_rpmconfigdir}/find-provides.ksyms %name -+%__ksyms_requires %{__set_helper_env}%{_rpmconfigdir}/find-requires.ksyms %name -+%__ksyms_supplements %{__set_helper_env}%{_rpmconfigdir}/find-supplements.ksyms %name ++%__ksyms_provides %{_rpmconfigdir}/find-provides.ksyms %name ++%__ksyms_requires %{_rpmconfigdir}/find-requires.ksyms %name ++%__ksyms_supplements %{_rpmconfigdir}/find-supplements.ksyms %name +%__ksyms_path (/lib/modules/.*\.ko(\.gz)?)|(/boot/vmlinu[xz].*)$ Index: fileattrs/Makefile.am =================================================================== diff --git a/headerchk2.diff b/headerchk2.diff new file mode 100644 index 0000000..bc495ec --- /dev/null +++ b/headerchk2.diff @@ -0,0 +1,147 @@ +--- lib/header.c.orig 2012-04-17 16:16:29.000000000 +0000 ++++ lib/header.c 2012-04-17 16:53:32.000000000 +0000 +@@ -197,7 +197,7 @@ int headerVerifyInfo(int il, int dl, con + return i; + if (hdrchkAlign(info->type, info->offset)) + return i; +- if (!negate && hdrchkRange(dl, info->offset)) ++ if (hdrchkRange(dl, info->offset)) + return i; + if (hdrchkData(info->count)) + return i; +@@ -837,10 +837,13 @@ Header headerLoad(void * uh) + + entry->info.type = htonl(pe->type); + entry->info.count = htonl(pe->count); ++ entry->info.tag = htonl(pe->tag); + +- if (hdrchkType(entry->info.type)) ++ if (!ENTRY_IS_REGION(entry)) + goto errxit; +- if (hdrchkTags(entry->info.count)) ++ if (entry->info.type != REGION_TAG_TYPE) ++ goto errxit; ++ if (entry->info.count != REGION_TAG_COUNT) + goto errxit; + + { int off = ntohl(pe->offset); +@@ -856,7 +859,6 @@ Header headerLoad(void * uh) + ril = rdl/sizeof(*pe); + if (hdrchkTags(ril) || hdrchkData(rdl)) + goto errxit; +- entry->info.tag = htonl(pe->tag); + } else { + ril = il; + rdl = (ril * sizeof(struct entryInfo_s)); +@@ -876,13 +878,12 @@ Header headerLoad(void * uh) + indexEntry newEntry = entry + ril; + int ne = (h->indexUsed - ril); + int rid = entry->info.offset+1; +- int rc; + + /* Load dribble entries from region. */ +- rc = regionSwab(newEntry, ne, 0, pe+ril, dataStart, dataEnd, rid); +- if (rc < 0) ++ rdlen = regionSwab(newEntry, ne, rdlen, pe+ril, ++ dataStart, dataEnd, rid); ++ if (rdlen < 0) + goto errxit; +- rdlen += rc; + + { indexEntry firstEntry = newEntry; + int save = h->indexUsed; +@@ -905,7 +906,7 @@ Header headerLoad(void * uh) + } + } + rdlen += REGION_TAG_COUNT; +- /* XXX should be equality test, but dribbles are sometimes a bit off? */ ++ /* should be equality test, but can be off if entries are not perfectly aligned */ + if (rdlen > dl) + goto errxit; + } +--- lib/package.c.orig 2012-04-17 16:26:00.000000000 +0000 ++++ lib/package.c 2012-04-17 16:26:05.000000000 +0000 +@@ -241,16 +241,23 @@ static rpmRC headerVerify(rpmKeyring key + } + + /* Is there an immutable header region tag? */ +- if (!(entry.info.tag == RPMTAG_HEADERIMMUTABLE +- && entry.info.type == RPM_BIN_TYPE +- && entry.info.count == REGION_TAG_COUNT)) +- { ++ if (!(entry.info.tag == RPMTAG_HEADERIMMUTABLE)) { + rc = RPMRC_NOTFOUND; + goto exit; + } + +- /* Is the offset within the data area? */ +- if (entry.info.offset >= dl) { ++ /* Is the region tag sane? */ ++ if (!(entry.info.type == REGION_TAG_TYPE && ++ entry.info.count == REGION_TAG_COUNT)) { ++ rasprintf(&buf, ++ _("region tag: BAD, tag %d type %d offset %d count %d\n"), ++ entry.info.tag, entry.info.type, ++ entry.info.offset, entry.info.count); ++ goto exit; ++ } ++ ++ /* Is the trailer within the data area? */ ++ if (entry.info.offset + REGION_TAG_COUNT > dl) { + rasprintf(&buf, + _("region offset: BAD, tag %d type %d offset %d count %d\n"), + entry.info.tag, entry.info.type, +@@ -263,10 +270,10 @@ static rpmRC headerVerify(rpmKeyring key + (void) memcpy(&info, regionEnd, REGION_TAG_COUNT); + regionEnd += REGION_TAG_COUNT; + +- xx = headerVerifyInfo(1, dl, &info, &entry.info, 1); ++ xx = headerVerifyInfo(1, il * sizeof(*pe), &info, &entry.info, 1); + if (xx != -1 || + !(entry.info.tag == RPMTAG_HEADERIMMUTABLE +- && entry.info.type == RPM_BIN_TYPE ++ && entry.info.type == REGION_TAG_TYPE + && entry.info.count == REGION_TAG_COUNT)) + { + rasprintf(&buf, +--- lib/signature.c.orig 2012-04-17 16:25:52.000000000 +0000 ++++ lib/signature.c 2012-04-17 16:26:05.000000000 +0000 +@@ -133,12 +133,19 @@ rpmRC rpmReadSignature(FD_t fd, Header * + } + + /* Is there an immutable header region tag? */ +- if (entry.info.tag == RPMTAG_HEADERSIGNATURES +- && entry.info.type == RPM_BIN_TYPE +- && entry.info.count == REGION_TAG_COUNT) +- { +- +- if (entry.info.offset >= dl) { ++ if (entry.info.tag == RPMTAG_HEADERSIGNATURES) { ++ /* Is the region tag sane? */ ++ if (!(entry.info.type == REGION_TAG_TYPE && ++ entry.info.count == REGION_TAG_COUNT)) { ++ rasprintf(&buf, ++ _("region tag: BAD, tag %d type %d offset %d count %d\n"), ++ entry.info.tag, entry.info.type, ++ entry.info.offset, entry.info.count); ++ goto exit; ++ } ++ ++ /* Is the trailer within the data area? */ ++ if (entry.info.offset + REGION_TAG_COUNT > dl) { + rasprintf(&buf, + _("region offset: BAD, tag %d type %d offset %d count %d\n"), + entry.info.tag, entry.info.type, +@@ -157,10 +164,10 @@ rpmRC rpmReadSignature(FD_t fd, Header * + } + dataEnd += REGION_TAG_COUNT; + +- xx = headerVerifyInfo(1, dl, &info, &entry.info, 1); ++ xx = headerVerifyInfo(1, il * sizeof(*pe), &info, &entry.info, 1); + if (xx != -1 || + !((entry.info.tag == RPMTAG_HEADERSIGNATURES || entry.info.tag == RPMTAG_HEADERIMAGE) +- && entry.info.type == RPM_BIN_TYPE ++ && entry.info.type == REGION_TAG_TYPE + && entry.info.count == REGION_TAG_COUNT)) + { + rasprintf(&buf, diff --git a/helperenv.diff b/helperenv.diff new file mode 100644 index 0000000..229b756 --- /dev/null +++ b/helperenv.diff @@ -0,0 +1,11 @@ +--- macros.in.orig 2012-04-18 13:48:07.000000000 +0000 ++++ macros.in 2012-04-18 13:47:41.000000000 +0000 +@@ -515,7 +515,7 @@ posix.setenv("RPMBUILD_SOURCEDIR",rpm.ex + # %__myattr_exclude_magic exclude by magic regex + # %__myattr_exclude_path exclude by path regex + # +-%_fileattrsdir %{_rpmconfigdir}/fileattrs ++%_fileattrsdir %{__set_helper_env}%{_rpmconfigdir}/fileattrs + + #============================================================================== + # ---- Database configuration macros. diff --git a/instobscheck.diff b/instobscheck.diff new file mode 100644 index 0000000..d8cb9a0 --- /dev/null +++ b/instobscheck.diff @@ -0,0 +1,39 @@ +--- lib/depends.c.orig 2012-04-18 14:46:10.000000000 +0000 ++++ lib/depends.c 2012-04-18 14:46:15.000000000 +0000 +@@ -355,6 +355,7 @@ static int rpmdbProvides(rpmts ts, depCa + rpmdbMatchIterator mi = NULL; + Header h = NULL; + int rc = 0; ++ int matchnvr = rpmdsTagN(dep) == RPMTAG_OBSOLETENAME; + + /* See if we already looked this up */ + if (depCacheGetEntry(dcache, DNEVR, &cachedrc, NULL, NULL)) { +@@ -368,7 +369,7 @@ static int rpmdbProvides(rpmts ts, depCa + * taking file state into account: replaced, wrong colored and + * not installed files can not satisfy a dependency. + */ +- if (Name[0] == '/') { ++ if (Name[0] == '/' && !matchnvr) { + mi = rpmtsPrunedIterator(ts, RPMDBI_BASENAMES, Name); + while ((h = rpmdbNextIterator(mi)) != NULL) { + int fs = RPMFILE_STATE_MISSING; +@@ -390,9 +391,16 @@ static int rpmdbProvides(rpmts ts, depCa + if (h == NULL) { + mi = rpmtsPrunedIterator(ts, RPMDBI_PROVIDENAME, Name); + while ((h = rpmdbNextIterator(mi)) != NULL) { +- if (rpmdsAnyMatchesDep(h, dep, _rpmds_nopromote)) { +- rpmdsNotify(dep, "(db provides)", rc); +- break; ++ if (matchnvr) { ++ if (rpmdsNVRMatchesDep(h, dep , _rpmds_nopromote)) { ++ rpmdsNotify(dep, "(db provides)", rc); ++ break; ++ } ++ } else { ++ if (rpmdsAnyMatchesDep(h, dep, _rpmds_nopromote)) { ++ rpmdsNotify(dep, "(db provides)", rc); ++ break; ++ } + } + } + rpmdbFreeIterator(mi); diff --git a/platformin.diff b/platformin.diff index 6c072ac..a011649 100644 --- a/platformin.diff +++ b/platformin.diff @@ -29,9 +29,9 @@ Index: platform.in +@SuSE@#--------------------------------------------------------------------- +@SuSE@# Expanded at end of %prep +@SuSE@# -+@SuSE@%__id_u @__ID_U@ -+@SuSE@%__chown_Rhf @__CHOWN_RHF@ -+@SuSE@%__chgrp_Rhf @__CHGRP_RHF@ ++@SuSE@%__id_u %{__id} -u ++@SuSE@%__chown_Rhf %{__chown} -Rhf ++@SuSE@%__chgrp_Rhf %{__chgrp} -Rhf +@SuSE@%_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root +@SuSE@%_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} root +@SuSE@%_fixperms %{__chmod} -Rf @FIXPERMS@ diff --git a/python-capsule-api.diff b/python-capsule-api.diff new file mode 100644 index 0000000..dd568d3 --- /dev/null +++ b/python-capsule-api.diff @@ -0,0 +1,43 @@ +--- python/header-py.c.orig 2012-04-23 09:13:33.000000000 +0000 ++++ python/header-py.c 2012-04-23 09:14:25.000000000 +0000 +@@ -368,8 +368,8 @@ static PyObject *hdr_new(PyTypeObject *s + + if (obj == NULL) { + h = headerNew(); +- } else if (PyCObject_Check(obj)) { +- h = PyCObject_AsVoidPtr(obj); ++ } else if (CAPSULE_CHECK(obj)) { ++ h = CAPSULE_EXTRACT(obj, "rpm._C_Header"); + } else if (hdrObject_Check(obj)) { + h = headerCopy(((hdrObject*) obj)->h); + } else if (PyBytes_Check(obj)) { +--- python/rpmsystem-py.h.orig 2012-04-23 09:12:49.000000000 +0000 ++++ python/rpmsystem-py.h 2012-04-23 09:13:19.000000000 +0000 +@@ -33,6 +33,16 @@ typedef Py_ssize_t (*lenfunc)(PyObject * + #define PyBytes_AsString PyString_AsString + #endif + ++#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) >= 0x0207 ++#define CAPSULE_BUILD(ptr,name) PyCapsule_New(ptr, name, NULL) ++#define CAPSULE_CHECK(obj) PyCapsule_CheckExact(obj) ++#define CAPSULE_EXTRACT(obj,name) PyCapsule_GetPointer(obj, name) ++#else ++#define CAPSULE_BUILD(ptr,name) PyCObject_FromVoidPtr(ptr, NULL) ++#define CAPSULE_CHECK(obj) PyCObject_Check(obj) ++#define CAPSULE_EXTRACT(obj,name) PyCObject_AsVoidPtr(obj) ++#endif ++ + /* For Python 3, use the PyLong type throughout in place of PyInt */ + #if PY_MAJOR_VERSION >= 3 + #define PyInt_Check PyLong_Check +--- python/spec-py.c.orig 2012-04-23 09:13:41.000000000 +0000 ++++ python/spec-py.c 2012-04-23 09:14:56.000000000 +0000 +@@ -34,7 +34,7 @@ static PyObject *makeHeader(Header h) + PyObject *rpmmod = PyImport_ImportModuleNoBlock("rpm"); + if (rpmmod == NULL) return NULL; + +- PyObject *ptr = PyCObject_FromVoidPtr(h, NULL); ++ PyObject *ptr = CAPSULE_BUILD(h, "rpm._C_Header"); + PyObject *hdr = PyObject_CallMethod(rpmmod, "hdr", "(O)", ptr); + Py_XDECREF(ptr); + Py_XDECREF(rpmmod); diff --git a/pythonhardlink.diff b/pythonhardlink.diff new file mode 100644 index 0000000..3fcc8d4 --- /dev/null +++ b/pythonhardlink.diff @@ -0,0 +1,13 @@ +--- scripts/brp-python-hardlink.orig 2012-04-18 13:33:39.000000000 +0000 ++++ scripts/brp-python-hardlink 2012-04-18 13:34:52.000000000 +0000 +@@ -10,8 +10,8 @@ fi + find "$RPM_BUILD_ROOT" -type f -name "*.pyc" | while read pyc ; do + pyo="${pyc%c}o" + if [ -f "$pyo" ] ; then +- csha="$(sha1sum -b $pyc | cut -d' ' -f 1)" && \ +- osha="$(sha1sum -b $pyo | cut -d' ' -f 1)" && \ ++ csha="$(sha1sum -b "$pyc" | cut -d' ' -f 1)" && \ ++ osha="$(sha1sum -b "$pyo" | cut -d' ' -f 1)" && \ + if [ "$csha" = "$osha" ] ; then + ln -f "$pyc" "$pyo" + fi diff --git a/rpm-python.changes b/rpm-python.changes index 14132e7..206e887 100644 --- a/rpm-python.changes +++ b/rpm-python.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Apr 23 11:16:26 CEST 2012 - mls@suse.de + +- modified capsule api diff to match rpm upstream + +------------------------------------------------------------------- +Wed Apr 11 16:54:02 UTC 2012 - klaussfreire@gmail.com + +- Fix usage of deprecated AsVoidPtr Python/C API, + replaced by Capsule API + ------------------------------------------------------------------- Tue Jan 17 10:28:42 UTC 2012 - saschpe@suse.de diff --git a/rpm.changes b/rpm.changes index f75d8c8..8f1059e 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Fri Apr 20 14:40:50 CEST 2012 - mls@suse.de + +- fix some more crashes on malformed header data + [bnc#754281] [bnc#754284] [bnc#754285] +- fix quoting in brp-python-hardlink [bnc#756087] +- change env handling for supplements [bnc#741543] +- fix _fix macros [bnc#728682] +- fix obsoletes handling of installed packages [bnc#714724] +- implement tilde support in version comparison [bnc#466994] + ------------------------------------------------------------------- Mon Mar 26 07:37:10 UTC 2012 - vuntz@opensuse.org diff --git a/rpm.spec b/rpm.spec index 28055ac..b97f8ed 100644 --- a/rpm.spec +++ b/rpm.spec @@ -138,6 +138,12 @@ Patch82: perl-python-attr.patch Patch83: findlang-new-help-fix.diff Patch84: langnoc.diff Patch85: rpm-gcc47.patch +Patch86: headerchk2.diff +Patch87: pythonhardlink.diff +Patch88: helperenv.diff +Patch89: instobscheck.diff +Patch90: tilde.diff +Patch91: python-capsule-api.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # # avoid bootstrapping problem @@ -154,7 +160,6 @@ all installed packages. RPM also supports database queries. %package devel Summary: Include Files and Libraries mandatory for Development -Group: System/Packages Requires: rpm = %{version} # for people confusing the one with the other Recommends: rpm-build = %{version} @@ -169,7 +174,6 @@ need an intimate knowledge of RPM packages in order to function. %package build Summary: Tools and Scripts to create rpm packages -Group: System/Packages Requires: rpm = %{version} Provides: rpm:%_bindir/rpmbuild Provides: rpmbuild @@ -211,7 +215,8 @@ rm -f rpmdb/db.h %patch -P 50 -P 51 -P 52 -P 53 -P 54 -P 55 -P 56 -P 57 -P 58 -P 59 %patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66 -P 67 -P 68 -P 69 %patch -P 70 -P 71 -P 72 -P 73 -P 74 -P 75 -P 76 -P 77 -P 78 -P 79 -%patch -P 80 -P 81 -P 82 -P 83 -P 84 -P 85 +%patch -P 80 -P 81 -P 82 -P 83 -P 84 -P 85 -P 86 -P 87 -P 88 -P 89 +%patch -P 90 -P 91 #chmod 755 scripts/find-supplements{,.ksyms} #chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms #chmod 755 scripts/firmware.prov diff --git a/tilde.diff b/tilde.diff new file mode 100644 index 0000000..771eca7 --- /dev/null +++ b/tilde.diff @@ -0,0 +1,116 @@ +--- ./build/pack.c.orig 2012-04-20 13:43:49.000000000 +0000 ++++ ./build/pack.c 2012-04-20 14:23:57.000000000 +0000 +@@ -308,6 +308,44 @@ static rpmRC processScriptFiles(rpmSpec + return RPMRC_OK; + } + ++/** ++ */ ++static int depContainsTilde(Header h, rpmTagVal tagEVR) ++{ ++ struct rpmtd_s evrs; ++ const char *evr = NULL; ++ ++ if (headerGet(h, tagEVR, &evrs, HEADERGET_MINMEM)) { ++ while ((evr = rpmtdNextString(&evrs)) != NULL) ++ if (strchr(evr, '~')) ++ break; ++ rpmtdFreeData(&evrs); ++ } ++ return evr != NULL; ++} ++ ++static rpmTagVal depevrtags[] = { ++ RPMTAG_PROVIDEVERSION, ++ RPMTAG_REQUIREVERSION, ++ RPMTAG_OBSOLETEVERSION, ++ RPMTAG_CONFLICTVERSION, ++ RPMTAG_ORDERVERSION, ++ RPMTAG_TRIGGERVERSION, ++ RPMTAG_SUGGESTSVERSION, ++ RPMTAG_ENHANCESVERSION, ++ 0 ++}; ++ ++static int haveTildeDep(Header h) ++{ ++ int i; ++ ++ for (i = 0; depevrtags[i] != 0; i++) ++ if (depContainsTilde(h, depevrtags[i])) ++ return 1; ++ return 0; ++} ++ + static rpmRC writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName, + CSA_t csa, char **cookie) + { +@@ -382,6 +420,10 @@ static rpmRC writeRPM(Header *hdrp, unsi + free(buf); + } + ++ /* check if the package has a dependency with a '~' */ ++ if (haveTildeDep(h)) ++ (void) rpmlibNeedsFeature(h, "TildeInVersions", "4.10.0-1"); ++ + /* Create and add the cookie */ + if (cookie) { + rasprintf(cookie, "%s %d", buildHost(), (int) (*getBuildTime())); +--- ./build/parsePreamble.c.orig 2012-04-20 14:29:26.000000000 +0000 ++++ ./build/parsePreamble.c 2012-04-20 14:30:18.000000000 +0000 +@@ -671,7 +671,7 @@ static int handlePreambleTag(rpmSpec spe + case RPMTAG_VERSION: + case RPMTAG_RELEASE: + SINGLE_TOKEN_ONLY; +- if (rpmCharCheck(spec, field, strlen(field), "._+%{}") != RPMRC_OK) return RPMRC_FAIL; ++ if (rpmCharCheck(spec, field, strlen(field), "._+%{}~") != RPMRC_OK) return RPMRC_FAIL; + headerPutString(pkg->header, tag, field); + break; + case RPMTAG_URL: +--- ./build/parseReqs.c.orig 2012-04-20 14:29:22.000000000 +0000 ++++ ./build/parseReqs.c 2012-04-20 14:29:57.000000000 +0000 +@@ -170,7 +170,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package p + } + EVR = xmalloc((ve-v) + 1); + rstrlcpy(EVR, v, (ve-v) + 1); +- if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}")) goto exit; ++ if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}~")) goto exit; + re = ve; /* ==> next token after EVR string starts here */ + } else + EVR = NULL; +--- ./lib/rpmds.c.orig 2012-04-20 13:44:06.000000000 +0000 ++++ ./lib/rpmds.c 2012-04-20 13:44:12.000000000 +0000 +@@ -913,6 +913,9 @@ static const struct rpmlibProvides_s rpm + { "rpmlib(ScriptletExpansion)", "4.9.0-1", + ( RPMSENSE_EQUAL), + N_("package scriptlets can be expanded at install time.") }, ++ { "rpmlib(TildeInVersions)", "4.10.0-1", ++ ( RPMSENSE_EQUAL), ++ N_("dependency comparison supports versions with tilde.") }, + { NULL, NULL, 0, NULL } + }; + +--- ./lib/rpmvercmp.c.orig 2012-04-20 13:44:06.000000000 +0000 ++++ ./lib/rpmvercmp.c 2012-04-20 13:44:12.000000000 +0000 +@@ -32,9 +32,18 @@ int rpmvercmp(const char * a, const char + two = str2; + + /* loop through each version segment of str1 and str2 and compare them */ +- while (*one && *two) { +- while (*one && !risalnum(*one)) one++; +- while (*two && !risalnum(*two)) two++; ++ while (*one || *two) { ++ while (*one && !risalnum(*one) && *one != '~') one++; ++ while (*two && !risalnum(*two) && *two != '~') two++; ++ ++ /* handle the tilde separator, it sorts before everthing else */ ++ if (*one == '~' || *two == '~') { ++ if (*one != '~') return 1; ++ if (*two != '~') return -1; ++ one++; ++ two++; ++ continue; ++ } + + /* If we ran to the end of either, we are finished with the loop */ + if (!(*one && *two)) break;