brp-fix-perms, fixup-libraries: strip executable bit from non-executable libraries

This commit is contained in:
Дмитрий Левин 2003-11-26 09:01:23 +00:00
parent 5ed5b722f5
commit fb3b612bb9
4 changed files with 49 additions and 4 deletions

View File

@ -6,7 +6,7 @@
Name: %rpm_name
Version: %rpm_version
Release: alt27.4
Release: alt27.5
%define ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
%define get_dep() %(rpm -q --qf '%%{NAME} >= %%|SERIAL?{%%{SERIAL}:}|%%{VERSION}-%%{RELEASE}' %1 2>/dev/null || echo '%1 >= unknown')
@ -474,7 +474,7 @@ fi
%endif #with contrib
%changelog
* Mon Nov 24 2003 Dmitry V. Levin <ldv@altlinux.org> 4.0.4-alt27.4
* Mon Nov 24 2003 Dmitry V. Levin <ldv@altlinux.org> 4.0.4-alt27.5
- brp-verify_elf:
"%%set_verify_elf_method relaxed" now affects textrel as well as rpath.
- verify-elf:
@ -484,6 +484,7 @@ fi
- Fixed Makefiles to correct librpm*-4.0.4.so dependencies.
- Do not package .la files.
- brp-cleanup: remove lib*.la files from /lib, /usr/lib, and /usr/X11R6/lib.
- brp-fix-perms, fixup-libraries: strip executable bit from non-executable libraries.
- rpmbuild --rebuild/--recompile: implemented support for new macros:
%%_rpmbuild_clean and %%_rpmbuild_packagesource.

View File

@ -8,7 +8,7 @@ EXTRA_DIST = \
compress_files check-files convertrpmrc.sh cross-build \
delayed_rebuilddb find-lang find-package find-prov.pl find-req.pl \
cpanflute cpanflute2 Specfile.pm find-provides.perl find-requires.perl \
fixup-binconfig fixup-pkgconfig fixup-libtool \
fixup-binconfig fixup-pkgconfig fixup-libtool fixup-libraries \
get_magic.pl getpo.sh http.req \
functions files.req.list \
magic.prov magic.req pam.prov pam.req perl.prov perl.req rpmdiff rpmdiff.cgi \
@ -27,7 +27,7 @@ config_SCRIPTS = \
compress_files check-files convertrpmrc.sh cross-build \
delayed_rebuilddb find-lang find-package find-prov.pl find-req.pl \
cpanflute cpanflute2 Specfile.pm find-provides.perl find-requires.perl \
fixup-binconfig fixup-pkgconfig fixup-libtool \
fixup-binconfig fixup-pkgconfig fixup-libtool fixup-libraries \
get_magic.pl getpo.sh http.req \
functions files.req.list \
magic.prov magic.req pam.prov pam.req perl.prov perl.req rpmdiff rpmdiff.cgi \

View File

@ -39,3 +39,6 @@ done
# Following files should not be group/world readable.
find -type f \( -perm -4100 -o -perm -2100 \) -print0 |
xargs -r0 chmod -R go-rw --
find -type f -perm +0111 -print0 |
xargs -r0 @RPMCONFIGDIR@/fixup-libraries

41
scripts/fixup-libraries Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh -e
#
# fixup-shared - fix permissions of libraries.
#
# $Id$
# Copyright (C) 2003 Dmitry V. Levin <ldv@altlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
for file in "$@"; do
type=`file -b "$file"` || continue
case "$type" in
current\ ar\ archive)
chmod -v a-x "$file"
;;
ELF\ *\ shared\ object,\ *)
file_header="$(readelf -h "$file")" || continue
entry=`printf %s "$file_header" |sed -ne 's/^ \+Entry point address: \+0x0*\([0-9a-f]\+\)$/\1/p'`
[ -n "$entry" ] || continue
section_header="$(readelf -S "$file")" || continue
text=`printf %s "$section_header" |sed -ne 's/^ *\[ *[0-9]\+\] \.text \+PROGBITS \+0*\([0-9a-f]\+\) \+.*/\1/p'`
[ -n "$text" ] || continue
[ "$entry" != "$text" ] || chmod -v a-x "$file"
;;
esac
done