reloc: move relocatable libraries from /opt/scylladb/lib to /opt/scylladb/libreloc

On Scylla 3rdparty tools, we add /opt/scylladb/lib to LD_LIBRARY_PATH.
We use same directory for relocatable binaries, including libc.so.6.
Once we install both scylla-env package and relocatable version of scylla-server package, the loader tries to load libc from /opt/scylladb/lib then entire distribution become unusable.

We may able to use Obsoletes or Conflict tag on .rpm/.deb to avoid
install new Scylla package with scylla-env, but it's better & safer not to share
same directory for different purpose.

Fixes #3943

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20190128023757.25676-1-syuu@scylladb.com>
This commit is contained in:
Takuya ASADA
2019-01-28 11:37:57 +09:00
committed by Avi Kivity
parent 274f553485
commit 7db1b45839
5 changed files with 10 additions and 10 deletions

View File

@@ -36,7 +36,7 @@ override_dh_shlibdeps:
override_dh_fixperms:
dh_fixperms
chmod 755 $(CURDIR)/debian/{{product}}-server/opt/scylladb/lib/ld.so
chmod 755 $(CURDIR)/debian/{{product}}-server/opt/scylladb/libreloc/ld.so
override_dh_strip_nondeterminism:

View File

@@ -10,7 +10,7 @@ tools/scyllatop usr/lib/scylla
swagger-ui/dist usr/lib/scylla/swagger-ui
api/api-doc usr/lib/scylla/api
bin/* opt/scylladb/bin
lib/* opt/scylladb/lib
libreloc/* opt/scylladb/libreloc
libexec/* opt/scylladb/libexec
dist/common/bin/scyllatop usr/bin
dist/common/sbin/* usr/sbin

View File

@@ -166,7 +166,7 @@ rm -rf $RPM_BUILD_ROOT
%{_prefix}/lib/scylla/scylla_util.py
%{_prefix}/lib/scylla/scylla-gdb.py
/opt/scylladb/bin/*
/opt/scylladb/lib/*
/opt/scylladb/libreloc/*
/opt/scylladb/libexec/*
%attr(0755,scylla,scylla) %dir %{_sharedstatedir}/scylla/
%attr(0755,scylla,scylla) %dir %{_sharedstatedir}/scylla/data

View File

@@ -91,7 +91,7 @@ SYSCONFDIR="/etc/sysconfig"
REPOFILES="'/etc/yum.repos.d/scylla*.repo'"
install -d -m755 "$retc"/scylla "$rprefix/lib/systemd/system" "$rprefix/lib/scylla" "$rprefix/bin" "$root/opt/scylladb/bin" "$root/opt/scylladb/libexec" "$root/opt/scylladb/lib"
install -d -m755 "$retc"/scylla "$rprefix/lib/systemd/system" "$rprefix/lib/scylla" "$rprefix/bin" "$root/opt/scylladb/bin" "$root/opt/scylladb/libexec" "$root/opt/scylladb/libreloc"
install -m644 conf/scylla.yaml -Dt "$retc"/scylla
install -m644 conf/cassandra-rackdc.properties -Dt "$retc"/scylla
install -m644 build/*.service -Dt "$rprefix"/lib/systemd/system
@@ -111,7 +111,7 @@ for f in libexec/*; do
cp -P "$f" "$root/opt/scylladb/libexec"
fi
done
install -m755 lib/* -Dt "$root/opt/scylladb/lib"
install -m755 libreloc/* -Dt "$root/opt/scylladb/libreloc"
# use relative paths instead?
ln -sf /opt/scylladb/bin/scylla "$rprefix/bin/scylla"
ln -sf /opt/scylladb/bin/iotune "$rprefix/bin/iotune"

View File

@@ -92,8 +92,8 @@ ar.add('build/SCYLLA-RELOCATABLE-FILE', arcname='SCYLLA-RELOCATABLE-FILE')
# foobar/bin/scylla a shell script invoking everything
# foobar/libexec/scylla.bin the real binary
# foobar/libexec/scylla a symlink to ../lib/ld.so
# foobar/lib/ld.so the dynamic linker
# foobar/lib/lib... all the other libraries
# foobar/libreloc/ld.so the dynamic linker
# foobar/libreloc/lib... all the other libraries
# the transformations (done by the thunk and symlinks) are:
#
@@ -107,7 +107,7 @@ b="$(basename "$x")"
d="$(dirname "$x")/.."
ldso="$d/libexec/$b"
realexe="$d/libexec/$b.bin"
LD_LIBRARY_PATH="$d/lib" exec -a "$0" "$ldso" "$realexe" "$@"
LD_LIBRARY_PATH="$d/libreloc" exec -a "$0" "$ldso" "$realexe" "$@"
'''
for exe in executables:
@@ -120,11 +120,11 @@ for exe in executables:
ar.addfile(ti, fileobj=io.BytesIO(thunk))
ti = tarfile.TarInfo(name='libexec/' + basename)
ti.type = tarfile.SYMTYPE
ti.linkname = '../lib/ld.so'
ti.linkname = '../libreloc/ld.so'
ti.mtime = os.stat(exe).st_mtime
ar.addfile(ti)
for lib, libfile in libs.items():
ar.add(libfile, arcname='lib/' + lib)
ar.add(libfile, arcname='libreloc/' + lib)
ar.add('conf')
ar.add('dist')
ar.add('build/SCYLLA-RELEASE-FILE', arcname='SCYLLA-RELEASE-FILE')