[Rpm-maint] broken filetriggers implementation when using a chroot

Thierry Vignaud thierry.vignaud at gmail.com
Wed Jan 6 11:42:27 UTC 2016


Hi

Sadly, the current filetriggers doesn't honour rpm's chroot.
Thus it works fine with our rpm front-end (urpmi which is like yum/dns
for FC) for online updates.

But not with our installer (Drakx) which installs packages in a chroot
(like Anaconda does for FC)
See https://bugs.mageia.org/show_bug.cgi?id=17217
And urpmi can reproduce this too when using a chroot:

Example: we've a ldconfig file trigger in glibc package:

$ rpm -q --filetriggers glibc
transfiletriggerin scriptlet (using /bin/sh) -- /lib/, /lib64/
grep -F '.so.' | ldconfig -X
transfiletriggerin scriptlet (using /bin/sh) -- /etc/ld.so.conf.d/
ldconfig -X


Let's test in a chroot with and without /sbin/ldconfig out of the chroot:
mkdir TL2
mv /sbin/ldconfig{,.tv}; urpmi --no-recommends --root TL2
basesystem-minimal 2>&1|tee LOG.chroot2
mkdir TL1
mv /sbin/ldconfig{.tv,}; urpmi --no-recommends --root TL1
basesystem-minimal 2>&1|tee LOG.chroot1
diff -u LOG.chroot?|grep -1 ldconfig >ldconf.diff

I've attached the resulting diff: you can see that when the program
used by the filetrigger doesn't exist _OUT_ of the chroot (whereas it
does exists _in_ the chroot), we got failures:

+   28/166: lib64archive13        #############################################
+/var/tmp/rpm-tmp.Czkj2B: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed,
exit status 127
--
+   36/166: lib64cap2             #############################################
+/var/tmp/rpm-tmp.UNaOEz: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed,
exit status 127

BTW, the error message is slightly misleading.
"%filetriggerin" would be better instead of "%triggerin"


Same way, if I install in a chroot but remove ldconfig right after the
transaction where glibc was installed, there's not failed ldconfig
calls...

Checking with strace when installing in /rpm/TL3 chroot:

$ egrep 'chroot|ldconfig' LOG
(...)
chroot("/root/TL3/")                    = 0
chroot(".")                             = 0
write(31, "grep -F '.so.' | ldconfig -X", 28) = 28
[pid  3783] read(3, "grep -F '.so.' | ldconfig -X", 80) = 28
[pid  3783] read(255, "grep -F '.so.' | ldconfig -X", 28) = 28
[pid  3785] stat("/sbin/ldconfig", {st_mode=S_IFREG|0755,
st_size=939032, ...}) = 0
[pid  3785] stat("/sbin/ldconfig",  <unfinished ...>
[pid  3785] access("/sbin/ldconfig", X_OK <unfinished ...>
[pid  3785] stat("/sbin/ldconfig",  <unfinished ...>
[pid  3785] access("/sbin/ldconfig", R_OK <unfinished ...>
[pid  3785] stat("/sbin/ldconfig",  <unfinished ...>
[pid  3785] stat("/sbin/ldconfig",  <unfinished ...>
[pid  3785] access("/sbin/ldconfig", X_OK <unfinished ...>
[pid  3785] stat("/sbin/ldconfig",  <unfinished ...>
[pid  3785] access("/sbin/ldconfig", R_OK <unfinished ...>
[pid  3785] execve("/sbin/ldconfig", ["ldconfig", "-X"], [/* 41 vars
*/] <unfinished ...>
(...)

=> indeed we left the chroot _before_ running the filetriggers...

So rpm calls ldconfig from outside the chroot instead of in the choot
(unlike old regular triggers or %pre/%post/... scriptlets) which
breaks DVD installer...

Those do get called in the chroot. eg:

$ egrep 'chroot|execve' LOG|grep -v curl
(...)
chroot("/root/TL3/")                    = 0
[pid  3782] execve("/bin/sh", ["/bin/sh", "/var/tmp/rpm-tmp.iv2rlk",
"1"], [/* 42 vars */]) = 0
chroot(".")                             = 0

Can you suggest a fix?

Thanks
-------------- next part --------------
+   28/166: lib64archive13        #############################################
+/var/tmp/rpm-tmp.Czkj2B: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed, exit status 127
--
+   36/166: lib64cap2             #############################################
+/var/tmp/rpm-tmp.UNaOEz: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed, exit status 127
--
+   44/166: lib64gmp10            #############################################
+/var/tmp/rpm-tmp.hWL3YH: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed, exit status 127
--
+   52/166: lib64cap-ng0          #############################################
+/var/tmp/rpm-tmp.Q7gwjb: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed, exit status 127
--
+   60/166: lib64pam_userpass1    #############################################
+/var/tmp/rpm-tmp.IoeveR: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed, exit status 127
--
+   76/166: perl-MDK-Common       #############################################
+/var/tmp/rpm-tmp.kzFdPg: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed, exit status 127
--
+  130/166: initscripts           #############################################
+/var/tmp/rpm-tmp.9kxUv9: line 1: ldconfig: command not found
+warning: %triggerin(glibc-6:2.22-13.mga6.x86_64) scriptlet failed, exit status 127


More information about the Rpm-maint mailing list