From 415b3e6ff241d1c7120ee12ddb28bb1ad25c2e0d Mon Sep 17 00:00:00 2001 From: jbj Date: Tue, 24 Dec 2002 02:41:45 +0000 Subject: [PATCH] fix: ia64 segfault on build. CVS patchset: 5961 CVS date: 2002/12/24 02:41:45 --- autogen.sh | 4 ++-- beecrypt/autogen.sh | 4 ++-- build/buildio.h | 10 ++++++---- build/files.c | 31 +++++++++++++++++-------------- build/pack.c | 48 +++++++++++++++++++++++++----------------------- build/rpmspec.h | 2 +- file/autogen.sh | 4 ++-- 7 files changed, 55 insertions(+), 48 deletions(-) diff --git a/autogen.sh b/autogen.sh index 1ffd855..b103cc0 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,12 +4,12 @@ export CFLAGS export LDFLAGS LTV="libtoolize (GNU libtool) 1.4.3" -ACV="autoconf (GNU Autoconf) 2.56" +ACV="autoconf (GNU Autoconf) 2.57" AMV="automake (GNU automake) 1.6.3" USAGE=" This script documents the versions of the tools I'm using to build rpm: libtool-1.4.3 - autoconf-2.56 + autoconf-2.57 automake-1.6.3 Simply edit this script to change the libtool/autoconf/automake versions checked if you need to, as rpm should build (and has built) with all diff --git a/beecrypt/autogen.sh b/beecrypt/autogen.sh index ddf3a28..0a7254f 100755 --- a/beecrypt/autogen.sh +++ b/beecrypt/autogen.sh @@ -4,12 +4,12 @@ export CFLAGS export LDFLAGS LTV="libtoolize (GNU libtool) 1.4.3" -ACV="autoconf (GNU Autoconf) 2.56" +ACV="autoconf (GNU Autoconf) 2.57" AMV="automake (GNU automake) 1.6.3" USAGE=" This script documents the versions of the tools I'm using to build rpm: libtool-1.4.3 - autoconf-2.56 + autoconf-2.57 automake-1.6.3 Simply edit this script to change the libtool/autoconf/automake versions checked if you need to, as rpm should build (and has built) with all diff --git a/build/buildio.h b/build/buildio.h index b9a88b9..c342453 100644 --- a/build/buildio.h +++ b/build/buildio.h @@ -15,8 +15,10 @@ typedef /*@abstract@*/ struct cpioSourceArchive_s { unsigned int cpioArchiveSize; FD_t cpioFdIn; +/*@refcounted@*/ rpmfi cpioList; -/*@only@*/ struct rpmlead * lead; /* XXX FIXME: exorcize lead/arch/os */ +/*@only@*/ + struct rpmlead * lead; /* XXX FIXME: exorcize lead/arch/os */ } * CSA_t; #ifdef __cplusplus @@ -49,7 +51,7 @@ extern "C" { * return a reloaded contiguous header to the caller. * * @retval *hdrp header to write (final header is returned). - * @retval *sigp signature header (or NULL) + * @retval *pkgidp header+payload MD5 of package (NULL to disable). * @param fileName file name of package * @param type RPMLEAD_SOURCE/RPMLEAD_BINARY * @param csa @@ -57,7 +59,7 @@ extern "C" { * @retval cookie generated cookie (i.e build host/time) * @return 0 on success */ -int writeRPM(Header * hdrp, /*@null@*/ Header * sigp, +int writeRPM(Header * hdrp, /*@null@*/ unsigned char ** pkgidp, const char * fileName, int type, CSA_t csa, @@ -65,7 +67,7 @@ int writeRPM(Header * hdrp, /*@null@*/ Header * sigp, /*@out@*/ const char ** cookie) /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ - /*@modifies *hdrp, *sigp, *cookie, csa, csa->cpioArchiveSize, + /*@modifies *hdrp, *pkgidp, *cookie, csa, csa->cpioArchiveSize, rpmGlobalMacroContext, fileSystem, internalState @*/; #ifdef __cplusplus diff --git a/build/files.c b/build/files.c index c49103d..c7b5c77 100644 --- a/build/files.c +++ b/build/files.c @@ -1100,15 +1100,15 @@ static int checkHardLinks(FileList fl) * @todo Should directories have %doc/%config attributes? (#14531) * @todo Remove RPMTAG_OLDFILENAMES, add dirname/basename instead. * @param fl package file tree walk data - * @param cpioList + * @retval *fip file info for package * @param h * @param isSrc */ /*@-bounds@*/ static void genCpioListAndHeader(/*@partial@*/ FileList fl, - rpmfi * cpioList, Header h, int isSrc) + rpmfi * fip, Header h, int isSrc) /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ - /*@modifies h, *cpioList, fl->processingFailed, fl->fileList, + /*@modifies h, *fip, fl->processingFailed, fl->fileList, rpmGlobalMacroContext, fileSystem, internalState @*/ { int _addDotSlash = !(isSrc || rpmExpandNumeric("%{_noPayloadPrefix}")); @@ -1327,7 +1327,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl, (void) rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1"); } - { int scareMem = 1; + { int scareMem = 0; rpmts ts = NULL; /* XXX FIXME drill rpmts ts all the way down here */ rpmfi fi = rpmfiNew(ts, h, RPMTAG_BASENAMES, scareMem); char * a, * d; @@ -1341,15 +1341,18 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl, fi->dnl = _free(fi->dnl); fi->bnl = _free(fi->bnl); + if (!scareMem) fi->dil = _free(fi->dil); fi->dnl = xmalloc(fi->fc * sizeof(*fi->dnl) + dpathlen); d = (char *)(fi->dnl + fi->fc); *d = '\0'; fi->bnl = xmalloc(fi->fc * (sizeof(*fi->bnl) + sizeof(*fi->dil))); - /*@-dependenttrans@*/ /* FIX: artifact of spoofing headerGetEntry */ - fi->dil = (int *)(fi->bnl + fi->fc); - /*@=dependenttrans@*/ +/*@-dependenttrans@*/ /* FIX: artifact of spoofing headerGetEntry */ + fi->dil = (!scareMem) + ? xcalloc(sizeof(*fi->dil), fi->fc) + : (int *)(fi->bnl + fi->fc); +/*@=dependenttrans@*/ fi->apath = xmalloc(fi->fc * sizeof(*fi->apath) + apathlen); a = (char *)(fi->apath + fi->fc); @@ -1385,9 +1388,9 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl, /* Create disk directory and base name. */ fi->dil[i] = i; - /*@-dependenttrans@*/ /* FIX: artifact of spoofing headerGetEntry */ +/*@-dependenttrans@*/ /* FIX: artifact of spoofing headerGetEntry */ fi->dnl[fi->dil[i]] = d; - /*@=dependenttrans@*/ +/*@=dependenttrans@*/ d = stpcpy(d, flp->diskURL); /* Make room for the dirName NUL, find start of baseName. */ @@ -1423,10 +1426,10 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl, } /*@-branchstate@*/ - if (cpioList) - *cpioList = fi; + if (fip) + *fip = fi; else - fi = _free(fi); + fi = rpmfiFree(fi); /*@=branchstate@*/ } } @@ -2050,7 +2053,7 @@ static int processPackageFiles(Spec spec, Package pkg, (void) rpmlibNeedsFeature(pkg->header, "PartialHardlinkSets", "4.0.4-1"); - genCpioListAndHeader(&fl, (rpmfi *)&pkg->cpioList, pkg->header, 0); + genCpioListAndHeader(&fl, &pkg->cpioList, pkg->header, 0); if (spec->timeCheck) timeCheck(spec->timeCheck, pkg->header); @@ -2267,7 +2270,7 @@ int processSourceFiles(Spec spec) if (! fl.processingFailed) { if (spec->sourceHeader != NULL) - genCpioListAndHeader(&fl, (rpmfi *)&spec->sourceCpioList, + genCpioListAndHeader(&fl, &spec->sourceCpioList, spec->sourceHeader, 1); } diff --git a/build/pack.c b/build/pack.c index 56400cf..93668f5 100644 --- a/build/pack.c +++ b/build/pack.c @@ -404,8 +404,8 @@ static int rpmLeadVersion(void) } /*@-boundswrite@*/ -int writeRPM(Header *hdrp, Header *sigp, const char *fileName, int type, - CSA_t csa, char *passPhrase, const char **cookie) +int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName, + int type, CSA_t csa, char *passPhrase, const char **cookie) { FD_t fd = NULL; FD_t ifd = NULL; @@ -423,8 +423,8 @@ int writeRPM(Header *hdrp, Header *sigp, const char *fileName, int type, h = headerLink(*hdrp); *hdrp = headerFree(*hdrp); - if (sigp) - *sigp = NULL; + if (pkgidp) + *pkgidp = NULL; #ifdef DYING if (Fileno(csa->cpioFdIn) < 0) { @@ -588,9 +588,6 @@ int writeRPM(Header *hdrp, Header *sigp, const char *fileName, int type, rpmError(RPMERR_RELOAD, _("Unable to reload signature header.\n")); goto exit; } - /* Re-reference reallocated header. */ - if (sigp != NULL) - *sigp = headerLink(sig); /* Open the output file */ fd = Fopen(fileName, "w.ufdio"); @@ -698,6 +695,19 @@ int writeRPM(Header *hdrp, Header *sigp, const char *fileName, int type, exit: SHA1 = _free(SHA1); h = headerFree(h); + + /* XXX Fish the pkgid out of the signature header. */ + if (sig != NULL && pkgidp != NULL) { + HGE_t hge = (HGE_t)headerGetEntry; + unsigned char * md5 = NULL; + rpmTagType type; + int_32 c; + int xx; + xx = hge(sig, RPMSIGTAG_MD5, &type, (void **)&md5, &c); + if (type == RPM_BIN_TYPE && md5 != NULL && c == 16) + *pkgidp = md5; + } + sig = rpmFreeSignature(sig); if (ifd) { (void) Fclose(ifd); @@ -818,11 +828,13 @@ int packageBinaries(Spec spec) /*@-type@*/ /* LCL: function typedefs */ csa->cpioFdIn = fdNew("init (packageBinaries)"); /*@-assignexpose -newreftrans@*/ -/*@i@*/ csa->cpioList = pkg->cpioList; + csa->cpioList = rpmfiLink(pkg->cpioList, "packageBinaries"); /*@=assignexpose =newreftrans@*/ rc = writeRPM(&pkg->header, NULL, fn, RPMLEAD_BINARY, csa, spec->passPhrase, NULL); + + csa->cpioList = rpmfiFree(pkg->cpioList); csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageBinaries)"); /*@=type@*/ fn = _free(fn); @@ -855,30 +867,20 @@ int packageSources(Spec spec) /* XXX this should be %_srpmdir */ { const char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL); - Header sig; memset(csa, 0, sizeof(*csa)); csa->cpioArchiveSize = 0; /*@-type@*/ /* LCL: function typedefs */ csa->cpioFdIn = fdNew("init (packageSources)"); /*@-assignexpose -newreftrans@*/ -/*@i@*/ csa->cpioList = spec->sourceCpioList; + csa->cpioList = rpmfiLink(spec->sourceCpioList, "packageSources"); /*@=assignexpose =newreftrans@*/ - sig = NULL; - rc = writeRPM(&spec->sourceHeader, &sig, fn, RPMLEAD_SOURCE, + spec->sourcePkgId = NULL; + rc = writeRPM(&spec->sourceHeader, &spec->sourcePkgId, fn, RPMLEAD_SOURCE, csa, spec->passPhrase, &(spec->cookie)); - if (rc == 0 && sig != NULL) { - HGE_t hge = (HGE_t)headerGetEntryMinMemory; - const unsigned char * md5 = NULL; - rpmTagType type; - int_32 c; - int xx; - xx = hge(sig, RPMSIGTAG_MD5, &type, (void **)&md5, &c); - if (type == RPM_BIN_TYPE && md5 != NULL && c == 16) - spec->sourcePkgId = memcpy(xmalloc(16), md5, 16);; - sig = headerFree(sig); - } + + csa->cpioList = rpmfiFree(spec->sourceCpioList); csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageSources)"); /*@=type@*/ fn = _free(fn); diff --git a/build/rpmspec.h b/build/rpmspec.h index 5bfec8d..a71b698 100644 --- a/build/rpmspec.h +++ b/build/rpmspec.h @@ -145,7 +145,7 @@ struct Spec_s { /*@only@*/ const char * sourceRpmName; /*@only@*/ - const unsigned char * sourcePkgId; + unsigned char * sourcePkgId; /*@refcounted@*/ Header sourceHeader; rpmfi sourceCpioList; diff --git a/file/autogen.sh b/file/autogen.sh index ddf3a28..0a7254f 100755 --- a/file/autogen.sh +++ b/file/autogen.sh @@ -4,12 +4,12 @@ export CFLAGS export LDFLAGS LTV="libtoolize (GNU libtool) 1.4.3" -ACV="autoconf (GNU Autoconf) 2.56" +ACV="autoconf (GNU Autoconf) 2.57" AMV="automake (GNU automake) 1.6.3" USAGE=" This script documents the versions of the tools I'm using to build rpm: libtool-1.4.3 - autoconf-2.56 + autoconf-2.57 automake-1.6.3 Simply edit this script to change the libtool/autoconf/automake versions checked if you need to, as rpm should build (and has built) with all -- 2.7.4