calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / bin / check-elf-dynamic-objects
blob133f58d34ddaffc377467caff771de46255e0d4f
1 #!/usr/bin/env bash
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # verify that ELF NEEDED entries are known-good so hopefully builds run on
11 # lots of different GNU/Linux distributions
13 set -euo pipefail
15 PARA=1
16 check_path="${INSTDIR:-.}"
18 help()
20 cat << "EOF"
21 -d <dir> directory to check
22 -p run unbound parallel checks
23 -h help
24 EOF
25 [ -z "${1:-}" ] && exit 0
28 die()
30 echo "$1"
31 echo
32 help 1
33 exit 1
36 while [ "${1:-}" != "" ]; do
37 parm=${1%%=*}
38 arg=${1#*=}
39 has_arg=
40 if [ "${1}" != "${parm?}" ] ; then
41 has_arg=1
42 else
43 arg=""
46 case "${parm}" in
47 --dir|-d)
48 if [ "$has_arg" ] ; then
49 check_path="$arg"
50 else
51 shift
52 check_path="$1"
54 if [ ! -d "$check_path" ]; then
55 die "Invalid directory '$check_path'"
58 -h)
59 help
61 -p)
62 # this sounds counter intuitive but the idea
63 # is to possibly support -p <n>
64 # in the meantime: 0 = nolimit and -p 1 would mean
65 # the current default: serialize
66 PARA=0
68 -*)
69 die "Invalid option $1"
72 if [ "$DO_NEW" = 1 ] ; then
73 REPO="$1"
74 else
75 die "Invalid argument $1"
78 esac
79 shift
80 done
83 files=$(find "${check_path}/program" "${check_path}/sdk/bin" -type f)
84 # all RPATHs should point to ${INSTDIR}/program so that's the files they find
85 programfiles=$(echo ${files} | grep -o '/program/[^/]* ' | xargs -n 1 basename)
87 # allowlists should contain only system libraries that have a good reputation
88 # of maintaining ABI stability
89 # allow extending the allowlist using the environment variable to be able to work
90 # on the installer stuff without the need for a baseline setup
91 globalallowlist="ld-linux-x86-64.so.2 ld-linux.so.2 libc.so.6 libm.so.6 libdl.so.2 libpthread.so.0 librt.so.1 libutil.so.1 libnsl.so.1 libcrypt.so.1 libgcc_s.so.1 libstdc++.so.6 libz.so.1 libfontconfig.so.1 libfreetype.so.6 libxml2.so.2 libxslt.so.1 libexslt.so.0 libnspr4.so libnss3.so libnssutil3.so libplc4.so libplds4.so libsmime3.so libssl3.so ${LO_ELFCHECK_ALLOWLIST-}"
92 x11allowlist="libX11.so.6 libX11-xcb.so.1 libXext.so.6 libSM.so.6 libICE.so.6 libXinerama.so.1 libXrender.so.1 libXrandr.so.2 libcairo.so.2"
93 openglallowlist="libGL.so.1"
94 gobjectallowlist="libgobject-2.0.so.0 libglib-2.0.so.0"
95 gdbusallowlist="libdbus-glib-1.so.2 libdbus-1.so.3 libgmodule-2.0.so.0 libgthread-2.0.so.0 ${gobjectallowlist}"
96 gioallowlist="libgio-2.0.so.0 ${gdbusallowlist}"
97 gstreamerallowlist="libgsttag-1.0.so.0 libgstaudio-1.0.so.0 libgstpbutils-1.0.so.0 libgstvideo-1.0.so.0 libgstbase-1.0.so.0 libgstreamer-1.0.so.0 ${gobjectallowlist}"
98 gtk3allowlist="libgtk-3.so.0 libgdk-3.so.0 libcairo-gobject.so.2 libpangocairo-1.0.so.0 libfribidi.so.0 libatk-1.0.so.0 libcairo.so.2 libpangoft2-1.0.so.0 libpango-1.0.so.0 libfontconfig.so.1 libfreetype.so.6 libgdk_pixbuf-2.0.so.0 libharfbuzz.so.0 ${gioallowlist}"
99 gtk4allowlist="libgtk-4.so.1 libcairo-gobject.so.2 libpangocairo-1.0.so.0 libatk-1.0.so.0 libcairo.so.2 libpango-1.0.so.0 libgdk_pixbuf-2.0.so.0 libharfbuzz.so.0 libgraphene-1.0.so.0 ${gioallowlist}"
100 qt5allowlist="libQt5Core.so.5 libQt5Gui.so.5 libQt5Network.so.5 libQt5Widgets.so.5 libQt5X11Extras.so.5 libcairo.so.2 libxcb.so.1 libxcb-icccm.so.4 ${gobjectallowlist}"
101 kf5allowlist="libKF5ConfigCore.so.5 libKF5CoreAddons.so.5 libKF5I18n.so.5 libKF5KIOCore.so.5 libKF5KIOFileWidgets.so.5 libKF5KIOWidgets.so.5 libKF5WindowSystem.so.5"
102 avahiallowlist="libavahi-common.so.3 libavahi-client.so.3 ${gdbusallowlist}"
103 kerberosallowlist="libgssapi_krb5.so.2 libcom_err.so.2 libkrb5.so.3"
104 dconfallowlist="libdconf.so.1 libgio-2.0.so.0 ${gobjectallowlist}"
106 check_one_file()
108 local file="$1"
110 skip=0
111 allowlist="${globalallowlist}"
112 case "${file}" in
113 */sdk/docs/*)
114 # skip the majority of files, no ELF binaries here
115 skip=1
117 */_uuid.cpython-*.so)
118 allowlist="${allowlist} libuuid.so.1"
120 */libcairo.so.2)
121 allowlist="${allowlist} ${x11allowlist} libxcb-shm.so.0 libxcb.so.1 libxcb-render.so.0"
123 */libcairocanvaslo.so)
124 allowlist="${allowlist} libcairo.so.2"
126 */libucpgio1lo.so|*/liblosessioninstalllo.so|*/libevoablo.so)
127 allowlist="${allowlist} ${gioallowlist}"
129 */libavmediagst.so)
130 allowlist="${allowlist} ${gstreamerallowlist}"
132 */libavmediagtk.so)
133 allowlist="${allowlist} ${gtk4allowlist}"
135 */libvclplug_kf5lo.so|*/libkf5be1lo.so)
136 if [ "$ENABLE_KF5" = TRUE ]; then
137 allowlist="${allowlist} ${qt5allowlist} ${kf5allowlist}"
140 */libvclplug_gtk3lo.so|*/updater)
141 allowlist="${allowlist} ${x11allowlist} ${gtk3allowlist}"
143 */libvclplug_gtk4lo.so)
144 allowlist="${allowlist} ${x11allowlist} ${gtk4allowlist}"
146 */libvclplug_qt5lo.so)
147 if [ "$ENABLE_QT5" = TRUE ]; then
148 allowlist="${allowlist} ${qt5allowlist}"
151 */libvclplug_gtk3_kde5lo.so)
152 if [ "$ENABLE_GTK3_KDE5" = TRUE ]; then
153 allowlist="${allowlist} ${x11allowlist} ${gtk3allowlist} ${qt5allowlist} ${kf5allowlist}"
156 */lo_kde5filepicker)
157 if [ "$ENABLE_GTK3_KDE5" = TRUE ]; then
158 allowlist="${allowlist} ${x11allowlist} ${gtk3allowlist} ${qt5allowlist} \
159 ${kf5allowlist}"
162 */libdesktop_detectorlo.so|*/oosplash|*/gengal.bin)
163 allowlist="${allowlist} ${x11allowlist}"
165 */libvclplug_genlo.so|*/libchartcorelo.so|*/libavmediaogl.so|*/libOGLTranslo.so|*/liboglcanvaslo.so)
166 allowlist="${allowlist} ${x11allowlist} ${openglallowlist}"
168 */libvcllo.so)
169 allowlist="${allowlist} ${x11allowlist} ${openglallowlist} ${gioallowlist} libcups.so.2"
171 */libsofficeapp.so)
172 allowlist="${allowlist} ${x11allowlist} ${openglallowlist} ${gioallowlist} libcups.so.2"
174 */liblibreofficekitgtk.so)
175 allowlist="${allowlist} ${gtk3allowlist}"
177 */libsdlo.so)
178 allowlist="${allowlist} ${avahiallowlist}"
180 */libskialo.so)
181 allowlist="${allowlist} ${openglallowlist} ${x11allowlist}"
183 */libofficebean.so)
184 allowlist="${allowlist} libjawt.so"
186 */libpostgresql-sdbc-impllo.so)
187 allowlist="${allowlist} ${kerberosallowlist}"
189 */libconfigmgrlo.so)
190 if [ "$ENABLE_DCONF" = TRUE ]; then
191 allowlist="${allowlist} ${dconfallowlist}"
194 */libmergedlo.so)
195 allowlist="${allowlist} ${x11allowlist} ${openglallowlist} ${gioallowlist} ${dconfallowlist} libcups.so.2 libcairo.so.2"
197 esac
198 if test "${skip}" = 0 && readelf -d "${file}" &> /dev/null ; then
199 rpath=$(readelf -d "${file}" | grep '(\(RPATH\|RUNPATH\))' || true)
200 neededs=$(readelf -d "${file}" | grep '(NEEDED)' | sed -e 's/.*\[\(.*\)\]$/\1/')
201 neededsinternal=
202 for needed in ${neededs}
204 if ! echo ${allowlist} | grep -q -w "${needed}" ; then
205 neededsinternal="${neededsinternal} ${needed}"
206 if ! echo ${programfiles} | grep -q -w "${needed}" ; then
207 echo "${file}" has suspicious NEEDED: "${needed}"
208 status=1
211 done
212 if test -z "${rpath}" ; then
213 case "${file}" in
214 */python-core-*/lib/lib-dynload/*)
215 # python modules don't have RPATH
217 */share/extensions/*)
218 # extension libraries don't have RPATH
221 # no NEEDED from instdir, no RPATH needed
222 if test -n "${neededsinternal}" ; then
223 echo "${file}" has no RPATH
224 status=1
227 esac
228 else
229 case "$file" in
230 */sdk/bin/*)
231 if echo "${rpath}" | grep -q -v '\[\$ORIGIN/../../program\]$' ; then
232 echo "${file}" has unexpected RPATH "${rpath}"
233 status=1
237 if echo "${rpath}" | grep -q -v '\[\$ORIGIN\]$' ; then
238 echo "${file}" has unexpected RPATH "${rpath}"
239 status=1
242 esac
246 status=0
248 if [ "$PARA" = "1" ] ; then
249 for file in ${files}
251 check_one_file $file
252 done
253 else
254 rm -f check_elf.out
255 for file in ${files}
258 check_one_file $file
259 )>> check_elf.out &
260 done
262 wait
264 if [ -s check_elf.out ] ; then
265 cat check_elf.out
266 status=1
268 rm check_elf.out
270 exit ${status}