fix: ia64 segfault on build.
authorjbj <devnull@localhost>
Tue, 24 Dec 2002 02:41:45 +0000 (02:41 +0000)
committerjbj <devnull@localhost>
Tue, 24 Dec 2002 02:41:45 +0000 (02:41 +0000)
CVS patchset: 5961
CVS date: 2002/12/24 02:41:45

autogen.sh
beecrypt/autogen.sh
build/buildio.h
build/files.c
build/pack.c
build/rpmspec.h
file/autogen.sh

index 1ffd855..b103cc0 100755 (executable)
@@ -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
index ddf3a28..0a7254f 100755 (executable)
@@ -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
index b9a88b9..c342453 100644 (file)
 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
index c49103d..c7b5c77 100644 (file)
@@ -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);
     }
 
index 56400cf..93668f5 100644 (file)
@@ -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);
index 5bfec8d..a71b698 100644 (file)
@@ -145,7 +145,7 @@ struct Spec_s {
 /*@only@*/
     const char * sourceRpmName;
 /*@only@*/
-    const unsigned char * sourcePkgId;
+    unsigned char * sourcePkgId;
 /*@refcounted@*/
     Header sourceHeader;
     rpmfi sourceCpioList;
index ddf3a28..0a7254f 100755 (executable)
@@ -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