From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A889315800C for ; Wed, 28 Dec 2022 20:25:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F1DC8E09CF; Wed, 28 Dec 2022 20:25:35 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CBD4EE09CF for ; Wed, 28 Dec 2022 20:25:35 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E881033BF55 for ; Wed, 28 Dec 2022 20:25:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 19F7277C for ; Wed, 28 Dec 2022 20:25:33 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1672258026.689f36370d85a43fba6d7329290b5d2086b61fb4.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-alternatives/sh/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-alternatives/sh/sh-0.ebuild X-VCS-Directories: app-alternatives/sh/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 689f36370d85a43fba6d7329290b5d2086b61fb4 X-VCS-Branch: master Date: Wed, 28 Dec 2022 20:25:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 15da2264-e53b-407d-9010-ecad1702ca15 X-Archives-Hash: 9ce482c4b8ef2dc56124e02b9c7b7ad7 commit: 689f36370d85a43fba6d7329290b5d2086b61fb4 Author: Sam James gentoo org> AuthorDate: Wed Dec 28 20:04:57 2022 +0000 Commit: Sam James gentoo org> CommitDate: Wed Dec 28 20:07:06 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=689f3637 app-alternatives/sh: support sys-apps/busybox Note that we have to check for CONFIG_FEATURE_SH_STANDALONE=y to avoid busybox preferring internal applets over commands in PATH. See https://web.archive.org/web/20221206223848/https://busybox.net/FAQ.html#standalone_shell. Closes: https://bugs.gentoo.org/888781 Signed-off-by: Sam James gentoo.org> app-alternatives/sh/sh-0.ebuild | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app-alternatives/sh/sh-0.ebuild b/app-alternatives/sh/sh-0.ebuild index 4cd530a89d9c..682533efb3bf 100644 --- a/app-alternatives/sh/sh-0.ebuild +++ b/app-alternatives/sh/sh-0.ebuild @@ -5,6 +5,7 @@ EAPI=8 ALTERNATIVES=( bash:app-shells/bash + busybox:sys-apps/busybox dash:app-shells/dash ksh:app-shells/ksh "lksh:app-shells/mksh[lksh]" @@ -20,6 +21,19 @@ RDEPEND=" !!app-eselect/eselect-sh " +pkg_setup() { + if [[ -z ${ROOT} ]] && use busybox ; then + # Needed to avoid busybox preferring internal applets over PATH lookups. + # https://web.archive.org/web/20221206223848/https://busybox.net/FAQ.html#standalone_shell. + if busybox bbconfig | grep -q "CONFIG_FEATURE_SH_STANDALONE=y" ; then + ewarn "busybox is configured with CONFIG_FEATURE_SH_STANDALONE=y!" + ewarn "This is not a safe configuration for busybox as /bin/sh." + ewarn "Please use savedconfig to disable CONFIG_FEATURE_SH_STANDALONE on busybox." + die "Aborting due to unsafe Busybox configuration (CONFIG_FEATURE_SH_STANDALONE=y)!" + fi + fi +} + src_install() { dosym "$(get_alternative)" /bin/sh || die }