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:   19-Aug-2007 04:34:49
  Branch: HEAD                             Handle: 2007081903344801

  Modified files:
    rpm                     CHANGES
    rpm/lib                 rpminstall.c rpmte.c transaction.c

  Log:
    - don't open rpmdb O_RDWR iff srpm to permit non-root installs

  Summary:
    Revision    Changes     Path
    1.1588      +1  -0      rpm/CHANGES
    1.161       +0  -1      rpm/lib/rpminstall.c
    2.50        +2  -2      rpm/lib/rpmte.c
    1.331       +11 -2      rpm/lib/transaction.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1587 -r1.1588 CHANGES
  --- rpm/CHANGES       18 Aug 2007 23:40:29 -0000      1.1587
  +++ rpm/CHANGES       19 Aug 2007 02:34:48 -0000      1.1588
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: don't open rpmdb O_RDWR iff srpm to permit non-root installs.
       - jbj: prepare for open as a macro in bleeding edge glibc-2.6.90+.
       - jbj: permit mixed binary/source installation transactions.
       - jbj: re-add rpmcache/rpmcmp/rpmdigest tools.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpminstall.c
  ============================================================================
  $ cvs diff -u -r1.160 -r1.161 rpminstall.c
  --- rpm/lib/rpminstall.c      18 Aug 2007 21:32:29 -0000      1.160
  +++ rpm/lib/rpminstall.c      19 Aug 2007 02:34:49 -0000      1.161
  @@ -635,7 +635,6 @@
       FD_t fd;
       int rc;
   
  -
       fd = Fopen(arg, "r.fdio");
       if (fd == NULL || Ferror(fd)) {
        rpmMessage(RPMMESS_ERROR, _("cannot open %s: %s\n"), arg, 
Fstrerror(fd));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmte.c
  ============================================================================
  $ cvs diff -u -r2.49 -r2.50 rpmte.c
  --- rpm/lib/rpmte.c   17 Aug 2007 18:11:43 -0000      2.49
  +++ rpm/lib/rpmte.c   19 Aug 2007 02:34:49 -0000      2.50
  @@ -153,11 +153,11 @@
       p->isSource = (headerIsEntry(h, RPMTAG_SOURCERPM) == 0);
   
       nb = strlen(p->NEVR) + 1;
  +#ifdef       DYING   /* p->NEVR includes arch now. */
       if (p->arch == NULL)
        nb += sizeof("pubkey");
       else if (p->isSource)
        nb += sizeof("src");
  -#ifdef       DYING   /* p->NEVRA includes arch now. */
       else
        nb += strlen(p->arch) + 1;
   #endif
  @@ -165,11 +165,11 @@
       p->NEVRA = t;
       *t = '\0';
       t = stpcpy(t, p->NEVR);
  +#ifdef       DYING   /* p->NEVR includes arch now. */
       if (p->arch == NULL)
        t = stpcpy( t, ".pubkey");
       else if (p->isSource)
        t = stpcpy( t, ".src");
  -#ifdef       DYING   /* p->NEVRA includes arch now. */
       else
        t = stpcpy( stpcpy( t, "."), p->arch);
   #endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/transaction.c
  ============================================================================
  $ cvs diff -u -r1.330 -r1.331 transaction.c
  --- rpm/lib/transaction.c     18 Aug 2007 21:32:29 -0000      1.330
  +++ rpm/lib/transaction.c     19 Aug 2007 02:34:49 -0000      1.331
  @@ -1201,8 +1201,17 @@
       ts->probs = rpmpsCreate();
   
       /* XXX Make sure the database is open RDWR for package install/erase. */
  -    {        int dbmode = (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
  -             ? O_RDONLY : (O_RDWR|O_CREAT);
  +    {        int dbmode = O_RDONLY;
  +
  +     if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) {
  +         pi = rpmtsiInit(ts);
  +         while ((p = rpmtsiNext(pi, 0)) != NULL) {
  +             if (p->isSource) continue;
  +             dbmode = (O_RDWR|O_CREAT);
  +             break;
  +         }
  +         pi = rpmtsiFree(pi);
  +     }
   
        /* Open database RDWR for installing packages. */
        if (rpmtsOpenDB(ts, dbmode)) {
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to