[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: RFE: rpm2cpio should not need db3



On Tue, Jan 08, 2002 at 09:03:13AM -0600, Chris Adams wrote:
> Once upon a time, Jeff Johnson <jbj@JBJ.ORG> said:
> > On Mon, Jan 07, 2002 at 08:34:19PM -0600, Chris Adams wrote:
> > > Once upon a time, Jeff Johnson <jbj@JBJ.ORG> said:
> > > > So use the attached shell script <shrug>
> > > 
> > > The shell script doesn't work on packages I create on Tru64 Unix 5.1A
> > > with rpm 4.0.3 (but the "real" rpm2cpio does).
> > 
> > Hmmm ...
> > 
> > I don't believe this. /usr/bin/rpm2cpio does nothing that rpm2cpio.sh
> > does not do, certainly nothing wrto the payload contents.
> > 
> > I'm perfectly willing to believe that od on Tru64 has not the funky options
> > needed by rpm2cpio.sh. I'm just not willing to believe that cpio crc format
> > is changed by /usr/bin/rpm2cpio on Tru64.
> 
> I can use rpm2cpio.sh on Tru64 to decode packages built on x86 (or even
> built on Linux/Alpha), but not packages built on Tru64.  I can copy a
> Tru64 RPM over to a Linux/x86 box, and rpm2cpio.sh still does not work
> while rpm2cpio(.c) does.
> 
> I can provide a sample package if you'd like.

Ah yes, the modulo arithmetic with expr(1) to calculate the signature
padding was buggy.

Here's the patch:

- o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \% 8 \) + 8`
+ o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`

and here's the full rpm2cpio.sh script again
===========================================================================
#!/bin/sh

pkg=$1

leadsize=96
o=`expr $leadsize + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "sig il: $il dl: $dl"

sigsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "hdr il: $il dl: $dl"

hdrsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $hdrsize`

dd if=$pkg ibs=1 skip=$o | gunzip
===========================================================================

Thanks for the report.

73 de Jeff

-- 
Jeff Johnson	ARS N3NPQ
jbj@jbj.org	(jbj@redhat.com)
Chapel Hill, NC





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []