Running ldconfig in RPM %post scripts

I tripped over this today.

I had a RPM file that included a run of /sbin/ldconfig in its %post section. This has been fine for months.

And then it wasn't fine any more. Someone did a downgrade.

The trouble here is that %post is run before the now unused files from the outgoing package are removed.

To illustrate the trouble this can cause, consider this scenario. Package foo-1.2 includes libfoo.so.1.2.. This is referenced as libfoo.so.1.

All fine and normal so far. But in foo-1.3, the library is updated to libfoo.so.1.3. Install foo-1.3, and the library is updated and everything works.

Now downgrade back to foo-1.2. foo-1.2 is installed, its contents unpacked, and its %post runs ldconfig. Because the old files are not removed, ldconfig creates libfoo.so.1 as pointing to the latest actual library, which at this stage is still libfoo.so.1.3. %post completes, and the outgoing package files are then deleted and its %postun run. Suddenly that libfoo.so.1 link is dangling.

The only solution I've found so far is to also run ldconfig in the outgoing package %postun section.

 
ldconfigandrpm.txt · Last modified: 2012/02/16 17:09 by jim
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0