Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] common/chroot-style/uchroot.sh: check if xbps-uchroot is executable
@ 2024-02-18  8:19 classabbyamp
  2024-02-18  8:24 ` 0x5c
  2024-05-12  3:30 ` [PR PATCH] [Merged]: " classabbyamp
  0 siblings, 2 replies; 3+ messages in thread
From: classabbyamp @ 2024-02-18  8:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages this-sign-cant-stop-me-because-i-cant-read
https://github.com/void-linux/void-packages/pull/48810

common/chroot-style/uchroot.sh: check if xbps-uchroot is executable
...and show a friendly error message

This can be a common failure mode when using `-t` if not in the group `xbps-uchroot` is owned by, because it is SUID. Previously, the error was the cryptic message `ERROR: prctl SECBIT_NOROOT (Operation not permitted)`.

#### Testing the changes
- I tested the changes in this PR: **YES**


A patch file from https://github.com/void-linux/void-packages/pull/48810.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-this-sign-cant-stop-me-because-i-cant-read-48810.patch --]
[-- Type: text/x-diff, Size: 1622 bytes --]

From 8317c992cc77f0f63029ccf1a1af0b3db3f50f6a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 18 Feb 2024 03:15:55 -0500
Subject: [PATCH] common/chroot-style/uchroot.sh: check if xbps-uchroot is
 executable

... and show a friendly error message

This can be a common failure mode when using `-t` if not in the group
`xbps-uchroot` is owned by, because it is SUID. Previously, the error was
the cryptic message `ERROR: prctl SECBIT_NOROOT (Operation not permitted)`.
---
 common/chroot-style/uchroot.sh | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/common/chroot-style/uchroot.sh b/common/chroot-style/uchroot.sh
index 5fe47eb9f8bcb..e24ceac308be0 100755
--- a/common/chroot-style/uchroot.sh
+++ b/common/chroot-style/uchroot.sh
@@ -9,12 +9,27 @@ readonly EXTRA_ARGS="$4"
 readonly CMD="$5"
 shift 5
 
-if ! command -v xbps-uchroot >/dev/null 2>&1; then
+msg_red() {
+	# error messages in bold/red
+	[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
+	printf "=> ERROR: %s\\n" "$@" >&2
+	[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
+}
+
+readonly XBPS_UCHROOT_CMD="$(command -v xbps-uchroot 2>/dev/null)"
+
+if [ -z "$XBPS_UCHROOT_CMD" ]; then
+	msg_red "could not find xbps-uchroot"
+	exit 1
+fi
+
+if ! [ -x "$XBPS_UCHROOT_CMD" ]; then
+	msg_red "xbps-uchroot is not executable. Are you in the $(stat -c %G "$XBPS_UCHROOT_CMD") group?"
 	exit 1
 fi
 
-if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
-	echo "$0 MASTERDIR/DISTDIR not set"
+if [ -z "$MASTERDIR" ] || [ -z "$DISTDIR" ]; then
+	msg_red "$0: MASTERDIR/DISTDIR not set"
 	exit 1
 fi
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: common/chroot-style/uchroot.sh: check if xbps-uchroot is executable
  2024-02-18  8:19 [PR PATCH] common/chroot-style/uchroot.sh: check if xbps-uchroot is executable classabbyamp
@ 2024-02-18  8:24 ` 0x5c
  2024-05-12  3:30 ` [PR PATCH] [Merged]: " classabbyamp
  1 sibling, 0 replies; 3+ messages in thread
From: 0x5c @ 2024-02-18  8:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

New comment by 0x5c on void-packages repository

https://github.com/void-linux/void-packages/pull/48810#issuecomment-1951010558

Comment:
> Previously, the error was the cryptic message `ERROR: prctl SECBIT_NOROOT (Operation not permitted)`.

Even weirder, running `xbps-uchroot` (or the chroot-style) without the group anywhere else than within xbps-src gives a plain `permission denied` message from the shell; it's only some weirdness in xbps-src that obscures the actual error.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Merged]: common/chroot-style/uchroot.sh: check if xbps-uchroot is executable
  2024-02-18  8:19 [PR PATCH] common/chroot-style/uchroot.sh: check if xbps-uchroot is executable classabbyamp
  2024-02-18  8:24 ` 0x5c
@ 2024-05-12  3:30 ` classabbyamp
  1 sibling, 0 replies; 3+ messages in thread
From: classabbyamp @ 2024-05-12  3:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

There's a merged pull request on the void-packages repository

common/chroot-style/uchroot.sh: check if xbps-uchroot is executable
https://github.com/void-linux/void-packages/pull/48810

Description:
...and show a friendly error message

This can be a common failure mode when using `-t` if not in the group `xbps-uchroot` is owned by, because it is SUID. Previously, the error was the cryptic message `ERROR: prctl SECBIT_NOROOT (Operation not permitted)`.

#### Testing the changes
- I tested the changes in this PR: **YES**


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-12  3:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18  8:19 [PR PATCH] common/chroot-style/uchroot.sh: check if xbps-uchroot is executable classabbyamp
2024-02-18  8:24 ` 0x5c
2024-05-12  3:30 ` [PR PATCH] [Merged]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).