[CVS] RPM: rpm/lib/ rpmrc.c

2009-03-12 Thread Per �yvind Karlsen
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs   Email:  pkarl...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 09:34:23
  Branch: HEAD Handle: 2009031208342300

  Modified files:
rpm/lib rpmrc.c

  Log:
improve detection of compatible x86 cpus based on features

  Summary:
RevisionChanges Path
2.254   +11 -9  rpm/lib/rpmrc.c
  

  patch -p0 '@@ .'
  Index: rpm/lib/rpmrc.c
  
  $ cvs diff -u -r2.253 -r2.254 rpmrc.c
  --- rpm/lib/rpmrc.c   10 Mar 2009 00:10:21 -  2.253
  +++ rpm/lib/rpmrc.c   12 Mar 2009 08:34:23 -  2.254
  @@ -518,21 +518,23 @@
   #if defined(__i386__) || defined(__x86_64__)
   if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_64BIT)  strcmp(un.machine, 
x86_64) == 0)
xx = mireAppend(RPMMIRE_REGEX, 0, x86_64, NULL, mi_re, mi_nre);
  -if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_SSE2))
  - xx = mireAppend(RPMMIRE_REGEX, 0, pentium4, NULL, mi_re, mi_nre);
  -if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_SSE))
  - xx = mireAppend(RPMMIRE_REGEX, 0, pentium3, NULL, mi_re, mi_nre);
  -if(cpuinfo_get_vendor(cip) == CPUINFO_FEATURE_X86_3DNOW_PLUS)
  - xx = mireAppend(RPMMIRE_REGEX, 0, athlon, NULL, mi_re, mi_nre);
   if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_CMOV))
   {
if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_MMX))
  + {
  + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_SSE))
  + {
  + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_SSE2))
  + xx = mireAppend(RPMMIRE_REGEX, 0, pentium4, NULL, mi_re, 
mi_nre);
  + xx = mireAppend(RPMMIRE_REGEX, 0, pentium3, NULL, mi_re, 
mi_nre);
  + }
  + if(cpuinfo_get_vendor(cip) == CPUINFO_FEATURE_X86_3DNOW_PLUS)
  + xx = mireAppend(RPMMIRE_REGEX, 0, athlon, NULL, mi_re, 
mi_nre);
xx = mireAppend(RPMMIRE_REGEX, 0, pentium2, NULL, mi_re, 
mi_nre);
  + }
xx = mireAppend(RPMMIRE_REGEX, 0, i686, NULL, mi_re, mi_nre);
   }
  -if(cpuinfo_get_vendor(cip) == CPUINFO_FEATURE_X86_3DNOW)
  - xx = mireAppend(RPMMIRE_REGEX, 0, k6, NULL, mi_re, mi_nre);
  -if(cpuinfo_get_vendor(cip) == CPUINFO_VENDOR_NSC)
  +if(cpuinfo_get_vendor(cip) == CPUINFO_FEATURE_X86_3DNOW  
cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_MMX))
xx = mireAppend(RPMMIRE_REGEX, 0, geode, NULL, mi_re, mi_nre);
   if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_TSC))
xx = mireAppend(RPMMIRE_REGEX, 0, i586, NULL, mi_re, mi_nre);
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/lib/ rpmrc.c

2009-03-12 Thread Per �yvind Karlsen
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs   Email:  pkarl...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 09:39:28
  Branch: HEAD Handle: 2009031208392800

  Modified files:
rpm/lib rpmrc.c

  Log:
just pick MIPS cpu based on endianness  machine hardware name for
now..

  Summary:
RevisionChanges Path
2.255   +3  -3  rpm/lib/rpmrc.c
  

  patch -p0 '@@ .'
  Index: rpm/lib/rpmrc.c
  
  $ cvs diff -u -r2.254 -r2.255 rpmrc.c
  --- rpm/lib/rpmrc.c   12 Mar 2009 08:34:23 -  2.254
  +++ rpm/lib/rpmrc.c   12 Mar 2009 08:39:28 -  2.255
  @@ -564,10 +564,10 @@
   #define mips32 mips
   #define mips64 mips64
   #endif
  -if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_64BIT)  strcmp(un.machine, 
mips64) == 0)
  +/* XXX: libcpuinfo only have irix support for now.. */
  +if(strcmp(un.machine, mips64) == 0)
xx = mireAppend(RPMMIRE_REGEX, 0, mips64, NULL, mi_re, mi_nre);
  -if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_MIPS)) {
  - xx = mireAppend(RPMMIRE_REGEX, 0, mips32, NULL, mi_re, mi_nre);
  +xx = mireAppend(RPMMIRE_REGEX, 0, mips32, NULL, mi_re, mi_nre);
   #endif
   
   xx = mireAppend(RPMMIRE_REGEX, 0, noarch, NULL, mi_re, mi_nre);
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/lib/ rpmrc.c

2009-03-12 Thread Per �yvind Karlsen
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs   Email:  pkarl...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 10:14:26
  Branch: HEAD Handle: 2009031209142500

  Modified files:
rpm/lib rpmrc.c

  Log:
add support for 'fat' binaries through libcpuinfo

  Summary:
RevisionChanges Path
2.256   +5  -0  rpm/lib/rpmrc.c
  

  patch -p0 '@@ .'
  Index: rpm/lib/rpmrc.c
  
  $ cvs diff -u -r2.255 -r2.256 rpmrc.c
  --- rpm/lib/rpmrc.c   12 Mar 2009 08:39:28 -  2.255
  +++ rpm/lib/rpmrc.c   12 Mar 2009 09:14:25 -  2.256
  @@ -551,6 +551,11 @@
xx = mireAppend(RPMMIRE_REGEX, 0, ppc, NULL, mi_re, mi_nre);
   #endif
   
  +#if defined(__powerpc__) || defined(__i386__) || defined(__x86_64__)
  +if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_PPC) || 
cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86))
  + xx = mireAppend(RPMMIRE_REGEX, 0, fat, NULL, mi_re, mi_nre);
  +#endif
  +
   #if defined(__ia64__)
   if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_IA64))
xx = mireAppend(RPMMIRE_REGEX, 0, ia64, NULL, mi_re, mi_nre);
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/ CHANGES rpm/lib/ rpmds.c rpmrc.c

2009-03-12 Thread Per �yvind Karlsen
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs   Email:  pkarl...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 14:02:12
  Branch: HEAD Handle: 2009031213021100

  Modified files:
rpm CHANGES
rpm/lib rpmds.c rpmrc.c

  Log:
add support for cpuinfo() probe through libcpuinfo.

  Summary:
RevisionChanges Path
1.2814  +1  -0  rpm/CHANGES
2.122   +69 -25 rpm/lib/rpmds.c
2.257   +4  -0  rpm/lib/rpmrc.c
  

  patch -p0 '@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2813 -r1.2814 CHANGES
  --- rpm/CHANGES   11 Mar 2009 22:03:06 -  1.2813
  +++ rpm/CHANGES   12 Mar 2009 13:02:11 -  1.2814
  @@ -1,5 +1,6 @@
   
   5.2a3 - 5.2a4:
  +- proyvind: add support for cpuinfo() probe through libcpuinfo.
   - proyvind: perl: make sure to link against all required libraries to fix
build with --no-undefined.
   - proyvind: only provide PayLoadIsLzma and PayLoadIsXz features when 
