RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   20-Nov-2007 23:39:01
  Branch: HEAD                             Handle: 2007112022390000

  Modified files:
    rpm                     CHANGES
    rpm/build               pack.c
    rpm/lib                 package.c
    rpm/rpmdb               pkgio.c signature.c

  Log:
    - jbj: convert last headerWrite to use rpmpkgWrite instead.
    - jbj: convert 2 (of 9 remaining) headerRead's to use rpmpkgRead instead.
    - jbj: add newlines to error message spew from pkgio.
    - jbj: fix: read from the input, not the output, fd.

  Summary:
    Revision    Changes     Path
    1.1857      +4  -0      rpm/CHANGES
    2.253       +8  -8      rpm/build/pack.c
    2.189       +6  -6      rpm/lib/package.c
    1.46        +9  -1      rpm/rpmdb/pkgio.c
    1.31        +34 -8      rpm/rpmdb/signature.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1856 -r1.1857 CHANGES
  --- rpm/CHANGES       20 Nov 2007 21:45:22 -0000      1.1856
  +++ rpm/CHANGES       20 Nov 2007 22:39:00 -0000      1.1857
  @@ -1,4 +1,8 @@
   5.0a2 -> 5.0a3:
  +    - jbj: convert last headerWrite to use rpmpkgWrite instead.
  +    - jbj: conver 2 (of 9 remaining) headerRead's to use rpmpkgRead instead.
  +    - jbj: add newlines to error message spew from pkgio.
  +    - jbj: fix: read from the input, not the output, fd.
       - jbj: bury rpmReadHeader underneath rpmpkgRead("Header", ...).
       - jbj: use the fd attached pgpDig everywhere necessary.
       - jbj: attach pgpDig to the fd being used to verify signatures.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/pack.c
  ============================================================================
  $ cvs diff -u -r2.252 -r2.253 pack.c
  --- rpm/build/pack.c  19 Nov 2007 20:55:12 -0000      2.252
  +++ rpm/build/pack.c  20 Nov 2007 22:39:00 -0000      2.253
  @@ -361,21 +361,21 @@
   
        if (nl == 0) {
            rc = RPMRC_FAIL;
  -         msg = "item size is zero";
  +         msg = xstrdup("item size is zero");
        } else {
            l = xcalloc(1, nl);         /* XXX memory leak */
            msg = NULL;
            rc = rpmpkgRead(item, fdi, l, &msg);
  -         if (rc != RPMRC_OK && msg == NULL)
  -             msg = Fstrerror(fdi);
        }
       }
   
       if (rc != RPMRC_OK) {
        rpmlog(RPMLOG_ERR, _("readRPM: read %s: %s\n"),
                (fileName ? fileName : "<stdin>"), msg);
  +     msg = _free(msg);
        return RPMRC_FAIL;
       }
  +    msg = _free(msg);
       /[EMAIL PROTECTED]@*/
   
       /* XXX FIXME: EPIPE on <stdin> */
  @@ -732,7 +732,7 @@
        msg = NULL;
        rc = rpmpkgWrite(item, fd, h, &msg);
        if (rc != RPMRC_OK) {
  -         rpmlog(RPMLOG_ERR, "%s: %s: %s", sigtarget, item,
  +         rpmlog(RPMLOG_ERR, "%s: %s: %s\n", sigtarget, item,
                (msg && *msg ? msg : "write failed\n"));
            msg = _free(msg);
            rc = RPMRC_FAIL;
  @@ -839,7 +839,7 @@
        msg = NULL;
        rc = rpmpkgWrite(item, fd, sigh, &msg);
        if (rc != RPMRC_OK) {
  -         rpmlog(RPMLOG_ERR, "%s: %s: %s", fileName, item,
  +         rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fileName, item,
                   (msg && *msg ? msg : "write failed\n"));
            msg = _free(msg);
            rc = RPMRC_FAIL;
  @@ -861,9 +861,9 @@
        Header nh = NULL;
   
        msg = NULL;
  -     rc = rpmpkgRead(item, fd, &nh, &msg);
  +     rc = rpmpkgRead(item, ifd, &nh, &msg);
        if (rc != RPMRC_OK) {
  -         rpmlog(RPMLOG_ERR, "%s: %s: %s", sigtarget, item,
  +         rpmlog(RPMLOG_ERR, "%s: %s: %s\n", sigtarget, item,
                   (msg && *msg ? msg : "read failed\n"));
            msg = _free(msg);
            rc = RPMRC_FAIL;
  @@ -878,7 +878,7 @@
        rc = rpmpkgWrite(item, fd, nh, &msg);
        nh = headerFree(nh);
        if (rc != RPMRC_OK) {
  -         rpmlog(RPMLOG_ERR, "%s: %s: %s", fileName, item,
  +         rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fileName, item,
                   (msg && *msg ? msg : "write failed\n"));
            msg = _free(msg);
            rc = RPMRC_FAIL;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/package.c
  ============================================================================
  $ cvs diff -u -r2.188 -r2.189 package.c
  --- rpm/lib/package.c 20 Nov 2007 21:45:22 -0000      2.188
  +++ rpm/lib/package.c 20 Nov 2007 22:39:00 -0000      2.189
  @@ -206,12 +206,12 @@
       {        const char item[] = "Header";
        msg = NULL;
        rc = rpmpkgRead(item, fd, &h, msg);
  -        if (rc != RPMRC_OK) {
  -            rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
  -            msg = _free(msg);
  -            goto exit;
  -        }
  -        msg = _free(msg);
  +     if (rc != RPMRC_OK) {
  +         rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
  +         msg = _free(msg);
  +         goto exit;
  +     }
  +     msg = _free(msg);
       }
       nb += fd->stats->ops[FDSTAT_READ].bytes;
   /[EMAIL PROTECTED]@*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/pkgio.c
  ============================================================================
  $ cvs diff -u -r1.45 -r1.46 pkgio.c
  --- rpm/rpmdb/pkgio.c 20 Nov 2007 21:45:23 -0000      1.45
  +++ rpm/rpmdb/pkgio.c 20 Nov 2007 22:39:00 -0000      1.46
  @@ -1149,7 +1149,15 @@
       rpmRC rc = RPMRC_FAIL;           /* assume failure */
       int xx;
   
  -assert(dig != NULL);
  +    if (dig == NULL) {
  +     *hdrp = headerRead(fd);
  +     if (*hdrp == NULL) {
  +         if (msg)
  +             *msg = xstrdup(Fstrerror(fd));
  +         return RPMRC_FAIL;
  +     }
  +     return RPMRC_OK;
  +    }
       buf[0] = '\0';
   
       if (hdrp)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/signature.c
  ============================================================================
  $ cvs diff -u -r1.30 -r1.31 signature.c
  --- rpm/rpmdb/signature.c     20 Nov 2007 17:37:03 -0000      1.30
  +++ rpm/rpmdb/signature.c     20 Nov 2007 22:39:00 -0000      1.31
  @@ -314,6 +314,8 @@
       byte * pkt;
       uint32_t pktlen;
       const char * fn = NULL;
  +    const char * msg;
  +    rpmRC rc;
       int ret = -1;    /* assume failure. */
       int xx;
   
  @@ -330,9 +332,16 @@
        fd = Fopen(file, "r.fdio");
        if (fd == NULL || Ferror(fd))
            goto exit;
  -     h = headerRead(fd);
  -     if (h == NULL)
  -         goto exit;
  +     {   const char item[] = "Header";
  +         msg = NULL;
  +         rc = rpmpkgRead(item, fd, &h, &msg);
  +         if (rc != RPMRC_OK) {
  +             rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
  +             msg = _free(msg);
  +             goto exit;
  +         }
  +         msg = _free(msg);
  +     }
        (void) Fclose(fd);      fd = NULL;
   
        if (headerIsEntry(h, RPMTAG_HEADERIMMUTABLE)) {
  @@ -372,15 +381,32 @@
        fd = Fopen(file, "r.fdio");
        if (fd == NULL || Ferror(fd))
            goto exit;
  -     h = headerRead(fd);
  -     if (h == NULL)
  -         goto exit;
  +     {   const char item[] = "Header";
  +         msg = NULL;
  +         rc = rpmpkgRead(item, fd, &h, &msg);
  +         if (rc != RPMRC_OK) {
  +             rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
  +             msg = _free(msg);
  +             goto exit;
  +         }
  +         msg = _free(msg);
  +     }
        (void) Fclose(fd);      fd = NULL;
  +
        if (rpmTempFile(NULL, &fn, &fd))
            goto exit;
  -     if (headerWrite(fd, h))
  -         goto exit;
  +     {   const char item[] = "Header";
  +         msg = NULL;
  +         rc = rpmpkgWrite(item, fd, h, &msg);
  +         if (rc != RPMRC_OK) {
  +             rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
  +             msg = _free(msg);
  +             goto exit;
  +         }
  +         msg = _free(msg);
  +     }
        (void) Fclose(fd);      fd = NULL;
  +
        if (makeGPGSignature(fn, &sigTag, &pkt, &pktlen, passPhrase))
            goto exit;
        he->tag = sigTag;
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to