public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-alternatives/sh/
Date: Wed, 28 Dec 2022 20:25:33 +0000 (UTC)	[thread overview]
Message-ID: <1672258026.689f36370d85a43fba6d7329290b5d2086b61fb4.sam@gentoo> (raw)

commit:     689f36370d85a43fba6d7329290b5d2086b61fb4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 28 20:04:57 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> 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 <sam <AT> 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
 }


             reply	other threads:[~2022-12-28 20:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28 20:25 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-08-25 12:04 [gentoo-commits] repo/gentoo:master commit in: app-alternatives/sh/ Andreas K. Hüttel
2022-12-29  4:19 Mike Gilbert
2022-12-28 20:26 Sam James
2022-12-27 19:53 Sam James
2022-12-27 19:45 Sam James
2022-12-27 13:40 Sam James
2022-12-27 11:31 Sam James
2022-12-05 19:13 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1672258026.689f36370d85a43fba6d7329290b5d2086b61fb4.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox