Skip to content

Commit

Permalink
Revert "chore: Downgrade to 256"
Browse files Browse the repository at this point in the history
This reverts commit 28665f5.
  • Loading branch information
KyleGospo committed Nov 18, 2024
1 parent 4787a15 commit 170f3f4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 37 deletions.
27 changes: 14 additions & 13 deletions staging/systemd/0001-tmpfiles-make-purge-hard-to-mis-use.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 1e788a7fb535a37a8268aa7dc5130f670eb72a6b Mon Sep 17 00:00:00 2001
From 45cfee930ab4067348cea5244c9c2dc31c64d14d Mon Sep 17 00:00:00 2001
From: Daan De Meyer <[email protected]>
Date: Tue, 23 Jul 2024 13:14:05 +0200
Subject: [PATCH] tmpfiles: make --purge hard to (mis-)use
Expand All @@ -10,18 +10,18 @@ Follow-up for https://github.com/systemd/systemd/pull/33383.
2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 8cc8c1ccd6..14048545db 100644
index 5a4f989668..c5b544f1df 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -4197,6 +4197,7 @@ static int parse_argv(int argc, char *argv[]) {
@@ -4213,6 +4213,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_IMAGE_POLICY,
ARG_REPLACE,
ARG_DRY_RUN,
+ ARG_DESTROY_DATA,
ARG_NO_PAGER,
};

