RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ CHANGES rpm/lib/ psm.c transaction.c

From: Jeff Johnson <n3npq@mac.com>
Date: Thu 31 Jan 2008 - 22:48:03 CET
Message-Id: <6A2129D1-1A72-4ABC-AD68-6055DD5C1969@mac.com>
This fix is moderately important, 5.0.2 is likely imminent.

Many behaviors in rpm are driven by the installed file state.

The RPMTAG_FILESTATE array was initialized at the PSM_INIT
stage (where the states are not yet known) in rpm-4.4.9 instead of in  
the
PSM_POST stage in order to handle --rollback, which needed
upgrade flink/blink chains initialized earlier.

The result is that all files are reported as state "normal"
even if not installed.

Reported by <glen@pld-linux.org>: thanks!

73 de Jeff

On Jan 31, 2008, at 4:33 PM, Jeff Johnson wrote:

>   RPM Package Manager, CVS Repository
>   http://rpm5.org/cvs/
>    
> ______________________________________________________________________ 
> ______
>
>   Server: rpm5.org                         Name:   Jeff Johnson
>   Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
>   Module: rpm                              Date:   31-Jan-2008  
> 22:33:08
>   Branch: HEAD                             Handle: 2008013121330800
>
>   Modified files:
>     rpm                     CHANGES
>     rpm/lib                 psm.c transaction.c
>
>   Log:
>     - jbj: fix: --rollback PSM_INIT changes added fstates before
>     initialize.
>
>   Summary:
>     Revision    Changes     Path
>     1.2117      +1  -0      rpm/CHANGES
>     2.283       +29 -8      rpm/lib/psm.c
>     1.362       +0  -3      rpm/lib/transaction.c
>    
> ______________________________________________________________________ 
> ______
>
>   patch -p0 <<'@@ .'
>   Index: rpm/CHANGES
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.2116 -r1.2117 CHANGES
>   --- rpm/CHANGES	31 Jan 2008 21:10:13 -0000	1.2116
>   +++ rpm/CHANGES	31 Jan 2008 21:33:08 -0000	1.2117
>   @@ -1,4 +1,5 @@
>    5.0.0 -> 5.1a1:
>   +    - jbj: fix: --rollback PSM_INIT changes added fstates before  
> initialize.
>        - rse: ensure macro option parsing is done correctly also  
> under GLIBC by not allowing option/argument permutations
>        - jbj: retrieve old originTime earlier to include identical  
> package replace.
>        - jbj: fix: functional "-N-V-R.A" erasures-within-upgrade  
> transactions.
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/lib/psm.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r2.282 -r2.283 psm.c
>   --- rpm/lib/psm.c	31 Jan 2008 07:26:12 -0000	2.282
>   +++ rpm/lib/psm.c	31 Jan 2008 21:33:08 -0000	2.283
>   @@ -1552,17 +1552,9 @@
>        uint32_t tecolor = rpmteColor(te);
>        uint32_t installTime = (uint32_t) time(NULL);
>        uint32_t originTime = rpmteOriginTime(te);
>   -    int fc = rpmfiFC(fi);
>        int xx = 1;
>
>    assert(fi->h != NULL);
>   -    if (fi->fstates != NULL && fc > 0) {
>   -	he->tag = RPMTAG_FILESTATES;
>   -	he->t = RPM_UINT8_TYPE;
>   -	he->p.ui8p = fi->fstates;
>   -	he->c = fc;
>   -	xx = headerPut(fi->h, he, 0);
>   -    }
>
>        he->tag = RPMTAG_INSTALLTIME;
>        he->t = RPM_UINT32_TYPE;
>   @@ -1608,6 +1600,32 @@
>        return 0;
>    }
>
>   +
>   +/**
>   + * Add fi->states to an install header.
>   + * @param ts		transaction set
>   + * @param te		transaction element
>   + * @param fi		file info set
>   + * @return		0 always
>   + */
>   +static int postPopulateInstallHeader(const rpmts ts, const rpmte  
> te, rpmfi fi)
>   +	/*@modifies fi @*/
>   +{
>   +    HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
>   +    int fc = rpmfiFC(fi);
>   +    int xx = 1;
>   +
>   +    if (fi->fstates != NULL && fc > 0) {
>   +	he->tag = RPMTAG_FILESTATES;
>   +	he->t = RPM_UINT8_TYPE;
>   +	he->p.ui8p = fi->fstates;
>   +	he->c = fc;
>   +	xx = headerPut(fi->h, he, 0);
>   +    }
>   +
>   +    return 0;
>   +}
>   +
>    #if defined(HAVE_PTHREAD_H)
>    static void * rpmpsmThread(void * arg)
>    	/*@globals rpmGlobalMacroContext, h_errno, fileSystem,  
> internalState @*/
>   @@ -2162,6 +2180,9 @@
>    		if (rc) break;
>    	    }
>
>   +	    /* Add fi->fstates to install header. */
>   +	    xx = postPopulateInstallHeader(ts, psm->te, fi);
>   +
>    	    rc = rpmpsmNext(psm, PSM_RPMDB_ADD);
>    	    if (rc) break;
>
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/lib/transaction.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.361 -r1.362 transaction.c
>   --- rpm/lib/transaction.c	9 Jan 2008 00:36:02 -0000	1.361
>   +++ rpm/lib/transaction.c	31 Jan 2008 21:33:08 -0000	1.362
>   @@ -861,9 +861,6 @@
>
>    /*@-dependenttrans@*/
>        if (netsharedPaths) freeSplitString(netsharedPaths);
>   -#ifdef	DYING	/* XXX freeFi will deal with this later. */
>   -    fi->flangs = _free(fi->flangs);
>   -#endif
>        if (languages) freeSplitString((char **)languages);
>    /*@=dependenttrans@*/
>    }
>   @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Thu Jan 31 22:48:24 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.