Hi, there is a problem with the /etc/init.d/xmail file, it fails to copy lib
files if they are listed in a specific way. I found this out after upgrading my
glibc version and xmail segfaulting. I traced it down to an outdated
ld-linux.so.2 in my /chroot/xmail/lib . This is caused by the sed filter from
the init file that fails to copy the file. The output of ldd
/var/MailRoot/bin/XMail:
linux-gate.so.1 => (0xffffe000)
libdl.so.2 => /lib/libdl.so.2 (0xb7fd0000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7f7d000)
libstdc++.so.5 =>
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libstdc++.so.5 (0xb7eb1000)
libm.so.6 => /lib/libm.so.6 (0xb7e8c000)
libgcc_s.so.1 =>
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libgcc_s.so.1 (0xb7e83000)
libc.so.6 => /lib/libc.so.6 (0xb7d57000)
/lib/ld-linux.so.2 (0xb7fea000)
After applying the sed filter -n 's/[[:blank:]]*[^=]*=>\([^(]*\).*/\1/p', these
files be copied to the chrooted lib directory:
/lib/libdl.so.2
/lib/libpthread.so.0
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libstdc++.so.5
/lib/libm.so.6
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libgcc_s.so.1
/lib/libc.so.6
Clearly the ld-linux.so.2 library is missing. This is caused by the requirement
that a line should contain a =>. This problem is solvable by using a slightly
modified sed filter. Using sed -n 's/[[:blank:]]*\([^=]*\=>\)\? \([^(]*\)
.*/\2/p;' the output will be:
/lib/libdl.so.2
/lib/libpthread.so.0
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libstdc++.so.5
/lib/libm.so.6
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libgcc_s.so.1
/lib/libc.so.6
/lib/ld-linux.so.2
which is correct for my system. This script might break things if the ldd
output lines without a => can contain weird stuff, I can't say because I'm no
ldd expert.
Reproducible: Always
Steps to Reproduce:
1. Upgrading glibc
2. starting the chrooted version of xmail using /etc/init.d/xmail start
Actual Results:
XMail will not start because of a segmentation fault
Expected Results:
XMail should have started
Fix supplied, needs verification concerning the ldd output
The fixed sed filter shouldn't contain a newline in it.
Patchfile (-Naur) for the fixed init.d/xmail file:
--- /usr/portage/mail-mta/xmail/files/xmail.initd 2004-07-15 01:05:55.000000000 +0200
+++ /etc/init.d/xmail 2005-05-02 11:58:11.000000000 +0200
@@ -70,7 +70,7 @@
chown -R xmail:xmail ${CHROOT}
cp `ldd ${CHROOT}${MAIL_ROOT}/bin/XMail |\
- sed -n 's/[[:blank:]]*[^=]*=>\([^(]*\).*/\1/p'` ${CHROOT}/lib/
+ sed -n 's/[[:blank:]]*\([^=]*\=>\)\? \([^(]*\).*/\2/p;'` ${CHROOT}/lib/
start-stop-daemon --start -c xmail -r ${CHROOT} \
--startas ${MAIL_EXEC} --pidfile=${MAIL_PID} -- \
${MAIL_CMD_LINE}