Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys-libs/musl: fix ldconfig's handling of ROOT #22984

Closed
wants to merge 3 commits into from

Conversation

thesamesam
Copy link
Member

No description provided.

Signed-off-by: Wiktor Kerr <w@kerr.sh>
Signed-off-by: Sam James <sam@gentoo.org>
@gentoo-bot
Copy link

Pull Request assignment

Submitter: @thesamesam
Areas affected: ebuilds
Packages affected: sys-libs/musl

sys-libs/musl: @blueness, @lu-zero, @gentoo/toolchain, @gentoo/hardened musl

Linked bugs

Bugs linked: 666246


In order to force reassignment and/or bug reference scan, please append [please reassign] to the pull request title.

Docs: Code of ConductCopyright policy (expl.) ● DevmanualGitHub PRsProxy-maint guide

@gentoo-bot gentoo-bot added assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR. labels Nov 18, 2021
@thesamesam
Copy link
Member Author

--- ldconfig.in	2021-11-18 00:43:19.282394541 +0000
+++ ldconfig.in-r1	2021-11-18 00:48:26.831110160 +0000
@@ -1,16 +1,9 @@
 #!/bin/bash -e
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2

 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)

 VERBOSE=0

@@ -25,6 +18,8 @@
 			;;
 		r)
 			ROOT=$OPTARG
+			LDSO_CONF=$ROOT$LDSO_CONF
+			LDSO_CONF_DIR=$(dirname $LDSO_CONF)
 			;;
 		f)
 			LDSO_CONF=$OPTARG
@@ -122,11 +117,19 @@
 }

 get_options "$@"
+
+if [[ ! -e $LDSO_CONF ]]; then
+        echo "$LDSO_CONF not found" >&2
+        exit 1
+fi
+
+LDSO_CONF_DIR=$(dirname $LDSO_CONF)
+
 drs=$(read_ldso_conf "$LDSO_CONF")
 drs=$(sanitize $drs)

 ARCH=@@ARCH@@
-LDSO_PATH="/lib/ld-musl-${ARCH}.so.1"
+LDSO_PATH="$ROOT/lib/ld-musl-${ARCH}.so.1"
 if [[ ! -e $LDSO_PATH ]]; then
 	echo "$LDSO_PATH not found" >&2
 	exit 1
@@ -134,7 +137,7 @@

 LDSO_ARCH=$(basename $LDSO_PATH)
 LDSO_NAME=${LDSO_ARCH%.so.1}
-ETC_LDSO_PATH=/etc/${LDSO_NAME}.path
+ETC_LDSO_PATH="$ROOT/etc/${LDSO_NAME}.path"

 X=$(mktemp -p /tmp ${LDSO_NAME}.XXXXXX)
 for d in $drs; do

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2021-11-18 01:00 UTC
Newest commit scanned: cc92cd1
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/cccdcf8ab0/output.html

Move around some declarations so we get sensible default
values but only perform the sanity checks _after_ we
parse command line arguments to take into account e.g.
-r (root).

Bug: https://bugs.gentoo.org/666246
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2021-11-18 01:20 UTC
Newest commit scanned: 6d04d43
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/dc122ec270/output.html

@thesamesam thesamesam deleted the musl-sysroot branch April 3, 2022 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR.
Projects
None yet
4 participants