From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20020104 Description of problem: rpm segfaults when trying unpack files with ownership of a user which is in LDAP. If I change the ownership (using %defattr or %attr) everything works fine. It will also segfault if the user doesn't exist. I've created 3 test cases, the first and third will segfault, the second won't. Version-Release number of selected component (if applicable): monaco:~# rpm -q rpm rpm-4.0.3-1.03 How reproducible: Always Steps to Reproduce: 1. Setup system to use LDAP as directory service 2. Rebuild testcase RPM's 3. Try installing them :) Actual Results: monaco:~# rpm -i ~jerdfelt/build/RPMS/i386/test-0.1-1.i386.rpm zsh: segmentation fault (core dumped) rpm -i /home/jerdfelt/build/RPMS/i386/test-0.1-1.i386.rpm monaco:~# rpm -i ~jerdfelt/build/RPMS/i386/test3-0.1-1.i386.rpm zsh: segmentation fault (core dumped) rpm -i /home/jerdfelt/build/RPMS/i386/test3-0.1-1.i386.rpm Expected Results: monaco:~# rpm -i ~jerdfelt/build/RPMS/i386/test2-0.1-1.i386.rpm monaco:~# rpm -e test2 Additional info: If LDAP is *not* configured on the server, everything works as expected: daytona:~# rpm -i ~jerdfelt/test3-0.1-1.i386.rpm user nonexist does not exist - using root group nonexist does not exist - using root
Created attachment 45343 [details] Test case 1. User exists in LDAP. Segfault is result
Created attachment 45344 [details] Testcase 2. User exists in /etc/passwd. Everything is fine
Created attachment 45345 [details] Testcase 3. User doesn't exist anywhere. Segfault
There's a linkage loop deep in PAM LDAP modules that affects only statically linked executables like rpm. The voo-doo fix is to run nscd (which changes the manner in which LDAP is linked).
The nscd "trick" doesn't always work: 5334 kanga(pts/0):[~]# /etc/rc.d/init.d/nscd status nscd (pid 27000 26999 26998 26997 26996 26995 26992) is running... 5335 kanga(pts/0):[~]# rpm -Uhvv ~matt/scratch/tcm-dynmotif-2.01-1.i386.rpm D: ============== /home/matt/scratch/tcm-dynmotif-2.01-1.i386.rpm D: Expected size: 2911046 = lead(96)+sigs(68)+pad(4)+data(2910878) D: Actual size: 2911046 D: opening db environment /var/lib/rpm/Packages create:mpool D: opening db index /var/lib/rpm/Packages create mode=0x42 D: locked db index /var/lib/rpm/Packages D: opening db index /var/lib/rpm/Name create mode=0x42 D: added binary package [0] D: found 0 source and 1 binary packages D: ========== +++ tcm-dynmotif-2.01-1 D: opening db index /var/lib/rpm/Depends create mode=0x42 D: opening db index /var/lib/rpm/Basenames create mode=0x42 D: Requires: /bin/sh YES (db files) D: opening db index /var/lib/rpm/Providename create mode=0x42 D: Requires: ld-linux.so.2 YES (db provides) D: Requires: libc.so.6 YES (db provides) D: Requires: libICE.so.6 YES (db provides) D: Requires: libm.so.6 YES (db provides) D: Requires: libSM.so.6 YES (db provides) D: Requires: libstdc++-libc6.1-1.so.2 YES (db provides) D: Requires: libX11.so.6 YES (db provides) D: Requires: libXext.so.6 YES (db provides) D: Requires: libXm.so.1 YES (db provides) D: Requires: libXt.so.6 YES (db provides) D: Requires: /usr/bin/perl YES (db files) D: Requires: libc.so.6(GLIBC_2.0) YES (db provides) D: Requires: libc.so.6(GLIBC_2.1) YES (db provides) D: Requires: libm.so.6(GLIBC_2.1) YES (db provides) D: opening db index /var/lib/rpm/Conflictname create mode=0x42 D: closed db index /var/lib/rpm/Depends D: ========== recording tsort relations D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth) D: 0 0 1 0 0 tcm-dynmotif-2.01-1 D: installing binary packages Preparing... ########################################### [100%] D: Expected size: 2911046 = lead(96)+sigs(68)+pad(4)+data(2910878) D: Actual size: 2911046 D: install: tcm-dynmotif-2.01-1 has 354 files, test = 0 D: install: running %pre script(s) (if any) zsh: segmentation fault rpm -Uhvv ~matt/scratch/tcm-dynmotif-2.01-1.i386.rpm 5336 kanga(pts/0):[~]# /etc/rc.d/init.d/nscd status nscd (pid 27000 26999 26998 26997 26996 26995 26992) is running... 5337 kanga(pts/0):[~]# uname -a Linux kanga.priv.bogosian.net 2.4.18-10 #1 Wed Aug 7 11:39:21 EDT 2002 i686 unknown I'm running RedHat 7.3. This is *REALLY* frustrating. Here's the test RPM: http://wwwhome.cs.utwente.nl/~tcm/software.html ftp://ftp.cs.utwente.nl/pub/tcm/tcm-dynmotif-2.01-1.i386.rpm Incidentally, this also happens with the RedHat-distributed apache-*.rpm files as well.
Incidentally, I tried this again after doing an 'rpm --rebuilddb' and it still results in the same behavior.
FWIW, I can install the package w/o segfaulting, but then I don't use LDAP. Yes, --rebuilddb won't help or hurt, the problem is not in rpm. You can always change your packaging to use root rather than tcm. Equivalently, you can use a lookup other than LDAP for the user tcm.