RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm-4_5: rpm/scripts/ rpm2cpio

From: Arkadiusz Miskiewicz <arekm@rpm5.org>
Date: Sun 10 Jun 2007 - 21:46:35 CEST
Message-Id: <200706102146.35483.arekm@rpm5.org>
On Sunday 10 of June 2007, Ralf S. Engelschall wrote:

> As long as all of this just has to run under Linux flavors (where
> /bin/sh is usually GNU bash and where echo(1) supports the escaping
> options -e), everything is fine. If it should run on non-Linux Unix
> platforms then you additionally should replace  with  and the
> "echo -e" perhaps with an awk(1) (or similar portable enough) approach.
> So, for maximum portability I recommend the following adjustment:
>

> -gz="-en \037\0213"
> +gz="00"
>  case "" in
>      BZh)      dd if="" ibs= skip=1 2>/dev/null | bunzip2 ;;
>      ""*)   dd if="" ibs= skip=1 2>/dev/null | gunzip ;;

Fine with me, commit please.

> Additionally, It think the fallback assumption should be better
> "uncompressed" payload than LZMA compressed payload, shouldn't it? So,
> perhaps it would be even better to apply:

>  case "" in
>      BZh)      dd if="" ibs= skip=1 2>/dev/null | bunzip2 ;;
>      ""*)   dd if="" ibs= skip=1 2>/dev/null | gunzip ;;
> -    # no magic in old lzma format, if unknown we assume that's lzma for
> now -    *)        dd if="" ibs= skip=1 2>/dev/null | lzma d -si -so
> ;; -    #*)        echo "Unrecognized rpm file: "; return 1 ;;
> +    *)        dd if="" ibs= skip=1 2>/dev/null ;;
>  esac

lzma d decompresses stream and the whole script needs to output cpio format or 
fail. Your change is wrong - it outputs compressed stream by default (if 
format is not bzip/gzip).

>                                        Ralf S. Engelschall

-- 
Arkadiusz Mi¶kiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/
Received on Sun Jun 10 22:13:57 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.