enabled.
  @@ .
  patch -p0 '@@ .'
  Index: rpm/lib/rpmds.c
  
  $ cvs diff -u -r2.121 -r2.122 rpmds.c
  --- rpm/lib/rpmds.c   11 Mar 2009 14:20:29 -  2.121
  +++ rpm/lib/rpmds.c   12 Mar 2009 13:02:11 -  2.122
  @@ -3,6 +3,10 @@
*/
   #include system.h
   
  +#if defined(SUPPORT_LIBCPUINFO)
  +#include cpuinfo.h
  +#endif
  +
   #if defined(HAVE_GELF_H)  !defined(__FreeBSD__)
   #if LIBELF_H_LFS_CONFLICT
   /* Some implementations of libelf.h/gelf.h are incompatible with
  @@ -1172,6 +1176,70 @@
   return i;
   }
   
  +/**
  + * Merge a single provides, wrapping N as NS(N).
  + * @retval *dsp  (loaded) dependency set
  + * @param NS dependency name space
  + * @param N  name
  + * @param EVRepoch:version-release
  + * @param Flags  comparison/context flags
  + */
  +static void rpmdsNSAdd(/*...@out@*/ rpmds *dsp, const char * NS,
  + const char *N, const char *EVR, evrFlags Flags)
  + /*...@modifies *dsp @*/
  +{
  +char *t;
  +rpmds ds;
  +int xx;
  +
  +t = alloca(strlen(NS)+sizeof(())+strlen(N));
  +*t = '\0';
  +(void) stpcpy( stpcpy( stpcpy( stpcpy(t, NS), (), N), ));
  +
  +ds = rpmdsSingle(RPMTAG_PROVIDENAME, t, EVR, Flags);
  +xx = rpmdsMerge(dsp, ds);
  +ds = rpmdsFree(ds);
  +}
  +
  +#if defined(SUPPORT_LIBCPUINFO)
  +int rpmdsCpuinfo(rpmds *dsp, const char * fn)
  +{
  +const char * NS = cpuinfo;
  +struct cpuinfo *cip = cpuinfo_new();
  +int i,j;
  +
  +static const struct {
  + int base;
  + int max;
  +} features_bits[] = {
  + { CPUINFO_FEATURE_COMMON + 1, CPUINFO_FEATURE_COMMON_MAX },
  + { CPUINFO_FEATURE_X86, CPUINFO_FEATURE_X86_MAX },
  + { CPUINFO_FEATURE_IA64, CPUINFO_FEATURE_IA64_MAX },
  + { CPUINFO_FEATURE_PPC, CPUINFO_FEATURE_PPC_MAX },
  + { CPUINFO_FEATURE_MIPS, CPUINFO_FEATURE_MIPS_MAX },
  + { -1, 0 }
  +};
  +
  +for (i = 0; features_bits[i].base != -1; i++) {
  + int base = features_bits[i].base;
  + int count = features_bits[i].max - base;
  + for (j = 0; j  count; j++) {
  + int feature = base + j;
  + if (cpuinfo_has_feature(cip, feature)) {
  + /* XXX: some mnemonics are currently different from 
/proc/cpuinfo's */
  + const char *name = cpuinfo_string_of_feature(feature);
  + if (name)
  + rpmdsNSAdd(dsp, NS, name, , RPMSENSE_PROBE);
  + }
  + }
  +}
  +cpuinfo_destroy(cip);
  +
  +return RPMRC_OK;
  +}
  +
  +#else
  +
   struct cpuinfo_s {
   /*...@observer@*/ /*...@null@*/
   const char *name;
  @@ -1231,31 +1299,6 @@
   return flags;
   }
   
  -/**
  - * Merge a single provides, wrapping N as NS(N).
  - * @retval *dsp  (loaded) dependency set
  - * @param NS dependency name space
  - * @param N  name
  - * @param EVRepoch:version-release
  - * @param Flags  comparison/context flags
  - */
  -static void rpmdsNSAdd(/*...@out@*/ rpmds *dsp, const char * NS,
  - const char *N, const char *EVR, evrFlags Flags)
  - /*...@modifies *dsp @*/
  -{
  -char *t;
  -rpmds ds;
  -int xx;
  -
  -t = alloca(strlen(NS)+sizeof(())+strlen(N));
  -*t = '\0';
  -(void) stpcpy( stpcpy( stpcpy( stpcpy(t, NS), (), N), ));
  -
  -ds = rpmdsSingle(RPMTAG_PROVIDENAME, t, EVR, Flags);
  -xx = rpmdsMerge(dsp, 

[CVS] RPM: rpm/rpmio/ rpmpigz.c rpmzq.c rpmzq.h

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 15:20:58
  Branch: HEAD Handle: 2009031214205800

  Modified files:
rpm/rpmio   rpmpigz.c rpmzq.c rpmzq.h

  Log:
- jbj: rpmz: stash the buf addr in the space, eliminate zq-_in_prev 
nonsense.
- jbj: rpmz: _out_buf_allocated is derived from window bits. eliminate.
- jbj: rpmz: copious job debugging preparing for a decompress job stream.

  Summary:
RevisionChanges Path
1.44+106 -39rpm/rpmio/rpmpigz.c
1.15+5  -1  rpm/rpmio/rpmzq.c
1.23+5  -12 rpm/rpmio/rpmzq.h
  

  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmpigz.c
  
  $ cvs diff -u -r1.43 -r1.44 rpmpigz.c
  --- rpm/rpmio/rpmpigz.c   11 Mar 2009 22:13:54 -  1.43
  +++ rpm/rpmio/rpmpigz.c   12 Mar 2009 14:20:58 -  1.44
  @@ -341,6 +341,14 @@
   /*...@unchecked@*/
   rpmz _rpmz = __rpmz;
   
  +#define  WBITS   15
  +/* deflate window bits (should be 15). deflate is negative for raw stream. */
  +/*...@unchecked@*/
  +static int defWBits = -WBITS;
  +/* inflate window bits (should be 15). */
  +/*...@unchecked@*/
  +static int infWBits = WBITS;
  +
   /*==*/
   
   /* prevent end-of-line conversions on MSDOSish operating systems */
  @@ -422,7 +430,7 @@
   sp-zfree = Z_NULL;
   sp-zalloc = Z_NULL;
   sp-opaque = Z_NULL;
  -if (deflateInit2(sp, gz-level, Z_DEFLATED, -15, 8, gz-strategy) != 
Z_OK)
  +if (deflateInit2(sp, gz-level, Z_DEFLATED, defWBits, 8, gz-strategy) 
!= Z_OK)
bail(not enough memory, deflateInit2);
   return gz;
   /*...@=nullstate =nullret @*/
  @@ -510,6 +518,34 @@
   
   /*==*/
   
  +static void jobDebug(/*...@null@*/ const char * msg, /*...@null@*/ rpmzJob 
job)
  + /*...@*/
  +{
  +
  +if (_debug == 0)
  + return;
  +/*...@-modfilesys@*/
  +if (msg != NULL)
  + fprintf(stderr, --- %s\tjob %p, msg, job);
  +else
  + fprintf(stderr, \tjob %p, job);
  +
  +if (job != NULL) {
  + fprintf(stderr, [%u]:, (unsigned)job-seq);
  + if (job-in != NULL  job-in-buf != NULL)
  + fprintf(stderr,  %p[%u], job-in-buf, job-in-len);
  + else
  + fprintf(stderr,  %p, job-in);
  + fprintf(stderr,  -\t);
  + if (job-out != NULL  job-out-buf != NULL)
  + fprintf(stderr,  %p[%u], job-out-buf, job-out-len);
  + else
  + fprintf(stderr,  %p, job-out);
  +}
  +fprintf(stderr, \n);
  +/*...@=modfilesys@*/
  +}
  +
   /* read up to len bytes into buf, repeating read() calls as needed */
   static size_t rpmzRead(rpmzQueue zq, unsigned char *buf, size_t len)
/*...@globals fileSystem, internalState @*/
  @@ -1199,7 +1235,7 @@
strm-zalloc = Z_NULL;
strm-opaque = Z_NULL;
   /*...@=mustfreeonly@*/
  - if (deflateInit2(strm, zq-level, Z_DEFLATED, -15, 8,
  + if (deflateInit2(strm, zq-level, Z_DEFLATED, defWBits, 8,
Z_DEFAULT_STRATEGY) != Z_OK)
bail(not enough memory, );
   }
  @@ -1353,16 +1389,14 @@
yarnRelease(zq-load_state);
   
/* set up input buffer with the data just read */
  - if (job-in != NULL) {
  - job-in-buf = zq-_in_prev;
  + if (job-in != NULL)
job-in = rpmzqDropSpace(job-in);
  - }
njob = rpmzqDelRJob(zq, seq++);
   assert(njob != NULL);
job-in = njob-in;
  + job-seq = njob-seq;   /* XXX propagate job-seq for now */
njob-in = NULL;
njob = rpmzqFreeJob(njob);
  - zq-_in_prev = job-in-buf;
   
/* if not at end of file, alert read thread to load next buffer,
 * alternate between in_buf and in_buf2 */
  @@ -1382,18 +1416,17 @@
   else
   #endif
   {size_t nread;
  - /* don't use threads -- simply read a buffer into zq-_in_buf */
  + /* don't use threads -- free old buffer, malloc and read a new buffer */

  - zq-_in_prev = _free(zq-_in_prev);
  + job-in-ptr = _free(job-in-ptr);
job-in = _free(job-in);
job-in = xcalloc(1, sizeof(*job-in));
job-in-len = zq-_in_buf_allocated;
job-in-buf = xmalloc(job-in-len);
  + job-in-ptr = job-in-buf;
   
nread = rpmzRead(zq, job-in-buf, job-in-len);
job-in-len = nread;
  -
  - zq-_in_prev = job-in-buf;
   }
   
   /* note end of file */
  @@ -1407,7 +1440,7 @@
job-more = 1;
   
   if (_debug)
 

[CVS] RPM: rpm/rpmio/ librpmio.vers rpmpbzip2.c rpmpigz.c rpmzq.c rpmz...

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 18:07:33
  Branch: HEAD Handle: 2009031217073200

  Modified files:
rpm/rpmio   librpmio.vers rpmpbzip2.c rpmpigz.c rpmzq.c
rpmzq.h

  Log:
- jbj: rpmz: add a use count to rpmzJob, add rpmzUseJob/rpmzDropJob, 
eliminate rpmzJobFree.
- jbj: rpmz: permit rpmzNewSpace(NULL, len) to be used as an allocator.

  Summary:
RevisionChanges Path
2.89+2  -1  rpm/rpmio/librpmio.vers
1.7 +32 -37 rpm/rpmio/rpmpbzip2.c
1.45+13 -25 rpm/rpmio/rpmpigz.c
1.16+99 -42 rpm/rpmio/rpmzq.c
1.24+30 -8  rpm/rpmio/rpmzq.h
  

  patch -p0 '@@ .'
  Index: rpm/rpmio/librpmio.vers
  
  $ cvs diff -u -r2.88 -r2.89 librpmio.vers
  --- rpm/rpmio/librpmio.vers   11 Mar 2009 22:13:54 -  2.88
  +++ rpm/rpmio/librpmio.vers   12 Mar 2009 17:07:32 -  2.89
  @@ -433,10 +433,10 @@
   rpmzqDelCJob;
   rpmzqDelRJob;
   rpmzqDelWJob;
  +rpmzqDropJob;
   rpmzqDropSpace;
   rpmzqFini;
   rpmzqFree;
  -rpmzqFreeJob;
   rpmzqFreePool;
   rpmzqInit;
   rpmzqLaunch;
  @@ -445,6 +445,7 @@
   rpmzqNewPool;
   rpmzqNewSpace;
   rpmzqOptionsPoptTable;
  +rpmzqUseJob;
   rpmzqUseSpace;
   rpmzqVerify;
   Stat;
  @@ .
  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmpbzip2.c
  
  $ cvs diff -u -r1.6 -r1.7 rpmpbzip2.c
  --- rpm/rpmio/rpmpbzip2.c 11 Mar 2009 01:36:09 -  1.6
  +++ rpm/rpmio/rpmpbzip2.c 12 Mar 2009 17:07:32 -  1.7
  @@ -344,8 +344,7 @@
job-in = rpmzqDropSpace(job-in);
else {
   fprintf(stderr, == FIXME: %s: job-in %p %p[%u] free\n, __FUNCTION__, 
job-in, job-in-buf, (unsigned)job-in-len);
  - job-in-buf = _free(job-in-buf);
  - job-in = _free(job-in);
  + job-in = rpmzqDropSpace(job-in);
}
   
   /* write the compressed data and drop the output buffer */
  @@ -357,15 +356,14 @@
job-out = rpmzqDropSpace(job-out);
} else {
   fprintf(stderr, == FIXME: %s: job-out %p %p[%u] free\n, __FUNCTION__, 
job-out, job-out-buf, (unsigned)job-out-len);
  - job-out-buf = _free(job-out-buf);
  - job-out = _free(job-out);
  + job-out = rpmzqDropSpace(job-out);
}
   
   Trace((zlog, -- wrote #%ld%s, seq, more ?  :  (last)));
   
rpmzProgress(zq, seq, zq-lastseq);
   
  - job = rpmzqFreeJob(job);
  + job = rpmzqDropJob(job);
   
seq++;
   
  @@ -390,8 +388,8 @@
   otherwise return NULL if not found.
   */
   /*...@null@*/ /*...@observer@*/
  -static const char *memstr(const char *b, size_t blen,
  - const char *s, size_t slen)
  +static const unsigned char *memstr(const unsigned char *b, size_t blen,
  + const unsigned char *s, size_t slen)
/*...@globals fileSystem @*/
/*...@modifies fileSystem @*/
   {
  @@ -421,13 +419,13 @@
   bz2BlockListing * blp;
   bz2BlockListing * nextblp;
   
  -char bz2Header[] = BZh91AYSY;  // for 900k BWT block size
  +unsigned char bz2Header[] = BZh91AYSY;  // for 900k BWT block size
   OFF_T bytesLeft = 0;
   OFF_T inSize = 10;
   OFF_T ret = 0;
   int i;
  -char *b;
  -const char * be;
  +unsigned char *b;
  +const unsigned char * be;
   size_t blag;
   size_t blen;
   OFF_T boff = 0;
  @@ -468,7 +466,7 @@
memmove(b, b+blen-blag, blag);
   
// read file data minus overflow from previous buffer
  - nread = rpmzRead(zq, b+blag, blen-blag);
  + nread = rpmzRead(zq, (unsigned char *)b+blag, blen-blag);
/* XXX 0b EOF read is prolly scwewy */
   
if (nread  0) {
  @@ -478,7 +476,7 @@
}
   
// scan buffer for bzip2 start header
  - be = memstr(b, nread+blag, bz2Header, strlen(bz2Header));
  + be = memstr(b, nread+blag, bz2Header, sizeof(bz2Header)-1);
   
while (be != NULL) {
   /*...@-nullptrarith@*/
  @@ -497,12 +495,12 @@
_nblocks++;
   
be++;
  - be = memstr(be, nread+blag-(be-b), bz2Header, strlen(bz2Header));
  + be = memstr(be, nread+blag-(be-b), bz2Header, sizeof(bz2Header)-1);
}
   
boff += nread;
bytesLeft -= nread;
  - blag = strlen(bz2Header) - 1;
  + blag = sizeof(bz2Header) - 1 - 1;
   }
   
   // use 

[CVS] RPM: rpm/lib/ rpmds.c

2009-03-12 Thread Per �yvind Karlsen
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs   Email:  pkarl...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 18:39:47
  Branch: HEAD Handle: 2009031217394700

  Modified files:
rpm/lib rpmds.c

  Log:
cpuinfo_feature_t variables are now opaque :)

  Summary:
RevisionChanges Path
2.123   +9  -24 rpm/lib/rpmds.c
  

  patch -p0 '@@ .'
  Index: rpm/lib/rpmds.c
  
  $ cvs diff -u -r2.122 -r2.123 rpmds.c
  --- rpm/lib/rpmds.c   12 Mar 2009 13:02:11 -  2.122
  +++ rpm/lib/rpmds.c   12 Mar 2009 17:39:47 -  2.123
  @@ -1206,31 +1206,16 @@
   {
   const char * NS = cpuinfo;
   struct cpuinfo *cip = cpuinfo_new();
  -int i,j;
  +cpuinfo_feature_t feature;
   
  -static const struct {
  - int base;
  - int max;
  -} features_bits[] = {
  - { CPUINFO_FEATURE_COMMON + 1, CPUINFO_FEATURE_COMMON_MAX },
  - { CPUINFO_FEATURE_X86, CPUINFO_FEATURE_X86_MAX },
  - { CPUINFO_FEATURE_IA64, CPUINFO_FEATURE_IA64_MAX },
  - { CPUINFO_FEATURE_PPC, CPUINFO_FEATURE_PPC_MAX },
  - { CPUINFO_FEATURE_MIPS, CPUINFO_FEATURE_MIPS_MAX },
  - { -1, 0 }
  -};
  -
  -for (i = 0; features_bits[i].base != -1; i++) {
  - int base = features_bits[i].base;
  - int count = features_bits[i].max - base;
  - for (j = 0; j  count; j++) {
  - int feature = base + j;
  - if (cpuinfo_has_feature(cip, feature)) {
  - /* XXX: some mnemonics are currently different from 
/proc/cpuinfo's */
  - const char *name = cpuinfo_string_of_feature(feature);
  - if (name)
  - rpmdsNSAdd(dsp, NS, name, , RPMSENSE_PROBE);
  - }
  +for (feature = cpuinfo_feature_common; feature != 
cpuinfo_feature_architecture_max; feature++) {
  + if(feature == cpuinfo_feature_common_max)
  + feature = cpuinfo_feature_architecture;
  + if (cpuinfo_has_feature(cip, feature)) {
  + /* XXX: some mnemonics are currently different from /proc/cpuinfo's 
*/
  + const char *name = cpuinfo_string_of_feature(feature);
  + if (name)
  + rpmdsNSAdd(dsp, NS, name, , RPMSENSE_PROBE);
}
   }
   cpuinfo_destroy(cip);
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/rpmio/ yarn.c

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 19:19:49
  Branch: HEAD Handle: 2009031218194900

  Modified files:
rpm/rpmio   yarn.c

  Log:
- jbj: attempt transparent mutexes and polling waitfor iff
--without-pthreads.

  Summary:
RevisionChanges Path
2.7 +8  -8  rpm/rpmio/yarn.c
  

  patch -p0 '@@ .'
  Index: rpm/rpmio/yarn.c
  
  $ cvs diff -u -r2.6 -r2.7 yarn.c
  --- rpm/rpmio/yarn.c  7 Mar 2009 13:38:10 -   2.6
  +++ rpm/rpmio/yarn.c  12 Mar 2009 18:19:49 -  2.7
  @@ -66,17 +66,17 @@
   #define  pthread_mutex_t int
   #define  PTHREAD_MUTEX_INITIALIZER   0
   #define  PTHREAD_CREATE_JOINABLE 0
  -#define  pthread_mutex_destroy(__mutex)  (-1)
  -#define  pthread_mutex_init(__mutex, __attr) (-1)
  -#define  pthread_mutex_lock(__mutex) (-1)
  -#define  pthread_mutex_unlock(__mutex)   (-1)
  +#define  pthread_mutex_destroy(__mutex)  (0) /* FreeLock */
  +#define  pthread_mutex_init(__mutex, __attr) (0) /* NewLock */
  +#define  pthread_mutex_lock(__mutex) (0) /* Possess */
  +#define  pthread_mutex_unlock(__mutex)   (0) /* 
Twist/Release */
   
   #define  pthread_cond_t  int
   #define  PTHREAD_COND_INITIALIZER0
  -#define  pthread_cond_destroy(__cond)(-1)
  -#define  pthread_cond_init(__cond, __attr)   (-1)
  -#define  pthread_cond_wait(__cond, __mutex)  (-1)
  -#define  pthread_cond_broadcast(__cond)  (-1)
  +#define  pthread_cond_destroy(__cond)(0) /* FreeLock */
  +#define  pthread_cond_init(__cond, __attr)   (0) /* NewLock */
  +#define  pthread_cond_wait(__cond, __mutex)  (sleep(60U))/* 
WaitFor */
  +#define  pthread_cond_broadcast(__cond)  (0) /* Twist */
   
   #endif   /* WITH_PTHREADS */
   
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/rpmio/ rpmdav.c rpmio.c rpmio_internal.h

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 19:21:27
  Branch: HEAD Handle: 2009031218212600

  Modified files:
rpm/rpmio   rpmdav.c rpmio.c rpmio_internal.h

  Log:
- jbj: yarn: convert FD_t refcounts to usage mutexes.

  Summary:
RevisionChanges Path
2.95+6  -2  rpm/rpmio/rpmdav.c
1.161   +27 -11 rpm/rpmio/rpmio.c
2.109   +3  -2  rpm/rpmio/rpmio_internal.h
  

  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmdav.c
  
  $ cvs diff -u -r2.94 -r2.95 rpmdav.c
  --- rpm/rpmio/rpmdav.c7 Mar 2009 13:38:10 -   2.94
  +++ rpm/rpmio/rpmdav.c12 Mar 2009 18:21:26 -  2.95
  @@ -1907,10 +1907,12 @@
   if (rc || u == NULL || u-sess == NULL)
goto exit;
   
  +yarnPossess(u-ctrl-use);
   if (u-ctrl == NULL)
u-ctrl = fdNew(persist ctrl (davOpen));
  -else if (u-ctrl-nrefs  2  u-data == NULL)
  +else if (yarnPeekLock(u-ctrl-use)  2  u-data == NULL)
u-data = fdNew(persist data (davOpen));
  +yarnRelease(u-ctrl-use);
   
   if (u-ctrl-url == NULL)
fd = u-ctrl = fdLink(u-ctrl, grab ctrl (davOpen persist ctrl));
  @@ -2310,10 +2312,12 @@
   if (urlSplit(url, u))
   goto exit;
   
  +yarnPossess(u-ctrl-use);
   if (u-ctrl == NULL)
   u-ctrl = fdNew(persist ctrl (httpOpen));
  -if (u-ctrl-nrefs  2  u-data == NULL)
  +if (yarnPeekLock(u-ctrl-use)  2  u-data == NULL)
   u-data = fdNew(persist data (httpOpen));
  +yarnRelease(u-ctrl-use);
   
   if (u-ctrl-url == NULL)
   fd = fdLink(u-ctrl, grab ctrl (httpOpen persist ctrl));
  @@ .
  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmio.c
  
  $ cvs diff -u -r1.160 -r1.161 rpmio.c
  --- rpm/rpmio/rpmio.c 11 Mar 2009 14:13:22 -  1.160
  +++ rpm/rpmio/rpmio.c 12 Mar 2009 18:21:26 -  1.161
  @@ -66,6 +66,8 @@
   #include rpmmacro.h/* XXX rpmioAccess needs rpmCleanPath() 
*/
   #include rpmlua.h  /* XXX rpmioClean() calls rpmluaFree() */
   
  +#include yarn.h
  +
   #if defined(HAVE_LIBIO_H)  defined(_G_IO_IO_FILE_VERSION)
   #define  _USE_LIBIO  1
   #endif
  @@ -123,7 +125,6 @@
   /*...@access urlinfo @*/
   /*...@access FDSTAT_t @*/
   
  -#define FDNREFS(fd)  (fd ? ((FD_t)fd)-nrefs : -9)
   #define FDTO(fd) (fd ? ((FD_t)fd)-rd_timeoutsecs : -99)
   #define FDCPIOPOS(fd)(fd ? ((FD_t)fd)-fd_cpioPos : -99)
   
  @@ -276,14 +277,20 @@
/*...@modifies *cookie @*/
   {
   FD_t fd;
  +#ifdef   NOTYET
  +assert(cookie != NULL);
  +#else
   if (cookie == NULL)
  -/*...@-castexpose@*/
  -DBGREFS(0, (stderr, -- fd  %p ++ %d %s at %s:%u\n, cookie, 
FDNREFS(cookie)+1, msg, file, line));
  -/*...@=castexpose@*/
  +DBGREFS(0, (stderr, -- fd  %p ++ %d %s at %s:%u\n, cookie, -9, msg, file, 
line));
  +#endif
   fd = c2f(cookie);
  -if (fd) {
  - fd-nrefs++;
  -DBGREFS(fd, (stderr, -- fd  %p ++ %d %s at %s:%u %s\n, fd, fd-nrefs, 
msg, file, line, fdbg(fd)));
  +if (fd  fd-use) {
  + int nrefs;
  + yarnPossess(fd-use);
  + nrefs = yarnPeekLock(fd-use);
  + yarnTwist(fd-use, BY, 1);
  + nrefs++;
  +DBGREFS(fd, (stderr, -- fd  %p ++ %d %s at %s:%u %s\n, fd, nrefs, msg, 
file, line, fdbg(fd)));
   }
   return fd;
   }
  @@ -298,12 +305,21 @@
   {
int i;
   
  +#ifdef   NOTYET
  +assert(fd != NULL);
  +#else
   if (fd == NULL)
  -DBGREFS(0, (stderr, -- fd  %p -- %d %s at %s:%u\n, fd, FDNREFS(fd), msg, 
file, line));
  +DBGREFS(0, (stderr, -- fd  %p -- %d %s at %s:%u\n, fd, -9, msg, file, 
line));
  +#endif
   FDSANE(fd);
   if (fd) {
  -DBGREFS(fd, (stderr, -- fd  %p -- %d %s at %s:%u %s\n, fd, fd-nrefs, 
msg, file, line, fdbg(fd)));
  - if (--fd-nrefs  0)
  + int nrefs;
  + yarnPossess(fd-use);
  + nrefs = yarnPeekLock(fd-use);
  + yarnTwist(fd-use, BY, -1);
  + nrefs--;
  +DBGREFS(fd, (stderr, -- fd  %p -- %d %s at %s:%u %s\n, fd, nrefs, msg, 
file, line, fdbg(fd)));
  + if (nrefs  0)
/*...@-refcounttrans -retal...@*/ return fd; /*...@=refcounttrans 
=retal...@*/
fd-opath = _free(fd-opath);
fd-stats = _free(fd-stats);
  @@ -337,7 +353,7 @@
   FD_t fd = xcalloc(1, sizeof(*fd));
   if (fd == NULL) /* XXX xmalloc never returns NULL */
return NULL;
  -fd-nrefs = 0;
  +fd-use = yarnNewLock(0);
   fd-flags = 0;
   fd-magic = FDMAGIC;
  

[CVS] RPM: rpm/rpmio/ rpmio.c

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 19:57:47
  Branch: HEAD Handle: 2009031218574700

  Modified files:
rpm/rpmio   rpmio.c

  Log:
- jbj: yarn: protect all of fdFree with the usage lock.

  Summary:
RevisionChanges Path
1.162   +28 -29 rpm/rpmio/rpmio.c
  

  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmio.c
  
  $ cvs diff -u -r1.161 -r1.162 rpmio.c
  --- rpm/rpmio/rpmio.c 12 Mar 2009 18:21:26 -  1.161
  +++ rpm/rpmio/rpmio.c 12 Mar 2009 18:57:47 -  1.162
  @@ -284,13 +284,10 @@
   DBGREFS(0, (stderr, -- fd  %p ++ %d %s at %s:%u\n, cookie, -9, msg, file, 
line));
   #endif
   fd = c2f(cookie);
  -if (fd  fd-use) {
  - int nrefs;
  +if (fd) {
yarnPossess(fd-use);
  - nrefs = yarnPeekLock(fd-use);
  +DBGREFS(fd, (stderr, -- fd  %p ++ %ld %s at %s:%u %s\n, fd, 
yarnPeekLock(fd-use), msg, file, line, fdbg(fd)));
yarnTwist(fd-use, BY, 1);
  - nrefs++;
  -DBGREFS(fd, (stderr, -- fd  %p ++ %d %s at %s:%u %s\n, fd, nrefs, msg, 
file, line, fdbg(fd)));
   }
   return fd;
   }
  @@ -309,38 +306,40 @@
   assert(fd != NULL);
   #else
   if (fd == NULL)
  -DBGREFS(0, (stderr, -- fd  %p -- %d %s at %s:%u\n, fd, -9, msg, file, 
line));
  +DBGREFS(0, (stderr, -- fd  %p -- %ld %s at %s:%u\n, fd, -9L, msg, file, 
line));
   #endif
   FDSANE(fd);
   if (fd) {
  - int nrefs;
yarnPossess(fd-use);
  - nrefs = yarnPeekLock(fd-use);
  - yarnTwist(fd-use, BY, -1);
  - nrefs--;
  -DBGREFS(fd, (stderr, -- fd  %p -- %d %s at %s:%u %s\n, fd, nrefs, msg, 
file, line, fdbg(fd)));
  - if (nrefs  0)
  - /*...@-refcounttrans -retal...@*/ return fd; /*...@=refcounttrans 
=retal...@*/
  - fd-opath = _free(fd-opath);
  - fd-stats = _free(fd-stats);
  - for (i = fd-ndigests - 1; i = 0; i--) {
  - FDDIGEST_t fddig = fd-digests + i;
  - if (fddig-hashctx == NULL)
  - continue;
  - (void) rpmDigestFinal(fddig-hashctx, NULL, NULL, 0);
  - fddig-hashctx = NULL;
  - }
  - fd-ndigests = 0;
  - fd-contentType = _free(fd-contentType);
  - fd-contentDisposition = _free(fd-contentDisposition);
  +DBGREFS(fd, (stderr, -- fd  %p -- %ld %s at %s:%u %s\n, fd, 
yarnPeekLock(fd-use), msg, file, line, fdbg(fd)));
  + if (yarnPeekLock(fd-use) == 1) {
  + yarnLock use = fd-use;
  + fd-opath = _free(fd-opath);
  + fd-stats = _free(fd-stats);
  + for (i = fd-ndigests - 1; i = 0; i--) {
  + FDDIGEST_t fddig = fd-digests + i;
  + if (fddig-hashctx == NULL)
  + continue;
  + (void) rpmDigestFinal(fddig-hashctx, NULL, NULL, 0);
  + fddig-hashctx = NULL;
  + }
  + fd-ndigests = 0;
  + fd-contentType = _free(fd-contentType);
  + fd-contentDisposition = _free(fd-contentDisposition);
   /*...@-onlytrans@*/
   #ifdef WITH_XAR
  - fd-xar = rpmxarFree(fd-xar);
  + fd-xar = rpmxarFree(fd-xar);
   #endif
  - fd-dig = pgpDigFree(fd-dig);
  + fd-dig = pgpDigFree(fd-dig);
   /*...@=onlytrans@*/
  - memset(fd, 0, sizeof(*fd)); /* XXX trash and burn */
  - /*...@-refcounttrans@*/ free(fd); /*...@=refcounttrans@*/
  + memset(fd, 0, sizeof(*fd)); /* XXX trash and burn */
  + /*...@-refcounttrans@*/ fd = _free(fd); /*...@=refcounttrans@*/
  + yarnTwist(use, BY, -1);
  + use = yarnFreeLock(use);
  + return NULL;
  + }
  + yarnTwist(fd-use, BY, -1);
  + /*...@-refcounttrans -retal...@*/ return fd; /*...@=refcounttrans 
=retal...@*/
   }
   return NULL;
   }
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/ CHANGES rpm/rpmio/ Makefile.am rpmio.h rpmio_internal....

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 21:01:32
  Branch: HEAD Handle: 2009031220013101

  Modified files:
rpm CHANGES
rpm/rpmio   Makefile.am rpmio.h rpmio_internal.h rpmrpc.c
rpmzlog.h

  Log:
- jbj: rpmio: install rpmzlog.h and yarn.h, carry with rpmio.h.
- jbj: rpmio: don't include glob.h.

  Summary:
RevisionChanges Path
1.2815  +2  -0  rpm/CHANGES
1.214   +3  -3  rpm/rpmio/Makefile.am
1.82+7  -7  rpm/rpmio/rpmio.h
2.110   +0  -2  rpm/rpmio/rpmio_internal.h
2.86+4  -2  rpm/rpmio/rpmrpc.c
2.2 +3  -0  rpm/rpmio/rpmzlog.h
  

  patch -p0 '@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2814 -r1.2815 CHANGES
  --- rpm/CHANGES   12 Mar 2009 13:02:11 -  1.2814
  +++ rpm/CHANGES   12 Mar 2009 20:01:31 -  1.2815
  @@ -1,5 +1,7 @@
   
   5.2a3 - 5.2a4:
  +- jbj: rpmio: install rpmzlog.h and yarn.h, carry with rpmio.h.
  +- jbj: rpmio: don't include glob.h.
   - proyvind: add support for cpuinfo() probe through libcpuinfo.
   - proyvind: perl: make sure to link against all required libraries to fix
build with --no-undefined.
  @@ .
  patch -p0 '@@ .'
  Index: rpm/rpmio/Makefile.am
  
  $ cvs diff -u -r1.213 -r1.214 Makefile.am
  --- rpm/rpmio/Makefile.am 6 Mar 2009 20:37:25 -   1.213
  +++ rpm/rpmio/Makefile.am 12 Mar 2009 20:01:32 -  1.214
  @@ -57,7 +57,7 @@
$(RPMIO_LDADD_COMMON)
   
   pkgincdir = $(pkgincludedir)$(WITH_PATH_VERSIONED_SUFFIX)
  -pkginc_HEADERS = mire.h yarn.h \
  +pkginc_HEADERS = mire.h rpmzlog.h yarn.h \
rpmcb.h rpmio.h rpmlog.h rpmiotypes.h rpmmacro.h rpmpgp.h rpmsw.h
   noinst_HEADERS = \
argv.h ar.h cpio.h crc.h envvar.h fnmatch.h fts.h glob.h iosm.h \
  @@ -66,8 +66,8 @@
poptIO.h rpmbc.h rpmbz.h rpmdav.h \
rpmgc.h rpmhash.h rpmhook.h rpmio_internal.h rpmkeyring.h rpmku.h \
rpmlua.h rpmmg.h rpmnss.h rpmsq.h rpmssl.h \
  - rpmio-stub.h rpmurl.h rpmuuid.h rpmxar.h rpmz.h rpmzlog.h rpmzq.h \
  - tar.h ugid.h yarn.h
  + rpmio-stub.h rpmurl.h rpmuuid.h rpmxar.h rpmz.h rpmzq.h \
  + tar.h ugid.h
   
   usrlibdir = $(libdir)
   usrlib_LTLIBRARIES = librpmio.la
  @@ .
  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmio.h
  
  $ cvs diff -u -r1.81 -r1.82 rpmio.h
  --- rpm/rpmio/rpmio.h 21 Feb 2009 21:05:27 -  1.81
  +++ rpm/rpmio/rpmio.h 12 Mar 2009 20:01:32 -  1.82
  @@ -9,13 +9,13 @@
   #include sys/types.h
   #include sys/stat.h
   #include dirent.h
  -/*...@-noparams@*/
  -#include glob.h
  -/*...@=noparams@*/
   #include stdio.h
   #include stdlib.h
   #include unistd.h
   
  +#include rpmzlog.h
  +#include yarn.h
  +
   /** \ingroup rpmio
* Hide libio API lossage.
* The libio interface changed after glibc-2.1.3 to pass the seek offset
  @@ -433,16 +433,16 @@
*/
   int Glob(const char * pattern, int flags,
int errfunc(const char * epath, int eerrno),
  - /*...@out@*/ glob_t * pglob)
  + /*...@out@*/ void * _pglob)
/*...@globals fileSystem @*/
  - /*...@modifies *pglob, fileSystem @*/;
  + /*...@modifies *_pglob, fileSystem @*/;
   
   /**
* globfree(3) clone.
*/
  -void Globfree( /*...@only@*/ glob_t * pglob)
  +void Globfree( /*...@only@*/ void * _pglob)
/*...@globals fileSystem @*/
  - /*...@modifies *pglob, fileSystem @*/;
  + /*...@modifies *_pglob, fileSystem @*/;
   
   
   /**
  @@ .
  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmio_internal.h
  
  $ cvs diff -u -r2.109 -r2.110 rpmio_internal.h
  --- rpm/rpmio/rpmio_internal.h12 Mar 2009 18:21:26 -  2.109
  +++ rpm/rpmio/rpmio_internal.h12 Mar 2009 20:01:32 -  2.110
  @@ -15,8 +15,6 @@
   
   #include rpmxar.h
   
  -#include yarn.h
  -
   /** \ingroup rpmio
*/
   typedef struct _FDSTACK_s {
  @@ .
  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmrpc.c
  
  $ cvs diff -u -r2.85 -r2.86 rpmrpc.c
  --- rpm/rpmio/rpmrpc.c21 Feb 2009 21:05:27 -  2.85
  +++ rpm/rpmio/rpmrpc.c12 Mar 2009 20:01:32 -  2.86
  @@ -1830,8 

[CVS] RPM: rpm/ CHANGES rpm/lib/ rpmchecksig.c

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 21:10:39
  Branch: HEAD Handle: 2009031220103801

  Modified files:
rpm CHANGES
rpm/lib rpmchecksig.c

  Log:
- jbj: delete ancient header+payload RSA signatures too using GPG
(#488953).

  Summary:
RevisionChanges Path
1.2816  +1  -0  rpm/CHANGES
1.226   +2  -0  rpm/lib/rpmchecksig.c
  

  patch -p0 '@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2815 -r1.2816 CHANGES
  --- rpm/CHANGES   12 Mar 2009 20:01:31 -  1.2815
  +++ rpm/CHANGES   12 Mar 2009 20:10:38 -  1.2816
  @@ -1,5 +1,6 @@
   
   5.2a3 - 5.2a4:
  +- jbj: delete ancient header+payload RSA signatures too using GPG 
(#488953).
   - jbj: rpmio: install rpmzlog.h and yarn.h, carry with rpmio.h.
   - jbj: rpmio: don't include glob.h.
   - proyvind: add support for cpuinfo() probe through libcpuinfo.
  @@ .
  patch -p0 '@@ .'
  Index: rpm/lib/rpmchecksig.c
  
  $ cvs diff -u -r1.225 -r1.226 rpmchecksig.c
  --- rpm/lib/rpmchecksig.c 13 Dec 2008 20:34:57 -  1.225
  +++ rpm/lib/rpmchecksig.c 12 Mar 2009 20:10:39 -  1.226
  @@ -354,6 +354,8 @@
xx = headerDel(sigh, he, 0);
/*...@switchbreak@*/ break;
case RPMSIGTAG_GPG:
  + he-tag = (rpmTag)RPMSIGTAG_PGP;
  + xx = headerDel(sigh, he, 0);
he-tag = (rpmTag)RPMSIGTAG_DSA;
xx = headerDel(sigh, he, 0);
/*...@fallthrough@*/
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/rpmio/ rpmpigz.c

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 21:39:32
  Branch: HEAD Handle: 2009031220393200

  Modified files:
rpm/rpmio   rpmpigz.c

  Log:
- jbj: rpmz: don't access zq-_job drectly in rpmzGetHeader at all.
- jbj: rpmz: create zq-_job lazily later in in_init.

  Summary:
RevisionChanges Path
1.46+7  -10 rpm/rpmio/rpmpigz.c
  

  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmpigz.c
  
  $ cvs diff -u -r1.45 -r1.46 rpmpigz.c
  --- rpm/rpmio/rpmpigz.c   12 Mar 2009 17:07:32 -  1.45
  +++ rpm/rpmio/rpmpigz.c   12 Mar 2009 20:39:32 -  1.46
  @@ -1447,8 +1447,10 @@
   static void in_init(rpmzQueue zq)
/*...@modifies zq @*/
   {
  -rpmzJob job = zq-_job;
  -assert(job != NULL);
  +rpmzJob job;
  +if (zq-_job == NULL)
  + zq-_job = rpmzqNewJob(0);
  +job = zq-_job;
   job-seq = 0;
   job-more = 1;
   if (job-in != NULL) {
  @@ -1633,7 +1635,6 @@
/*...@globals fileSystem, internalState @*/
/*...@modifies zq, fileSystem, internalState @*/
   {
  -rpmzJob job = zq-_job;
   rpmzh zh = zq-_zh;
   unsigned magic; /* magic header */
   int method; /* compression method */
  @@ -1644,11 +1645,11 @@
   char * next;
   unsigned char _b[64], *b = _b;
   size_t nb = 0;
  +int rc;
   
   if (_debug)
   jobDebug( start, zq-_job);
   
  -assert(job != NULL);
   /* clear return information */
   if (save) {
zh-stamp = 0;
  @@ -1702,9 +1703,9 @@
   /*...@=mustfreeonly@*/
} else
next = _free(next);
  - rpmzReadExtra(zq, extra, save);
  + rc = rpmzReadExtra(zq, extra, save);
zq-format = (flags  8) ? RPMZ_FORMAT_ZIP3 : RPMZ_FORMAT_ZIP2;
  - return (!job-more) ? -3 : method;
  + return (rc == 0) ? method : -3;
   }
   if (magic != 0x1f8b)/* not gzip */
return -2;
  @@ -1910,8 +1911,6 @@
   if (_debug)
   jobDebug(  list, zq-_job);
   
  -assert(job != NULL);
  -assert(job-out == NULL);
   /* initialize input buffer */
   in_init(zq);
   
  @@ -2766,7 +2765,6 @@
if (zq-_job == NULL) { /* XXX zq-_job needs to exist. */
/* inflateBack() window is a function of windowBits */
size_t _out_len = (1  infWBits);
  - zq-_job = rpmzqNewJob(0);
if (zq-threads  1) {
if (zq-read_first == NULL)
zq-read_first = yarnNewLock(-1);
  @@ -2807,7 +2805,6 @@
if (zq-_job == NULL) { /* XXX zq-_job needs to exist. */
/* inflateBack() window is a function of windowBits */
size_t _out_len = (1  infWBits);
  - zq-_job = rpmzqNewJob(0);
if (zq-threads  1) {
if (zq-read_first == NULL)
zq-read_first = yarnNewLock(-1);
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/rpmio/ rpmpigz.c

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 21:47:44
  Branch: HEAD Handle: 2009031220474400

  Modified files:
rpm/rpmio   rpmpigz.c

  Log:
- jbj: rpmz: initialize load pools lazily when zq-_job is created.

  Summary:
RevisionChanges Path
1.47+12 -25 rpm/rpmio/rpmpigz.c
  

  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmpigz.c
  
  $ cvs diff -u -r1.46 -r1.47 rpmpigz.c
  --- rpm/rpmio/rpmpigz.c   12 Mar 2009 20:39:32 -  1.46
  +++ rpm/rpmio/rpmpigz.c   12 Mar 2009 20:47:44 -  1.47
  @@ -1448,8 +1448,19 @@
/*...@modifies zq @*/
   {
   rpmzJob job;
  -if (zq-_job == NULL)
  +if (zq-_job == NULL) {
  + /* inflateBack() window is a function of windowBits */
  + size_t _out_len = (1  infWBits);
  + if (zq-threads  1) {
  + if (zq-read_first == NULL)
  + zq-read_first = yarnNewLock(-1);
  + if (zq-load_ipool == NULL)
  + zq-load_ipool = rpmzqNewPool(zq-_in_buf_allocated, 
(zq-threads  1) + 2);
  + if (zq-load_opool == NULL) 
  + zq-load_opool = rpmzqNewPool(_out_len,  2);
  + }
zq-_job = rpmzqNewJob(0);
  +}
   job = zq-_job;
   job-seq = 0;
   job-more = 1;
  @@ -2762,18 +2773,6 @@
   assert(zh-hname == NULL);
   zh-hname = _free(zh-hname);
   if (zq-mode != RPMZ_MODE_COMPRESS) {
  - if (zq-_job == NULL) { /* XXX zq-_job needs to exist. */
  - /* inflateBack() window is a function of windowBits */
  - size_t _out_len = (1  infWBits);
  - if (zq-threads  1) {
  - if (zq-read_first == NULL)
  - zq-read_first = yarnNewLock(-1);
  - if (zq-load_ipool == NULL)
  - zq-load_ipool = rpmzqNewPool(zq-_in_buf_allocated, 
(zq-threads  1) + 2);
  - if (zq-load_opool == NULL) 
  - zq-load_opool = rpmzqNewPool(_out_len,  2);
  - }
  - }
in_init(zq);
method = rpmzGetHeader(zq, 1);
if (method != 8  method != 256) {
  @@ -2802,18 +2801,6 @@
   
   /* if requested, just list information about input file */
   if (F_ISSET(zq-flags, LIST)) {
  - if (zq-_job == NULL) { /* XXX zq-_job needs to exist. */
  - /* inflateBack() window is a function of windowBits */
  - size_t _out_len = (1  infWBits);
  - if (zq-threads  1) {
  - if (zq-read_first == NULL)
  - zq-read_first = yarnNewLock(-1);
  - if (zq-load_ipool == NULL)
  - zq-load_ipool = rpmzqNewPool(zq-_in_buf_allocated, 
(zq-threads  1) + 2);
  - if (zq-load_opool == NULL) 
  - zq-load_opool = rpmzqNewPool(_out_len,  2);
  - }
  - }
rpmzListInfo(zq);
goto exit;
   }
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/lib/ rpmds.c

2009-03-12 Thread Per �yvind Karlsen
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs   Email:  pkarl...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 22:34:28
  Branch: HEAD Handle: 2009031221342800

  Modified files:
rpm/lib rpmds.c

  Log:
remove comments about different naming, it's been made consistent now
:)

  Summary:
RevisionChanges Path
2.124   +0  -1  rpm/lib/rpmds.c
  

  patch -p0 '@@ .'
  Index: rpm/lib/rpmds.c
  
  $ cvs diff -u -r2.123 -r2.124 rpmds.c
  --- rpm/lib/rpmds.c   12 Mar 2009 17:39:47 -  2.123
  +++ rpm/lib/rpmds.c   12 Mar 2009 21:34:28 -  2.124
  @@ -1212,7 +1212,6 @@
if(feature == cpuinfo_feature_common_max)
feature = cpuinfo_feature_architecture;
if (cpuinfo_has_feature(cip, feature)) {
  - /* XXX: some mnemonics are currently different from /proc/cpuinfo's 
*/
const char *name = cpuinfo_string_of_feature(feature);
if (name)
rpmdsNSAdd(dsp, NS, name, , RPMSENSE_PROBE);
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/rpmio/ rpmpigz.c

2009-03-12 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 22:35:40
  Branch: HEAD Handle: 2009031221354000

  Modified files:
rpm/rpmio   rpmpigz.c

  Log:
- jbj: rpmz: tear down input buffers and job when exiting.
- jbj: rpmz: instantiate zq-_job in rpmzqPull.

  Summary:
RevisionChanges Path
1.48+8  -5  rpm/rpmio/rpmpigz.c
  

  patch -p0 '@@ .'
  Index: rpm/rpmio/rpmpigz.c
  
  $ cvs diff -u -r1.47 -r1.48 rpmpigz.c
  --- rpm/rpmio/rpmpigz.c   12 Mar 2009 20:47:44 -  1.47
  +++ rpm/rpmio/rpmpigz.c   12 Mar 2009 21:35:40 -  1.48
  @@ -1482,10 +1482,15 @@
/*...@null@*/ unsigned char *buf, size_t len)
/*...@modifies *buf @*/
   {
  -rpmzJob job = zq-_job;
  +rpmzJob job;
   size_t togo = len;
   size_t got = 0;
   
  +/* initialize input buffer */
  +if (zq-_job == NULL)
  + in_init(zq);
  +job = zq-_job;
  +
   assert(job != NULL);
   if (!job-more || (!(job-in  job-in-len)  load(zq) == 0))
return got;
  @@ -1922,9 +1927,6 @@
   if (_debug)
   jobDebug(  list, zq-_job);
   
  -/* initialize input buffer */
  -in_init(zq);
  -
   /* read header information and position input after header */
   method = rpmzGetHeader(zq, 1);
   if (method  0) {
  @@ -2361,6 +2363,8 @@
   if (ret != -1  (zq-format == RPMZ_FORMAT_GZIP || zq-format == 
RPMZ_FORMAT_ZLIB))
fprintf(stderr, %s OK, has trailing junk which was ignored\n, 
zq-ifn);
   
  +zq-_job-in = rpmzqDropSpace(zq-_job-in);
  +zq-_job = rpmzqDropJob(zq-_job);
   if (_debug)
   jobDebug(finish, zq-_job);
   }
  @@ -2773,7 +2777,6 @@
   assert(zh-hname == NULL);
   zh-hname = _free(zh-hname);
   if (zq-mode != RPMZ_MODE_COMPRESS) {
  - in_init(zq);
method = rpmzGetHeader(zq, 1);
if (method != 8  method != 256) {
if (method != -1  zq-verbosity  0)
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/lib/ rpmds.c

2009-03-12 Thread Per �yvind Karlsen
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs   Email:  pkarl...@rpm5.org
  Module: rpm  Date:   12-Mar-2009 23:56:53
  Branch: HEAD Handle: 2009031222565300

  Modified files:
rpm/lib rpmds.c

  Log:
practice snprintf nazi

  Summary:
RevisionChanges Path
2.126   +2  -1  rpm/lib/rpmds.c
  

  patch -p0 '@@ .'
  Index: rpm/lib/rpmds.c
  
  $ cvs diff -u -r2.125 -r2.126 rpmds.c
  --- rpm/lib/rpmds.c   12 Mar 2009 22:28:12 -  2.125
  +++ rpm/lib/rpmds.c   12 Mar 2009 22:56:53 -  2.126
  @@ -1209,7 +1209,8 @@
   cpuinfo_feature_t feature;
   
   char mhz[20];
  -sprintf(mhz, %d, cpuinfo_get_frequency(cip));
  +snprintf(mhz, 19, %d, cpuinfo_get_frequency(cip));
  +mhz[19] = '\0';
   rpmdsNSAdd(dsp, NS, cpu_MHz, mhz, RPMSENSE_PROBE|RPMSENSE_EQUAL);
   
   for (feature = cpuinfo_feature_common; feature != 
cpuinfo_feature_architecture_max; feature++) {
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org