gconv: remove rpath from some files

Signed-off-by: Ni Cunshu <nicunshu@huawei.com>
This commit is contained in:
Ni Cunshu 2023-11-22 15:53:33 +08:00
parent fcd5b21420
commit a956bc9f9e

View File

@ -62,7 +62,7 @@
##############################################################################
Name: glibc
Version: 2.28
Release: 97
Release: 98
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -971,6 +971,63 @@ for d in $(echo $remove_dir | sed 's/ /\n/g'); do
done
%endif # %{with benchtests}
reliantlib=""
function findReliantLib()
{
local library=$1
reliantlib=$(readelf -d $library | grep "(NEEDED)" | awk -F "Shared library" '{print $2}')$reliantlib
}
# remove gconv rpath/runpath
function removeLoadPath()
{
local file=$1
local rpathInfo=$(chrpath -l $file | grep "RPATH=")
local runpathInfo=$(chrpath -l $file | grep "RUNPATH=")
local currPath=""
if [ x"$rpathInfo" != x"" ]; then
currPath=$(echo $rpathInfo | awk -F "RPATH=" '{print $2}')
fi
if [ x"$runpathInfo" != x"" ]; then
currPath=$(echo $runpathInfo | awk -F "RUNPATH=" '{print $2}')
fi
if [ x"$currPath" == x"\$ORIGIN" ]; then
chrpath -d $file
findReliantLib $file
fi
}
set +e
# find and remove RPATH/RUNPATH
for file in $(find $RPM_BUILD_ROOT%{_libdir}/gconv/ -name "*.so" -exec file {} ';' | grep "\<ELF\>" | awk -F ':' '{print $1}')
do
removeLoadPath $file
done
function createSoftLink()
{
# pick up the dynamic libraries and create softlink for them
local tmplib=$(echo $reliantlib | sed 's/://g' | sed 's/ //g' | sed 's/\[//g' | sed 's/]/\n/g' | sort | uniq)
for temp in $tmplib
do
if [ -f "$RPM_BUILD_ROOT%{_libdir}/gconv/$temp" ]; then
ln -sf %{_libdir}/gconv/$temp $RPM_BUILD_ROOT%{_libdir}/$temp
echo %{_libdir}/$temp >> glibc.filelist
fi
done
}
# create soft link for the reliant libraries
createSoftLink
set -e
%if %{with compat_2_17}
##############################################################################
# glibc compat-2.17 sub-package
@ -1219,6 +1276,9 @@ fi
%endif
%changelog
* Wed Nov 22 2023 nicunshu <nicunshu@huawei.com> - 2.28-98
- glibc:remove rpath from some gcov files
* Tue Sep 26 2023 zhanghao <zhanghao383@huawei.com> - 2.28-97
- nss:fix CVE-2023-5156