Not everyone is linking shared libraries to libc
It seems not everyone is linking their libraries to libc, which is
needed (see policy section 9.2.2 for details). I wrote a little tool to
check if libraries are linked to libc and on my system it reports:
/lib/ld.so is not linked to libc
/lib/ld.so.1.9.11 is not linked to libc
/lib/libc.so.5.4.46 is not linked to libc
/lib/libm.so.5.0.9 is not linked to libc
/lib/ld-2.2.2.so is not linked to libc
/lib/libcap.so.1.10 is not linked to libc
/lib/libc-2.2.2.so is not linked to libc
/lib/ld-linux.so.1.9.11 is not linked to libc
objdump: /usr/lib/libc.so: File format not recognized
/usr/lib/libc.so is not linked to libc
/usr/lib/libplc4.so is not linked to libc
/usr/lib/libplds4.so is not linked to libc
Most of there belong to libc and are not a problem, except for libcap,
libplc4 and libplds4. I'll file bugs on these.
Can people please run the attached script on their system and see if it
finds more broken packages on their system?
Wichert.
--
_________________________________________________________________
/ Nothing is fool-proof to a sufficiently talented fool \
| wichert@cistron.nl http://www.liacs.nl/~wichert/ |
| 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0 2805 3CB8 9250 2FA3 BC2D |
#! /usr/bin/python
#
import os,re,string,stat
libdirs = [ "/lib", "/usr/lib" ]
def filterChild(command, regexp):
"Run a command and return the regexp matches."
# Run the command and grab its output
fd=os.popen(command)
output=string.split(fd.read(), '\n')
fd.close()
# Extract the matches text
lst=[]
matcher=re.compile(regexp)
for line in output:
mo=matcher.search(line)
if mo:
lst.append(mo.groups())
return lst
def scanlibsObjdump(exe):
"Use objdump to determine the shared libraries a binary uses."
return map(lambda x: x[0], filterChild(("objdump -p %s" % exe), "^\s+NEEDED\s+(.+)$"))
def seqAdd(file, seq):
"Add the contents of a file to a seqeuence."
fd=open(file, 'r')
map(lambda x,y=seq: y.append(x), string.split(fd.read(), '\n'))
def isLib(file):
'''Check if a file is a possible shared library. Not highly advanced,
but good enough for this purpose.'''
if not stat.S_ISREG(os.lstat(file)[stat.ST_MODE]):
return 0
if not re.search("/lib.+\.so.*", file):
return 0
return 1
def checkLib(file):
"Check if a library is linked to libc."
libs=scanlibsObjdump(file)
for i in libs:
if re.match("^lib.*\.so\.", i):
return 1
return 0
# Add more directories to the list of directories to scan
seqAdd("/etc/ld.so.conf", libdirs)
for dir in libdirs:
try:
files=os.listdir(dir)
except OSError:
continue
files=map(lambda x,y=dir: "%s/%s" % (y,x), files)
files=filter(isLib, files)
for f in files:
if not checkLib(f):
print f + " is not linked to libc"
Reply to: