Files
patches/elogind/elogind-255.22-posixify.patch
T
2026-05-26 02:08:47 -05:00

312 lines
10 KiB
Diff

diff -urN a/configure b/configure
--- a/configure 2025-11-18 01:14:12.000000000 -0600
+++ b/configure 2026-03-29 14:49:52.741863535 -0500
@@ -1,10 +1,12 @@
-#!/usr/bin/env bash
+#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
cflags="CFLAGS=${CFLAGS-}"
cxxflags="CXXFLAGS=${CXXFLAGS-}"
-args=()
+args_file="${TMPDIR:-/tmp}/elogind-configure-args.$$"
+trap 'rm -f "$args_file"' EXIT HUP INT TERM
+: >"$args_file"
for arg in "$@"; do
case "$arg" in
@@ -15,10 +17,15 @@
cxxflags="$arg"
;;
*)
- args+=("$arg")
+ printf '%s\n' "$arg" >>"$args_file"
esac
done
+set --
+while IFS= read -r arg; do
+ set -- "$@" "$arg"
+done <"$args_file"
+
export "${cflags?}" "${cxxflags?}"
set -x
-exec meson setup build "${args[@]}"
+exec meson setup build "$@"
diff -urN a/meson_options.txt b/meson_options.txt
--- a/meson_options.txt 2025-11-18 01:14:12.000000000 -0600
+++ b/meson_options.txt 2026-03-29 14:50:19.141523091 -0500
@@ -297,7 +297,7 @@
# option('clock-valid-range-usec-max', type : 'integer', value : 473364000000000, # 15 years
# description : 'maximum value in microseconds for the difference between RTC and epoch, exceeding which is considered an RTC error ["0" disables]')
#endif // 0
-option('default-user-shell', type : 'string', value : '/bin/bash',
+option('default-user-shell', type : 'string', value : '/bin/sh',
description : 'default interactive shell')
option('system-alloc-uid-min', type : 'integer', value : 0,
diff -urN a/src/basic/generate-cap-list.sh b/src/basic/generate-cap-list.sh
--- a/src/basic/generate-cap-list.sh 2025-11-18 01:14:12.000000000 -0600
+++ b/src/basic/generate-cap-list.sh 2026-03-29 14:51:05.674685004 -0500
@@ -1,8 +1,19 @@
-#!/usr/bin/env bash
+#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
-set -o pipefail
-${1:?} -dM -include linux/capability.h -include "${2:?}" -include "${3:?}" - </dev/null | \
- awk '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $2; }' | \
- grep -v CAP_LAST_CAP
+tmp="${TMPDIR:-/tmp}/generate-cap-list.$$"
+trap 'rm -f "$tmp"' EXIT HUP INT TERM
+
+# Meson passes the preprocessor invocation as a single argument.
+cpp="${1:?}"
+config_h="${2:?}"
+missing_capability_h="${3:?}"
+set -- $cpp
+"$@" -dM -include linux/capability.h -include "$config_h" -include "$missing_capability_h" - </dev/null >"$tmp"
+
+awk '
+ /^#define[ \t]+CAP_[A-Z_]+[ \t]+/ && $2 != "CAP_LAST_CAP" {
+ print $2
+ }
+' "$tmp"
diff -urN a/src/basic/generate-errno-list.sh b/src/basic/generate-errno-list.sh
--- a/src/basic/generate-errno-list.sh 2025-11-18 01:14:12.000000000 -0600
+++ b/src/basic/generate-errno-list.sh 2026-03-29 14:50:58.129496657 -0500
@@ -1,11 +1,20 @@
-#!/usr/bin/env bash
+#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
-set -o pipefail
# In kernel's arch/parisc/include/uapi/asm/errno.h, ECANCELLED and EREFUSED are defined as aliases of
# ECANCELED and ECONNREFUSED, respectively. Let's drop them.
-${1:?} -dM -include errno.h - </dev/null | \
- grep -Ev '^#define[[:space:]]+(ECANCELLED|EREFUSED)' | \
- awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'
+tmp="${TMPDIR:-/tmp}/generate-errno-list.$$"
+trap 'rm -f "$tmp"' EXIT HUP INT TERM
+
+# Meson passes the preprocessor invocation as a single argument.
+set -- ${1:?}
+"$@" -dM -include errno.h - </dev/null >"$tmp"
+
+awk '
+ !/^#define[[:space:]]+(ECANCELLED|EREFUSED)/ &&
+ /^#define[ \t]+E[^ _]+[ \t]+/ {
+ print $2
+ }
+' "$tmp"
diff -urN a/src/basic/user-util.c b/src/basic/user-util.c
--- a/src/basic/user-util.c 2025-11-18 01:14:12.000000000 -0600
+++ b/src/basic/user-util.c 2026-03-29 14:50:19.142523116 -0500
@@ -160,7 +160,7 @@
const char* default_root_shell_at(int rfd) {
/* We want to use the preferred shell, i.e. DEFAULT_USER_SHELL, which usually
- * will be /bin/bash. Fall back to /bin/sh if DEFAULT_USER_SHELL is not found,
+ * will be /bin/sh. Fall back to /bin/sh if DEFAULT_USER_SHELL is not found,
* or any access errors. */
assert(rfd >= 0 || rfd == AT_FDCWD);
diff -urN a/tools/check-api-docs.sh b/tools/check-api-docs.sh
--- a/tools/check-api-docs.sh 2025-11-18 01:14:12.000000000 -0600
+++ b/tools/check-api-docs.sh 2026-03-29 14:50:58.129496657 -0500
@@ -1,44 +1,42 @@
-#!/usr/bin/env bash
+#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
-set -o pipefail
sd_good=0
sd_total=0
udev_good=0
udev_total=0
+nm_file="${TMPDIR:-/tmp}/check-api-docs.nm.$$"
+symbols_file="${TMPDIR:-/tmp}/check-api-docs.symbols.$$"
+trap 'rm -f "$nm_file" "$symbols_file"' EXIT HUP INT TERM
-deprecated=(
- -e sd_bus_try_close
- -e sd_bus_process_priority
- -e sd_bus_message_get_priority
- -e sd_bus_message_set_priority
- -e sd_seat_can_multi_session
- -e sd_journal_open_container
-)
+nm -g --defined-only "$@" >"$nm_file"
+awk '/ T / { print $3; }' "$nm_file" | \
+ grep -E -v '^(sd_bus_try_close|sd_bus_process_priority|sd_bus_message_get_priority|sd_bus_message_set_priority|sd_seat_can_multi_session|sd_journal_open_container)$' | \
+ sort -u >"$symbols_file"
-for symbol in $(nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | grep -wv "${deprecated[@]}" | sort -u); do
+while IFS= read -r symbol; do
if test -f "${MESON_BUILD_ROOT:?}/man/$symbol.3"; then
echo "✓ Symbol $symbol() is documented."
good=1
else
- echo -e " \x1b[1;31mSymbol $symbol() lacks documentation.\x1b[0m"
+ printf ' \033[1;31mSymbol %s() lacks documentation.\033[0m\n' "$symbol"
good=0
fi
case "$symbol" in
sd_*)
- ((sd_good+=good))
- ((sd_total+=1))
+ sd_good=$((sd_good + good))
+ sd_total=$((sd_total + 1))
;;
udev_*)
- ((udev_good+=good))
- ((udev_total+=1))
+ udev_good=$((udev_good + good))
+ udev_total=$((udev_total + 1))
;;
*)
echo 'unknown symbol prefix'
exit 1
esac
-done
+done <"$symbols_file"
echo "libsystemd: $sd_good/$sd_total libudev: $udev_good/$udev_total"
diff -urN a/tools/check-help.sh b/tools/check-help.sh
--- a/tools/check-help.sh 2025-11-18 01:14:12.000000000 -0600
+++ b/tools/check-help.sh 2026-03-29 14:49:52.742863560 -0500
@@ -1,7 +1,6 @@
-#!/usr/bin/env bash
+#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
-set -o pipefail
# Note: 'grep ... >/dev/null' instead of just 'grep -q' is used intentionally
# here, since 'grep -q' exits on the first match causing SIGPIPE being
@@ -9,39 +8,48 @@
BINARY="${1:?}"
export SYSTEMD_LOG_LEVEL=info
+help_out="${TMPDIR:-/tmp}/check-help.out.$$"
+help_err="${TMPDIR:-/tmp}/check-help.err.$$"
+short_out="${TMPDIR:-/tmp}/check-help-short.out.$$"
+bad_err="${TMPDIR:-/tmp}/check-help-bad.err.$$"
+trap 'rm -f "$help_out" "$help_err" "$short_out" "$bad_err"' EXIT HUP INT TERM
-if [[ ! -x "$BINARY" ]]; then
+if [ ! -x "$BINARY" ]; then
echo "$BINARY is not an executable"
exit 1
fi
+"$BINARY" --help >"$help_out" 2>"$help_err"
+
# output width
-if "$BINARY" --help | grep -v 'default:' | grep -E '.{80}.' >/dev/null; then
+if grep -v 'default:' "$help_out" | grep -E '.{80}.' >/dev/null; then
echo "$(basename "$BINARY") --help output is too wide:"
- "$BINARY" --help | awk 'length > 80' | grep -E --color=yes '.{80}'
+ awk 'length > 80' "$help_out" | grep -E --color=yes '.{80}'
exit 1
fi
# --help prints something. Also catches case where args are ignored.
-if ! "$BINARY" --help | grep . >/dev/null; then
+if ! grep . "$help_out" >/dev/null; then
echo "$(basename "$BINARY") --help output is empty"
exit 2
fi
# no --help output to stderr
-if "$BINARY" --help 2>&1 1>/dev/null | grep .; then
+if grep . "$help_err" >/dev/null; then
echo "$(basename "$BINARY") --help prints to stderr"
exit 3
fi
# error output to stderr
-if ! ("$BINARY" --no-such-parameter 2>&1 1>/dev/null || :) | grep . >/dev/null; then
+("$BINARY" --no-such-parameter >/dev/null 2>"$bad_err" || :)
+if ! grep . "$bad_err" >/dev/null; then
echo "$(basename "$BINARY") with an unknown parameter does not print to stderr"
exit 4
fi
# --help and -h are equivalent
-if ! diff <("$BINARY" -h) <("$BINARY" --help); then
+"$BINARY" -h >"$short_out" 2>/dev/null
+if ! diff "$short_out" "$help_out"; then
echo "$(basename "$BINARY") --help and -h are not identical"
exit 5
fi
diff -urN a/tools/check-version.sh b/tools/check-version.sh
--- a/tools/check-version.sh 2025-11-18 01:14:12.000000000 -0600
+++ b/tools/check-version.sh 2026-03-29 14:49:52.742863560 -0500
@@ -1,7 +1,6 @@
-#!/usr/bin/env bash
+#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
-set -o pipefail
# Note: 'grep ... >/dev/null' instead of just 'grep -q' is used intentionally
# here, since 'grep -q' exits on the first match causing SIGPIPE being
@@ -10,27 +9,32 @@
BINARY="${1:?}"
VERSION="${2:?}"
export SYSTEMD_LOG_LEVEL=info
+version_out="${TMPDIR:-/tmp}/check-version.out.$$"
+version_err="${TMPDIR:-/tmp}/check-version.err.$$"
+trap 'rm -f "$version_out" "$version_err"' EXIT HUP INT TERM
-if [[ ! -x "$BINARY" ]]; then
+if [ ! -x "$BINARY" ]; then
echo "$BINARY is not an executable"
exit 1
fi
+"$BINARY" --version >"$version_out" 2>"$version_err"
+
# --version prints something. Also catches case where args are ignored.
-if ! "$BINARY" --version | grep . >/dev/null; then
+if ! grep . "$version_out" >/dev/null; then
echo "$(basename "$BINARY") --version output is empty"
exit 2
fi
# no --version output to stderr
-if "$BINARY" --version 2>&1 1>/dev/null | grep .; then
+if grep . "$version_err" >/dev/null; then
echo "$(basename "$BINARY") --version prints to stderr"
exit 3
fi
# project version appears in version output
-out="$("$BINARY" --version)"
-if ! grep -F "$VERSION" >/dev/null <<<"$out"; then
+out=$(cat "$version_out")
+if ! grep -F "$VERSION" "$version_out" >/dev/null; then
echo "$(basename "$BINARY") --version output does not match '$VERSION': $out"
exit 4
fi
diff -urN a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh
--- a/tools/meson-vcs-tag.sh 2025-11-18 01:14:12.000000000 -0600
+++ b/tools/meson-vcs-tag.sh 2026-03-29 14:49:52.742863560 -0500
@@ -1,8 +1,7 @@
-#!/usr/bin/env bash
+#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -u
-set -o pipefail
dir="${1:?}"
fallback="${2:?}"