Subject: Re: [vserver] Yum-patch problem
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Tue, 29 Mar 2011 01:55:03 +0200

On Mon, Mar 28, 2011 at 11:05:15PM +0000, Liu, Xuan (UMKC-Student) wrote:
> Hi all,

> I'm newbie to linux vserver. I'm building a new MyPLC server,
> which requires to build guest system first.

> I have installed CentOS 5.5 and installed vserver-enabled
> kernel, which is 2.6.32-71.18.2.el6.vs2.3.0.36.29.6.10.i686

> Then I have to patch yum because I got errors saying when
> running vtest-init-vserver.sh :

> You are using a version of yum which is insecure and broken in
> chroot related operations; either apply the patches shipped in
> the 'contrib/' directory of util-vserver, or ask the author of
> yum to apply them (preferred).

> In the meantime, 'vyum' will continue with dirty hacks which
> might not work when the vserver is running and local DOS
> attacks are possible.

> Execution will continue in 5 seconds...

> Therefore, I followed the steps described in 
> http://linux-vserver.org/Yum-patch, everything went well 
> until I run rpmbuild -ba yum.spec:

> [root@control-1 yum-chroot]# rpmbuild -ba yum.spec
> Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.65899
> + umask 022
> + cd /usr/src/redhat/BUILD
> + cd /usr/src/redhat/BUILD
> + rm -rf yum-3.2.22
> + /bin/gzip -dc /usr/src/redhat/SOURCES/yum-3.2.22.tar.gz
> + tar -xf -
> + STATUS=0
> + '[' 0 -ne 0 ']'
> + cd yum-3.2.22
> ++ /usr/bin/id -u
> + '[' 0 = 0 ']'
> + /bin/chown -Rhf root .
> ++ /usr/bin/id -u
> + '[' 0 = 0 ']'
> + /bin/chgrp -Rhf root .
> + /bin/chmod -Rf a+rX,u+w,g-w,o-w .
> + echo 'Patch #0 (installonlyn-enable.patch):'
> Patch #0 (installonlyn-enable.patch):
> + patch -p1 --fuzz=2 -s
> + echo 'Patch #1 (yum-mirror-priority.patch):'
> Patch #1 (yum-mirror-priority.patch):
> + patch -p1 --fuzz=2 -s
> + echo 'Patch #2 (yum-manpage-files.patch):'
> Patch #2 (yum-manpage-files.patch):
> + patch -p1 --fuzz=2 -s
> + echo 'Patch #3 (yum-ia64-multilib.patch):'
> Patch #3 (yum-ia64-multilib.patch):
> + patch -p1 --fuzz=2 -s
> + echo 'Patch #4 (yum-3.2.22-chroot.patch):'
> Patch #4 (yum-3.2.22-chroot.patch):
> + patch -p1 --fuzz=2 -s
> 1 out of 2 hunks FAILED -- saving rejects to file cli.py.rej
> 1 out of 3 hunks FAILED -- saving rejects to file yum/config.py.rej

this suggests that the patch conflicts with one of the other
patches above, you should try to adapt the patch to the
prepatched yum and then use that one instead ...

> error: Bad exit status from /var/tmp/rpm-tmp.65899 (%prep)

> RPM build errors:
>     Bad exit status from /var/tmp/rpm-tmp.65899 (%prep)
> [root@control-1 yum-chroot]#
> 
> Below is more details about my system:
> [root@control-1 yum-chroot]# yum --version
> 3.2.22
>   Installed: rpm-4.4.2.3-20.el5_5.1.i386 at 2011-03-28 15:02
>   Built    : [] at 2010-09-08 15:11
>   Committed: Jindrich Novy <jnovy@redhat.com<mailto:jnovy@redhat.com>> at 2010-08-30
22:00
>   Installed: yum-3.2.22-26.noarch at 2011-03-28 19:41
>   Built    : [] at 2011-03-28 18:55
>   Committed: Karanbir Singh <kbsingh@centos.org<mailto:kbsingh@centos.org>> at 2010-04-05
00:00
>   Installed: yum-metadata-parser-1.1.2-3.el5.centos.i386 at 2011-03-27 18:31
>   Built    : [] at 2009-08-27 16:20
>   Committed: James Antill <james.antill@redhat.com<mailto:james.antill@redhat.com>>
at 2009-04-06 22:00
> I have downloaded yum patch and corresponding source rpm:
> [root@control-1 SOURCES]# ls -al yum-3.2.22-chroot.patch
> -rw-r--r-- 1 mockbuild mockbuild 5188 Nov  6  2009 yum-3.2.22-chroot.patch
> [root@control-1 yum-chroot]# ls
> yum-3.2.22-26.el5.centos.src.rpm  yum.spec

> And I added two lines in yum.spec
> Patch4: yum-3.2.22-chroot.patch
> %patch4 -p1
> I have searched around, but couldn't find a good solution.
> Can anyone please give a hint or suggestion? 

check what are the failing hunks (i.e. apply it and chec
the .rej files), then try to add those changes manually,
once that works, create a new patch with the newly created
changes and use that to build the rpm

HTH,
Herbert

> If you need more information, please let me know.

> Thanks,

> Xuan Liu
> Department of Computer Science & Electrical Engineering
> University of Missouri - Kansas city
> xl9f2@mail.umkc.edu<mailto:xl9f2@mail.umkc.edu>
>