@@ -4220,10 +4221,18 @@ static int parse_argv(int argc, char *argv[]) {
@@ -4236,10 +4237,18 @@ static int parse_argv(int argc, char *argv[]) {
{ "replace", required_argument, NULL, ARG_REPLACE },
{ "dry-run", no_argument, NULL, ARG_DRY_RUN },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
Expand All @@ -40,7 +40,7 @@ index 8cc8c1ccd6..14048545db 100644

assert(argc >= 0);
assert(argv);
@@ -4330,6 +4339,10 @@ static int parse_argv(int argc, char *argv[]) {
@@ -4346,6 +4355,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_dry_run = true;
break;

Expand All @@ -51,7 +51,7 @@ index 8cc8c1ccd6..14048545db 100644
case ARG_NO_PAGER:
arg_pager_flags |= PAGER_DISABLE;
break;
@@ -4349,6 +4362,10 @@ static int parse_argv(int argc, char *argv[]) {
@@ -4365,6 +4378,10 @@ static int parse_argv(int argc, char *argv[]) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Refusing --purge without specification of a configuration file.");

Expand All @@ -63,26 +63,27 @@ index 8cc8c1ccd6..14048545db 100644
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Option --replace= is not supported with --cat-config/--tldr.");
diff --git a/test/units/TEST-22-TMPFILES.18.sh b/test/units/TEST-22-TMPFILES.18.sh
index 5d24197c81..de23bbb95f 100755
index c81f6bd0ef..dd536172d4 100755
--- a/test/units/TEST-22-TMPFILES.18.sh
+++ b/test/units/TEST-22-TMPFILES.18.sh
@@ -21,7 +21,7 @@ systemd-tmpfiles --purge --dry-run - <<<"$c"
test -f /tmp/somedir/somefile
@@ -24,7 +24,7 @@ test -f /tmp/somedir/somefile
grep -q baz /tmp/somedir/somefile
grep -q qux /tmp/someotherfile

-systemd-tmpfiles --purge - <<<"$c"
+systemd-tmpfiles --purge --destroy-data - <<<"$c"
test ! -f /tmp/somedir/somefile
test ! -d /tmp/somedir/

@@ -29,6 +29,6 @@ systemd-tmpfiles --create --purge --dry-run - <<<"$c"
test ! -f /tmp/somedir/somefile
grep -q qux /tmp/someotherfile
@@ -34,7 +34,7 @@ test ! -f /tmp/somedir/somefile
test ! -d /tmp/somedir/
grep -q qux /tmp/someotherfile

-systemd-tmpfiles --create --purge - <<<"$c"
+systemd-tmpfiles --create --destroy-data --purge - <<<"$c"
test -f /tmp/somedir/somefile
grep -q baz /tmp/somedir/somefile
grep -q qux /tmp/someotherfile
--
2.45.2
2.47.0

51 changes: 28 additions & 23 deletions staging/systemd/systemd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Name: systemd
Url: https://systemd.io
# Allow users to specify the version and release when building the rpm by
# setting the %%version_override and %%release_override macros.
Version: %{?version_override}%{!?version_override:256.8}
Version: %{?version_override}%{!?version_override:257~rc2}
Release: %autorelease.ublue.1

%global stable %(c="%version"; [ "$c" = "${c#*.*}" ]; echo $?)
Expand Down Expand Up @@ -116,9 +116,6 @@ GIT_DIR=../../src/systemd/.git git diffab -M v233..master@{2017-06-15} -- hwdb/[
Patch0010: https://github.com/systemd/systemd/pull/26494.patch
%endif

# Requested in https://bugzilla.redhat.com/show_bug.cgi?id=2298422
Patch0011: https://github.com/systemd/systemd/pull/33738.patch

# Those are downstream-only patches, but we don't want them in packit builds:
# https://bugzilla.redhat.com/show_bug.cgi?id=2251843
Patch0491: https://github.com/systemd/systemd/pull/30846.patch
Expand Down Expand Up @@ -175,7 +172,7 @@ BuildRequires: libcurl-devel
BuildRequires: kmod-devel
BuildRequires: elfutils-devel
BuildRequires: openssl-devel
%if 0%{?fedora} >= 41 || 0%{?rhel} >= 11
%if 0%{?fedora} >= 41
BuildRequires: openssl-devel-engine
%endif
%if %{with gnutls}
Expand Down Expand Up @@ -698,6 +695,10 @@ main systemd package and is meant for use in exitrds.
%autosetup -n %{name}-%{version_no_tilde} -p1
%endif

# Disable user lockdown until rpm implements it natively.
# https://github.com/rpm-software-management/rpm/issues/3450
sed -r -i 's/^u!/u/' sysusers.d/*.conf*

%build
%global ntpvendor %(source /etc/os-release; echo ${ID})
%{!?ntpvendor: echo 'NTP vendor zone is not set!'; exit 1}
Expand Down Expand Up @@ -1051,6 +1052,16 @@ meson test -C %{_vpath_builddir} -t 6 --print-errorlogs

%include %{SOURCE1}

# This macro is newly added upstream so we can't rely on it being always being available
# in the systemd-rpm-macros yet so we define it ourselves.
%global systemd_posttrans_with_restart() \
%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_posttrans_with_restart}} \
if [ $1 -ge 2 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then \
# Package upgrade, not install \
/usr/lib/systemd/systemd-update-helper mark-restart-system-units %* || : \
fi \
%{nil}

%post
systemd-machine-id-setup &>/dev/null || :

Expand All @@ -1074,22 +1085,22 @@ systemd-tmpfiles --create &>/dev/null || :
systemctl preset-all &>/dev/null || :
systemctl --global preset-all &>/dev/null || :

%postun
if [ $1 -ge 1 ]; then
%posttrans
if [ $1 -ge 2 ]; then
[ -w %{_localstatedir} ] && journalctl --update-catalog || :

systemctl daemon-reexec || :

systemd-tmpfiles --create &>/dev/null || :
fi

%systemd_postun_with_restart systemd-timedated.service systemd-hostnamed.service systemd-journald.service systemd-localed.service systemd-userdbd.service
%systemd_posttrans_with_restart systemd-timedated.service systemd-hostnamed.service systemd-journald.service systemd-localed.service systemd-userdbd.service

# FIXME: systemd-logind.service is excluded (https://github.com/systemd/systemd/pull/17558)

# This is the expanded form of %%systemd_user_daemon_reexec. We
# can't use the macro because we define it ourselves.
if [ $1 -ge 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
if [ $1 -ge 2 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
# Package upgrade, not uninstall
/usr/lib/systemd/systemd-update-helper user-reexec || :
fi
Expand Down Expand Up @@ -1136,11 +1147,10 @@ grep -q -E '^KEYMAP="?fi-latin[19]"?' /etc/vconsole.conf 2>/dev/null &&
%preun udev
%systemd_preun %udev_services

%postun udev
%posttrans udev
# Restart some services.
# Others are either oneshot services, or sockets, and restarting them causes issues (#1378974)
%systemd_postun_with_restart systemd-udevd.service systemd-timesyncd.service

%systemd_posttrans_with_restart systemd-udevd.service systemd-timesyncd.service

%global journal_remote_units_restart systemd-journal-gatewayd.service systemd-journal-remote.service systemd-journal-upload.service
%global journal_remote_units_norestart systemd-journal-gatewayd.socket systemd-journal-remote.socket
Expand All @@ -1158,8 +1168,8 @@ if [ $1 -eq 1 ] ; then
fi
fi

%postun journal-remote
%systemd_postun_with_restart %journal_remote_units_restart
%posttrans journal-remote
%systemd_posttrans_with_restart %journal_remote_units_restart
%firewalld_reload

%post networkd
Expand All @@ -1181,9 +1191,8 @@ fi
%preun networkd
%systemd_preun systemd-networkd.service systemd-networkd-wait-online.service

%postun networkd
%systemd_postun_with_restart systemd-networkd.service
%systemd_postun systemd-networkd-wait-online.service
%posttrans networkd
%systemd_posttrans_with_restart systemd-networkd.service

%post resolved
[ $1 -eq 1 ] || exit 0
Expand All @@ -1200,10 +1209,8 @@ fi
%systemd_post systemd-resolved.service

%preun resolved
%systemd_preun systemd-resolved.service
if [ $1 -eq 0 ] ; then
systemctl disable --quiet \
systemd-resolved.service \
>/dev/null || :
if [ -L /etc/resolv.conf ] && \
realpath /etc/resolv.conf | grep ^/run/systemd/resolve/; then
rm -f /etc/resolv.conf # no longer useful
Expand All @@ -1214,10 +1221,8 @@ if [ $1 -eq 0 ] ; then
fi
fi

%postun resolved
%systemd_postun_with_restart systemd-resolved.service

%posttrans resolved
%systemd_posttrans_with_restart systemd-resolved.service
[ -e %{_localstatedir}/lib/rpm-state/systemd-resolved.initial-installation ] || exit 0
rm %{_localstatedir}/lib/rpm-state/systemd-resolved.initial-installation
# Initial installation
Expand Down
2 changes: 1 addition & 1 deletion staging/systemd/test_sysusers_defined.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def parse_sysusers_file(filename):
continue
words = line.split()
match words[0]:
case 'u':
case 'u'|'u!':
users.add(words[1])
case 'g':
groups.add(words[1])
Expand Down

0 comments on commit 170f3f4

Please sign in to comment.