[gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/ldconfig/files/
commit: bbd671043a9d7b666e3cc750b771f6b5105d5064 Author: layman layman AT localhost AuthorDate: Wed Apr 15 20:41:02 2015 + Commit: Anthony G. Basile blueness AT gentoo DOT org CommitDate: Wed Apr 15 20:49:24 2015 + URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=bbd67104 sys-apps/ldconfig: Ignore -p. Expect -X. Bug #545006 c#17. sys-apps/ldconfig/files/ldconfig-0.1 | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys-apps/ldconfig/files/ldconfig-0.1 b/sys-apps/ldconfig/files/ldconfig-0.1 index 722cbee..7139450 100644 --- a/sys-apps/ldconfig/files/ldconfig-0.1 +++ b/sys-apps/ldconfig/files/ldconfig-0.1 @@ -12,6 +12,8 @@ LDSO_CONF_DIR=$(dirname $LDSO_CONF) VERBOSE=0 +UPDATE_LINKS=1 + get_options() { while getopts vnNXf:C:r:p opt $@; do case $opt in @@ -25,18 +27,26 @@ get_options() { f) LDSO_CONF=$OPTARG ;; + X) + UPDATE_LINKS=0 + ;; \?) echo Invalid option: -$opt 2 exit 1 ;; - n|N|X|C) + n|N|C|p) echo Unimplemented option: -$opt 2 exit 1 ;; esac done + + if [[ $UPDATE_LINKS == 1 ]]; then + echo Updating links is not implemented. + fi } + repeated() { local l=$1 local drs=${@:2}
[gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/ldconfig/
commit: 08ccfada9227e86b0addbb8e03360a568dc7b437 Author: Anthony G. Basile blueness AT gentoo DOT org AuthorDate: Wed Apr 8 00:23:48 2015 + Commit: Anthony G. Basile blueness AT gentoo DOT org CommitDate: Wed Apr 8 00:24:13 2015 + URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=08ccfada sys-apps/ldconfig: Add env.d/00musl. Bug #545006 c#16. sys-apps/ldconfig/ldconfig-0.1.ebuild | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys-apps/ldconfig/ldconfig-0.1.ebuild b/sys-apps/ldconfig/ldconfig-0.1.ebuild index 08abed3..05ab221 100644 --- a/sys-apps/ldconfig/ldconfig-0.1.ebuild +++ b/sys-apps/ldconfig/ldconfig-0.1.ebuild @@ -29,4 +29,6 @@ src_unpack () { src_install () { into / dosbin ${PN} + echo 'LDPATH=include ld.so.conf.d/*.conf' ${T}/00musl + doenvd ${T}/00musl || die }
[gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/ldconfig/files/
commit: 4df34beb36448ed09e45779a0570bc0c2a070975 Author: Anthony G. Basile blueness AT gentoo DOT org AuthorDate: Sun Apr 5 10:07:14 2015 + Commit: Anthony G. Basile blueness AT gentoo DOT org CommitDate: Sun Apr 5 10:07:14 2015 + URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=4df34beb sys-apps/ldconfig: unconditionally add listed directories. sys-apps/ldconfig/files/ldconfig-0.1 | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sys-apps/ldconfig/files/ldconfig-0.1 b/sys-apps/ldconfig/files/ldconfig-0.1 index 55db851..722cbee 100644 --- a/sys-apps/ldconfig/files/ldconfig-0.1 +++ b/sys-apps/ldconfig/files/ldconfig-0.1 @@ -59,10 +59,9 @@ expand() { line=${line//:/ } line=${line//,/ } for l in $line; do - if [[ -d $l ]]; then - repeated $l $drs continue - drs+= $l - fi + #We must add this whether or not the directory exists + repeated $l $drs continue + drs+= $l done done $f done @@ -112,12 +111,8 @@ sanitize() { get_options $@ drs=$(read_ldso_conf $LDSO_CONF) -for f in $LDSO_CONF.d/*; do - drs=$drs $(read_ldso_conf $f) -done drs=$(sanitize $drs) -#LDSO_PATH=$(readelf -l /bin/bash | grep -o '\/lib\/ld-musl-.*\.so\.1') LDSO_PATH=$(ls /lib/ld-musl-*.so.1) if [[ ! -e $LDSO_PATH ]]; then echo $LDSO_PATH not found 2
[gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/ldconfig/files/
commit: 77ada7caca7d68e40cc8df6f026183474b250d4f Author: Anthony G. Basile blueness AT gentoo DOT org AuthorDate: Sat Apr 4 22:36:59 2015 + Commit: Anthony G. Basile blueness AT gentoo DOT org CommitDate: Sat Apr 4 22:36:59 2015 + URL:https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=77ada7ca sys-apps/ldconfig: Bug #545006. Package-Manager: portage-2.2.14 Manifest-Sign-Key: 0xF52D4BBA sys-apps/ldconfig/files/ldconfig-0.1 | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sys-apps/ldconfig/files/ldconfig-0.1 b/sys-apps/ldconfig/files/ldconfig-0.1 index c5ec1df..55db851 100644 --- a/sys-apps/ldconfig/files/ldconfig-0.1 +++ b/sys-apps/ldconfig/files/ldconfig-0.1 @@ -10,16 +10,6 @@ fi LDSO_CONF_DIR=$(dirname $LDSO_CONF) -LDSO_PATH=$(ls /lib/ld-musl-*.so.1) -if [[ ! -e $LDSO_PATH ]]; then - echo $LDSO_PATH not found 2 - exit 1 -fi - -LDSO_ARCH=$(basename $LDSO_PATH) -LDSO_NAME=${LDSO_ARCH%.so.1} -ETC_LDSO_PATH=/etc/${LDSO_NAME}.path - VERBOSE=0 get_options() { @@ -33,7 +23,7 @@ get_options() { ROOT=$OPTARG ;; f) - LDSOCONF=$OPTARG + LDSO_CONF=$OPTARG ;; \?) echo Invalid option: -$opt 2 @@ -106,7 +96,7 @@ read_ldso_conf() { fi fi done - done $LDSO_CONF + done $1 echo $drs } @@ -121,16 +111,26 @@ sanitize() { } get_options $@ -drs=$(read_ldso_conf) +drs=$(read_ldso_conf $LDSO_CONF) +for f in $LDSO_CONF.d/*; do + drs=$drs $(read_ldso_conf $f) +done drs=$(sanitize $drs) +#LDSO_PATH=$(readelf -l /bin/bash | grep -o '\/lib\/ld-musl-.*\.so\.1') +LDSO_PATH=$(ls /lib/ld-musl-*.so.1) +if [[ ! -e $LDSO_PATH ]]; then + echo $LDSO_PATH not found 2 + exit 1 +fi + +LDSO_ARCH=$(basename $LDSO_PATH) +LDSO_NAME=${LDSO_ARCH%.so.1} +ETC_LDSO_PATH=/etc/${LDSO_NAME}.path + X=$(mktemp --tmpdir=/tmp ${LDSO_NAME}.XX) -cat EOF $X -# $ETC_LDSO_PATH autogenerated by env-update; make all changes to -# contents of /etc/env.d directory -EOF for d in $drs; do echo $d $X done +chmod 644 $X mv $X $ETC_LDSO_PATH -
[gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/ldconfig/
commit: eb06ad5b586d534a0293856c299c901467061c76 Author: Anthony G. Basile blueness AT gentoo DOT org AuthorDate: Mon Nov 17 12:08:34 2014 + Commit: Anthony G. Basile blueness AT gentoo DOT org CommitDate: Mon Nov 17 12:08:34 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=eb06ad5b sys-apps/ldconfig: keyword mask as it breaks a system Package-Manager: portage-2.2.8-r2 Manifest-Sign-Key: 0xF52D4BBA --- sys-apps/ldconfig/ldconfig-0.1.ebuild | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys-apps/ldconfig/ldconfig-0.1.ebuild b/sys-apps/ldconfig/ldconfig-0.1.ebuild index bbbc42d..08abed3 100644 --- a/sys-apps/ldconfig/ldconfig-0.1.ebuild +++ b/sys-apps/ldconfig/ldconfig-0.1.ebuild @@ -10,7 +10,8 @@ SRC_URI= LICENSE=GPL-2 SLOT=0 -KEYWORDS=~amd64 +#KEYWORDS=~amd64 +KEYWORDS= IUSE= DEPEND=
[gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/ldconfig/, sys-apps/ldconfig/files/
commit: 404bfb9774d367207164c3a2a10b43754c83259c Author: Anthony G. Basile blueness AT gentoo DOT org AuthorDate: Mon Nov 17 01:35:39 2014 + Commit: Anthony G. Basile blueness AT gentoo DOT org CommitDate: Mon Nov 17 01:35:39 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=404bfb97 sys-apps/ldconfig: add musl ldconfig script Package-Manager: portage-2.2.8-r2 Manifest-Sign-Key: 0xF52D4BBA --- sys-apps/ldconfig/files/ldconfig-0.1 | 136 ++ sys-apps/ldconfig/ldconfig-0.1.ebuild | 31 sys-apps/ldconfig/metadata.xml| 8 ++ 3 files changed, 175 insertions(+) diff --git a/sys-apps/ldconfig/files/ldconfig-0.1 b/sys-apps/ldconfig/files/ldconfig-0.1 new file mode 100644 index 000..c5ec1df --- /dev/null +++ b/sys-apps/ldconfig/files/ldconfig-0.1 @@ -0,0 +1,136 @@ +#!/bin/bash -e + +ROOT=/ + +LDSO_CONF=/etc/ld.so.conf +if [[ ! -e $LDSO_CONF ]]; then + echo $LDSO_CONF not found 2 + exit 1 +fi + +LDSO_CONF_DIR=$(dirname $LDSO_CONF) + +LDSO_PATH=$(ls /lib/ld-musl-*.so.1) +if [[ ! -e $LDSO_PATH ]]; then + echo $LDSO_PATH not found 2 + exit 1 +fi + +LDSO_ARCH=$(basename $LDSO_PATH) +LDSO_NAME=${LDSO_ARCH%.so.1} +ETC_LDSO_PATH=/etc/${LDSO_NAME}.path + +VERBOSE=0 + +get_options() { + while getopts vnNXf:C:r:p opt $@; do + case $opt in + v) + echo ldconfig for musl in Gentoo + VERBOSE=1 + ;; + r) + ROOT=$OPTARG + ;; + f) + LDSOCONF=$OPTARG + ;; + \?) + echo Invalid option: -$opt 2 + exit 1 + ;; + n|N|X|C) + echo Unimplemented option: -$opt 2 + exit 1 + ;; + esac + done +} + +repeated() { + local l=$1 + local drs=${@:2} + for m in $drs; do + [[ $m == $l ]] return 0 + done + return 1 +} + +expand() { + # We are assuming the ld.so.conf's 'include' is not recursive + local f line l + local glob=$LDSO_CONF_DIR/$1 + local drs=${@:2} + + for f in $glob; do + [[ ! -f $f ]] continue + while read line; do + line=${line%%#*} + line=${line//:/ } + line=${line//,/ } + for l in $line; do + if [[ -d $l ]]; then + repeated $l $drs continue + drs+= $l + fi + done + done $f + done + + echo $drs +} + +read_ldso_conf() { + local drs= + + while read line; do + # Sanitize the line - see ldconfig(8) for delimiters + # Note: bash read turns tabs into spaces and read already + # delimits on newlines with the default $IFS + line=${line%%#*} # Remove comments + line=${line//:/ } # Change colon delimiter to space + line=${line//,/ } # Change comma delimiter to space + + next=0 + for l in $line; do + if [[ $next == 1 ]]; then + next=0 + drs=$(expand $l $drs) + elif [[ $l == include ]]; then + next=1 + else + # glibc's ldconfig silently skips non directories + if [[ -d $l ]]; then + repeated $l $drs continue + drs+= $l + fi + fi + done + done $LDSO_CONF + + echo $drs +} + +sanitize() { + local drs=$@ + + repeated /lib $drs || drs=/lib $drs + repeated /usr/lib $drs || drs=/usr/lib $drs + + echo $drs +} + +get_options $@ +drs=$(read_ldso_conf) +drs=$(sanitize $drs) + +X=$(mktemp --tmpdir=/tmp ${LDSO_NAME}.XX) +cat EOF $X +# $ETC_LDSO_PATH autogenerated by env-update; make all changes to +# contents of /etc/env.d directory +EOF +for d in $drs; do + echo $d $X +done +mv $X $ETC_LDSO_PATH + diff --git a/sys-apps/ldconfig/ldconfig-0.1.ebuild b/sys-apps/ldconfig/ldconfig-0.1.ebuild new file mode 100644 index 000..bbbc42d --- /dev/null +++ b/sys-apps/ldconfig/ldconfig-0.1.ebuild @@ -0,0 +1,31 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=5 + +DESCRIPTION=ldconfig for musl in Gentoo +HOMEPAGE=http://dev.gentoo.org/~blueness; +SRC_URI=