RPM Community Forums

Mailing List Message of <rpm-users>

Re: Glibc %post

From: Jeff Johnson <n3npq@mac.com>
Date: Sat 19 Jun 2010 - 01:10:52 CEST
Message-id: <C7B07801-2548-44A5-93BD-257721C81DA3@mac.com>

On Jun 18, 2010, at 5:33 PM, Eric MSP Veith wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello List, again,
> 
> On Sunday 09 May 2010, Eric MSP Veith <eveith@wwweb-library.net> wrote:
>> is there a good and clean way of upgrading glibc on a running system via
>> RPM?
> 
> The solution with rpm5 is very simple.
> 
> - ---%<---
> %post -p <lua>
> os.execute("/sbin/ldconfig")
> - --->%---
> 

Oooh, nicely done! That's so much easier than the
insanity within the statically linked glibc %post
that is traditionally used.

FWIW, all scriptlet bodies are macro expanded so this SHOULD work:
- ---%<---
%post -p <lua>
os.execute("%{__ldconfig}")
- --->%---

> If one has %{__ldconfig} and wants to use it, it's as simple as adding 
> another rpm.expand call.
> 

If the above doesn't work, its only because I've never bothered to
macro expand embedded interpreter scriptlets.
Which is like 5-10 lines of code.

> This works even with broken pre-installed glibc packages. It's very simple 
> to avoid all pitfalls as soon as one knows what the problem is. The critical 
> moment is the switching-over of the links. The %post scriptlet has to run 
> completely from memory, otherwise it'll segfault. That's why using a normal 
> scriptlet with /bin/bash doesn't work. As long as the ABI is compatible, a 
> Lua script does the trick. I haven't tested with embedded Ruby or Perl 
> because Lua did the job just fine.
> 

Well, that assumes that RPM is statically linked, otherwise RPM
is as doomed as every other dynamically linked executable when glibc
gets messed up.

> This never worked with slackware because Pat designed his pkgtools to remove 
> an old package *before* installing a new one. Granted, this aleviates the 
> programmer of a lot of problems, but it'll introduce headaches later on. 
> Have a look at the install scripts for Slackware's glibc package...
> 

Yes, that's why RPM does install-before-erase (and also undertakes installing
to a tempfile that is rename'd into place).

There's still racy windows, but the windows are far far smaller than
with remove-before-erase.

>> P. S. For @rpm5, I'm still maintaining my todo list (i.e., rpm5 make
>> check on Arch Linux, more docs and web site twiddeling), but won't get
>> to work on it for at least two weaks, just to let you know. Work has
>> been raining on me like hell the last days, so it'll be stalled. Sorry.
> 
> I'm slowly comming back on-line now that things have calmed. Need to get up 
> to date. Heh, and I need some thumbs squeezed because my thesis is done, 
> too. Hope it'll be a good one. :-)
> 

Congrats seem to be in order. Congrats!

73 de Jeff
> 			Eric
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> 
> iEYEARECAAYFAkwb5h4ACgkQhS0drJ3goJJ0rQCdHORPYB4PnzCMJjk14ux29T5N
> fTkAn3rkA1mMmfcbw37pkxZPkN0NmMNn
> =kr8k
> -----END PGP SIGNATURE-----
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> User Communication List                             rpm-users@rpm5.org
Received on Sat Jun 19 01:11:27 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.