systemd-252-15
Resolves: #2100440,#2143107,#2183546,#2203133
This commit is contained in:
parent
2a07d74ee6
commit
96f92a96d3
@ -0,0 +1,47 @@
|
||||
From e92d004898cb36db27a2ceba6647793ff9617561 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Macku <jamacku@redhat.com>
|
||||
Date: Thu, 30 Mar 2023 17:07:51 +0200
|
||||
Subject: [PATCH] ci: trigger `differential-shellcheck` workflow on push
|
||||
|
||||
Fixes: redhat-plumbers-in-action/differential-shellcheck#215
|
||||
|
||||
rhel-only
|
||||
|
||||
Related: #2100440
|
||||
---
|
||||
.github/workflows/differential-shellcheck.yml | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/.github/workflows/differential-shellcheck.yml b/.github/workflows/differential-shellcheck.yml
|
||||
index 105f92d1c9..3662126304 100644
|
||||
--- a/.github/workflows/differential-shellcheck.yml
|
||||
+++ b/.github/workflows/differential-shellcheck.yml
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
name: Differential ShellCheck
|
||||
on:
|
||||
+ push:
|
||||
+ branches:
|
||||
+ - main
|
||||
+ - rhel-9.*.0
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
@@ -18,15 +22,14 @@ jobs:
|
||||
|
||||
permissions:
|
||||
security-events: write
|
||||
- pull-requests: write
|
||||
|
||||
steps:
|
||||
- name: Repository checkout
|
||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||
+ uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Differential ShellCheck
|
||||
- uses: redhat-plumbers-in-action/differential-shellcheck@1b1b75e42f0694c1012228513b21617a748c866e
|
||||
+ uses: redhat-plumbers-in-action/differential-shellcheck@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
@ -0,0 +1,51 @@
|
||||
From 44f29dde7b88fbaed0972b155a6c7c4751f74839 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Macku <jamacku@redhat.com>
|
||||
Date: Mon, 17 Apr 2023 14:51:19 +0200
|
||||
Subject: [PATCH] ci: workflow for gathering metadata for source-git automation
|
||||
|
||||
Workflow gathers metadata like pull request numbers and information about commits.
|
||||
This metadata is used for commit validation and other actions.
|
||||
This workflow also triggers for rest of the source-git automation workflows.
|
||||
|
||||
rhel-only
|
||||
|
||||
Related: #2100440
|
||||
---
|
||||
.github/workflows/gather-metadata.yml | 28 +++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
create mode 100644 .github/workflows/gather-metadata.yml
|
||||
|
||||
diff --git a/.github/workflows/gather-metadata.yml b/.github/workflows/gather-metadata.yml
|
||||
new file mode 100644
|
||||
index 0000000000..635708a71f
|
||||
--- /dev/null
|
||||
+++ b/.github/workflows/gather-metadata.yml
|
||||
@@ -0,0 +1,28 @@
|
||||
+name: Gather Pull Request Metadata
|
||||
+on:
|
||||
+ pull_request:
|
||||
+ types: [ opened, reopened, synchronize ]
|
||||
+ branches:
|
||||
+ - main
|
||||
+ - rhel-9.*.0
|
||||
+
|
||||
+permissions:
|
||||
+ contents: read
|
||||
+
|
||||
+jobs:
|
||||
+ gather-metadata:
|
||||
+ runs-on: ubuntu-latest
|
||||
+
|
||||
+ steps:
|
||||
+ - name: Repository checkout
|
||||
+ uses: actions/checkout@v3
|
||||
+
|
||||
+ - id: Metadata
|
||||
+ name: Gather Pull Request Metadata
|
||||
+ uses: redhat-plumbers-in-action/gather-pull-request-metadata@v1
|
||||
+
|
||||
+ - name: Upload artifact with gathered metadata
|
||||
+ uses: actions/upload-artifact@v3
|
||||
+ with:
|
||||
+ name: pr-metadata
|
||||
+ path: ${{ steps.Metadata.outputs.metadata-file }}
|
103
0237-ci-first-part-of-the-source-git-automation-commit-li.patch
Normal file
103
0237-ci-first-part-of-the-source-git-automation-commit-li.patch
Normal file
@ -0,0 +1,103 @@
|
||||
From 6a84f210a9a4dd4fde22ea5d60dff46cad36597f Mon Sep 17 00:00:00 2001
|
||||
From: Jan Macku <jamacku@redhat.com>
|
||||
Date: Mon, 17 Apr 2023 14:59:55 +0200
|
||||
Subject: [PATCH] ci: first part of the source-git automation - commit linter
|
||||
|
||||
Add a GitHub Workflow that is triggered on `workflow_run` events.
|
||||
It uses metadata provided by `redhat-plumbers-in-action/gather-pull-request-metadata`
|
||||
GitHub Action to get the PR number and the commit metadata.
|
||||
The commit metadata is then used to check if the commit message contains
|
||||
all required information (tracker and upstream reference). GitHub Action
|
||||
responsible for commit verification `redhat-plumbers-in-action/advanced-commit-linter`
|
||||
is configured via the `advanced-commit-linter.yml` file.
|
||||
|
||||
rhel-only
|
||||
|
||||
Related: #2100440
|
||||
---
|
||||
.github/advanced-commit-linter.yml | 23 +++++++++++
|
||||
.github/workflows/source-git-automation.yml | 45 +++++++++++++++++++++
|
||||
2 files changed, 68 insertions(+)
|
||||
create mode 100644 .github/advanced-commit-linter.yml
|
||||
create mode 100644 .github/workflows/source-git-automation.yml
|
||||
|
||||
diff --git a/.github/advanced-commit-linter.yml b/.github/advanced-commit-linter.yml
|
||||
new file mode 100644
|
||||
index 0000000000..491836abbb
|
||||
--- /dev/null
|
||||
+++ b/.github/advanced-commit-linter.yml
|
||||
@@ -0,0 +1,23 @@
|
||||
+policy:
|
||||
+ cherry-pick:
|
||||
+ upstream:
|
||||
+ - github: systemd/systemd
|
||||
+ - github: systemd/systemd-stable
|
||||
+ exception:
|
||||
+ note:
|
||||
+ - rhel-only
|
||||
+ tracker:
|
||||
+ - keyword:
|
||||
+ - 'Resolves: #?'
|
||||
+ - 'Related: #?'
|
||||
+ - 'Reverts: #?'
|
||||
+ issue-format:
|
||||
+ - '\d+$'
|
||||
+ url: 'https://bugzilla.redhat.com/show_bug.cgi?id='
|
||||
+ - keyword:
|
||||
+ - 'Resolves: '
|
||||
+ - 'Related: '
|
||||
+ - 'Reverts: '
|
||||
+ issue-format:
|
||||
+ - 'RHEL-\d+$'
|
||||
+ url: 'https://issues.redhat.com/browse/'
|
||||
diff --git a/.github/workflows/source-git-automation.yml b/.github/workflows/source-git-automation.yml
|
||||
new file mode 100644
|
||||
index 0000000000..140f21b116
|
||||
--- /dev/null
|
||||
+++ b/.github/workflows/source-git-automation.yml
|
||||
@@ -0,0 +1,45 @@
|
||||
+name: Source git Automation
|
||||
+on:
|
||||
+ workflow_run:
|
||||
+ workflows: [ Gather Pull Request Metadata ]
|
||||
+ types:
|
||||
+ - completed
|
||||
+
|
||||
+permissions:
|
||||
+ contents: read
|
||||
+
|
||||
+jobs:
|
||||
+ download-metadata:
|
||||
+ if: >
|
||||
+ github.event.workflow_run.event == 'pull_request' &&
|
||||
+ github.event.workflow_run.conclusion == 'success'
|
||||
+ runs-on: ubuntu-latest
|
||||
+
|
||||
+ outputs:
|
||||
+ pr-metadata: ${{ steps.Artifact.outputs.pr-metadata-json }}
|
||||
+
|
||||
+ steps:
|
||||
+ - id: Artifact
|
||||
+ name: Download Artifact
|
||||
+ uses: redhat-plumbers-in-action/download-artifact@v1
|
||||
+ with:
|
||||
+ name: pr-metadata
|
||||
+
|
||||
+ commit-linter:
|
||||
+ needs: [ download-metadata ]
|
||||
+ runs-on: ubuntu-latest
|
||||
+
|
||||
+ outputs:
|
||||
+ validated-pr-metadata: ${{ steps.commit-linter.outputs.validated-pr-metadata }}
|
||||
+
|
||||
+ permissions:
|
||||
+ statuses: write
|
||||
+ pull-requests: write
|
||||
+
|
||||
+ steps:
|
||||
+ - id: commit-linter
|
||||
+ name: Lint Commits
|
||||
+ uses: redhat-plumbers-in-action/advanced-commit-linter@v1
|
||||
+ with:
|
||||
+ pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }}
|
||||
+ token: ${{ secrets.GITHUB_TOKEN }}
|
107
0238-ci-Mergify-check-CodeQL-and-build-workflows-based-on.patch
Normal file
107
0238-ci-Mergify-check-CodeQL-and-build-workflows-based-on.patch
Normal file
@ -0,0 +1,107 @@
|
||||
From 049f899364c844326d00ee81b0a4f022315a8206 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Macku <jamacku@redhat.com>
|
||||
Date: Tue, 25 Apr 2023 15:18:39 +0200
|
||||
Subject: [PATCH] ci(Mergify): check CodeQL and build workflows based on
|
||||
changed files
|
||||
|
||||
CodeQL and build workflow aren't run for all PRs. They are only run when specific files are changed.
|
||||
|
||||
from the CodeQL workflow:
|
||||
|
||||
```yml
|
||||
paths:
|
||||
- '**/meson.build'
|
||||
- '.github/**/codeql*'
|
||||
- 'src/**'
|
||||
- 'test/**'
|
||||
- 'tools/**'
|
||||
```
|
||||
|
||||
This results in Mergify incorrectly labeling PRs with `needs-ci` label.
|
||||
Let's update the Mergify config to check for the changed files as well.
|
||||
|
||||
rhel-only
|
||||
|
||||
Related: #2100440
|
||||
---
|
||||
.mergify.yml | 40 +++++++++++++++++++++++++++-------------
|
||||
1 file changed, 27 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/.mergify.yml b/.mergify.yml
|
||||
index bc1743e8ea..e862808ca7 100644
|
||||
--- a/.mergify.yml
|
||||
+++ b/.mergify.yml
|
||||
@@ -9,11 +9,15 @@ pull_request_rules:
|
||||
- label!=ci-waived
|
||||
- or:
|
||||
# Build test
|
||||
- - -check-success=build (gcc, 11, bfd, gcrypt)
|
||||
- - -check-success=build (gcc, 12, gold, openssl)
|
||||
- - -check-success=build (clang, 13, mold, gcrypt)
|
||||
- - -check-success=build (clang, 14, lld, openssl)
|
||||
- - -check-success=build (clang, 15, bfd, auto)
|
||||
+ # test build check only when the tests have been run ...
|
||||
+ - and:
|
||||
+ - files~=^(\S+\/meson\.build|\.github\/workflows\/\S+|meson_options\.txt|src\/\S+|test\/fuzz\/\S+)
|
||||
+ - or:
|
||||
+ - -check-success=build (gcc, 11, bfd, gcrypt)
|
||||
+ - -check-success=build (gcc, 12, gold, openssl)
|
||||
+ - -check-success=build (clang, 13, mold, gcrypt)
|
||||
+ - -check-success=build (clang, 14, lld, openssl)
|
||||
+ - -check-success=build (clang, 15, bfd, auto)
|
||||
# Unit tests
|
||||
- -check-success=build (GCC, auto)
|
||||
- -check-success=build (GCC_ASAN_UBSAN, auto)
|
||||
@@ -30,14 +34,17 @@ pull_request_rules:
|
||||
# CentOS CI
|
||||
- -check-success=CentOS CI (CentOS Stream 9)
|
||||
- -check-success=CentOS CI (CentOS Stream 9 + sanitizers)
|
||||
- # CodeQL
|
||||
- - -check-success=CodeQL
|
||||
# Packit
|
||||
- -check-success=rpm-build:centos-stream-9-aarch64
|
||||
- -check-success=rpm-build:centos-stream-9-x86_64
|
||||
# Other
|
||||
- -check-success=Lint Code Base
|
||||
- -check-success=Differential ShellCheck
|
||||
+ # CodeQL
|
||||
+ # test CodeQL check only when the CodeQL have been run ...
|
||||
+ - and:
|
||||
+ - files~=^(\S+\/meson\.build|\.github\/\S+\/codeql|src\/\S+|test\/\S+|tools\/\S+)
|
||||
+ - -check-success=CodeQL
|
||||
actions:
|
||||
label:
|
||||
add:
|
||||
@@ -81,11 +88,15 @@ pull_request_rules:
|
||||
- label=ci-waived
|
||||
- and:
|
||||
# Build test
|
||||
- - check-success=build (gcc, 11, bfd, gcrypt)
|
||||
- - check-success=build (gcc, 12, gold, openssl)
|
||||
- - check-success=build (clang, 13, mold, gcrypt)
|
||||
- - check-success=build (clang, 14, lld, openssl)
|
||||
- - check-success=build (clang, 15, bfd, auto)
|
||||
+ # test build check only when specific files are changed ...
|
||||
+ - or:
|
||||
+ - -files~=^(\S+\/meson\.build|\.github\/workflows\/\S+|meson_options\.txt|src\/\S+|test\/fuzz\/\S+)
|
||||
+ - and:
|
||||
+ - check-success=build (gcc, 11, bfd, gcrypt)
|
||||
+ - check-success=build (gcc, 12, gold, openssl)
|
||||
+ - check-success=build (clang, 13, mold, gcrypt)
|
||||
+ - check-success=build (clang, 14, lld, openssl)
|
||||
+ - check-success=build (clang, 15, bfd, auto)
|
||||
# Unit tests
|
||||
- check-success=build (GCC, auto)
|
||||
- check-success=build (GCC_ASAN_UBSAN, auto)
|
||||
@@ -103,7 +114,10 @@ pull_request_rules:
|
||||
- check-success=CentOS CI (CentOS Stream 9)
|
||||
- check-success=CentOS CI (CentOS Stream 9 + sanitizers)
|
||||
# CodeQL
|
||||
- - check-success=CodeQL
|
||||
+ # test CodeQL check only when specific files are changed ...
|
||||
+ - or:
|
||||
+ - -files~=^(\S+\/meson\.build|\.github\/\S+\/codeql|src\/\S+|test\/\S+|tools\/\S+)
|
||||
+ - check-success=CodeQL
|
||||
# Packit
|
||||
- check-success=rpm-build:centos-stream-9-aarch64
|
||||
- check-success=rpm-build:centos-stream-9-x86_64
|
@ -0,0 +1,38 @@
|
||||
From e6c01cbcf4cd9b7a3d4ed93e5c6693d83b735c0e Mon Sep 17 00:00:00 2001
|
||||
From: Jan Macku <jamacku@redhat.com>
|
||||
Date: Thu, 27 Apr 2023 18:29:26 +0200
|
||||
Subject: [PATCH] ci: add NOTICE to also update regexp in `.mergify.yml` when
|
||||
updating `paths` property
|
||||
|
||||
rhel-only
|
||||
|
||||
Related: #2100440
|
||||
---
|
||||
.github/workflows/build_test.yml | 1 +
|
||||
.github/workflows/codeql.yml | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml
|
||||
index cd6937e390..fdd5a462b6 100644
|
||||
--- a/.github/workflows/build_test.yml
|
||||
+++ b/.github/workflows/build_test.yml
|
||||
@@ -6,6 +6,7 @@ name: Build test
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
+ # If changed, also change regexp in `.mergify.yml`
|
||||
- '**/meson.build'
|
||||
- '.github/workflows/**'
|
||||
- 'meson_options.txt'
|
||||
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
|
||||
index e8236b1857..3ee772b370 100644
|
||||
--- a/.github/workflows/codeql.yml
|
||||
+++ b/.github/workflows/codeql.yml
|
||||
@@ -10,6 +10,7 @@ on:
|
||||
- main
|
||||
- rhel-9.*.0
|
||||
paths:
|
||||
+ # If changed, also change regexp in `.mergify.yml`
|
||||
- '**/meson.build'
|
||||
- '.github/**/codeql*'
|
||||
- 'src/**'
|
205
0240-Support-etc-system-update-for-OSTree-systems.patch
Normal file
205
0240-Support-etc-system-update-for-OSTree-systems.patch
Normal file
@ -0,0 +1,205 @@
|
||||
From a986415fec990de0ed0c8919d64b1eb6b78c485a Mon Sep 17 00:00:00 2001
|
||||
From: Eric Curtin <ecurtin@redhat.com>
|
||||
Date: Mon, 17 Apr 2023 22:09:24 +0100
|
||||
Subject: [PATCH] Support /etc/system-update for OSTree systems
|
||||
|
||||
(cherry picked from commit b9dac418372401742609bd600f05267ae3a724de)
|
||||
|
||||
Resolves: #2203133
|
||||
---
|
||||
man/systemd-system-update-generator.xml | 2 +-
|
||||
man/systemd.offline-updates.xml | 46 +++++++++++--------
|
||||
man/systemd.special.xml | 9 ++--
|
||||
.../system-update-generator.c | 25 ++++++----
|
||||
units/system-update-cleanup.service | 4 +-
|
||||
5 files changed, 51 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/man/systemd-system-update-generator.xml b/man/systemd-system-update-generator.xml
|
||||
index 8711be26e3..1611a71550 100644
|
||||
--- a/man/systemd-system-update-generator.xml
|
||||
+++ b/man/systemd-system-update-generator.xml
|
||||
@@ -30,7 +30,7 @@
|
||||
<para><filename>systemd-system-update-generator</filename> is a
|
||||
generator that automatically redirects the boot process to
|
||||
<filename>system-update.target</filename>, if
|
||||
- <filename>/system-update</filename> exists. This is required to
|
||||
+ <filename>/system-update</filename> or <filename>/etc/system-update</filename> exists. This is required to
|
||||
implement the logic explained in the
|
||||
<citerefentry><refentrytitle>systemd.offline-updates</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
|
||||
</para>
|
||||
diff --git a/man/systemd.offline-updates.xml b/man/systemd.offline-updates.xml
|
||||
index 6706451766..7285f9e263 100644
|
||||
--- a/man/systemd.offline-updates.xml
|
||||
+++ b/man/systemd.offline-updates.xml
|
||||
@@ -40,18 +40,20 @@
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
- <para>When the user OK'ed the update, the symlink <filename>/system-update</filename> is
|
||||
- created that points to <filename index="false">/var/lib/system-update</filename> (or
|
||||
- wherever the directory with the upgrade files is located) and the system is rebooted. This
|
||||
- symlink is in the root directory, since we need to check for it very early at boot, at a
|
||||
- time where <filename>/var/</filename> is not available yet.</para>
|
||||
+ <para>When the user OK'ed the update, the symlink <filename>/system-update</filename> or
|
||||
+ <filename>/etc/system-update</filename> is created that points to
|
||||
+ <filename index="false">/var/lib/system-update</filename> (or wherever the directory with
|
||||
+ the upgrade files is located) and the system is rebooted. This symlink is in the root
|
||||
+ directory, since we need to check for it very early at boot, at a time where
|
||||
+ <filename>/var/</filename> is not available yet.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Very early in the new boot
|
||||
<citerefentry><refentrytitle>systemd-system-update-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
- checks whether <filename>/system-update</filename> exists. If so, it (temporarily and for
|
||||
- this boot only) redirects (i.e. symlinks) <filename>default.target</filename> to
|
||||
+ checks whether <filename>/system-update</filename> or
|
||||
+ <filename>/etc/system-update</filename> exists. If so, it (temporarily and for this boot
|
||||
+ only) redirects (i.e. symlinks) <filename>default.target</filename> to
|
||||
<filename>system-update.target</filename>, a special target that pulls in the base system
|
||||
(i.e. <filename>sysinit.target</filename>, so that all file systems are mounted but little
|
||||
else) and the system update units.</para>
|
||||
@@ -68,12 +70,13 @@
|
||||
|
||||
<listitem>
|
||||
<para>As the first step, an update service should check if the
|
||||
- <filename>/system-update</filename> symlink points to the location used by that update
|
||||
- service. In case it does not exist or points to a different location, the service must exit
|
||||
- without error. It is possible for multiple update services to be installed, and for multiple
|
||||
- update services to be launched in parallel, and only the one that corresponds to the tool
|
||||
- that <emphasis>created</emphasis> the symlink before reboot should perform any actions. It
|
||||
- is unsafe to run multiple updates in parallel.</para>
|
||||
+ <filename>/system-update</filename> or <filename>/etc/system-update</filename> symlink
|
||||
+ points to the location used by that update service. In case it does not exist or points to a
|
||||
+ different location, the service must exit without error. It is possible for multiple update
|
||||
+ services to be installed, and for multiple update services to be launched in parallel, and
|
||||
+ only the one that corresponds to the tool that <emphasis>created</emphasis> the symlink
|
||||
+ before reboot should perform any actions. It is unsafe to run multiple updates in
|
||||
+ parallel.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
@@ -88,14 +91,16 @@
|
||||
<para>The update scripts should exit only after the update is finished. It is expected
|
||||
that the service which performs the update will cause the machine to reboot after it
|
||||
is done. If the <filename>system-update.target</filename> is successfully reached, i.e.
|
||||
- all update services have run, and the <filename>/system-update</filename> symlink still
|
||||
- exists, it will be removed and the machine rebooted as a safety measure.</para>
|
||||
+ all update services have run, and the <filename>/system-update</filename> or
|
||||
+ <filename>/etc/system-update</filename> symlink still exists, it will be removed and
|
||||
+ the machine rebooted as a safety measure.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
- <para>After a reboot, now that the <filename>/system-update</filename> symlink is gone,
|
||||
- the generator won't redirect <filename>default.target</filename> anymore and the system
|
||||
- now boots into the default target again.</para>
|
||||
+ <para>After a reboot, now that the <filename>/system-update</filename> and
|
||||
+ <filename>/etc/system-update</filename> symlink is gone, the generator won't redirect
|
||||
+ <filename>default.target</filename> anymore and the system now boots into the default
|
||||
+ target again.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</refsect1>
|
||||
@@ -115,8 +120,9 @@
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
- <para>Make sure to remove the <filename>/system-update</filename> symlink as early as
|
||||
- possible in the update script to avoid reboot loops in case the update fails.</para>
|
||||
+ <para>Make sure to remove the <filename>/system-update</filename> and
|
||||
+ <filename>/etc/system-update</filename> symlinks as early as possible in the update
|
||||
+ script to avoid reboot loops in case the update fails.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
|
||||
index 85eb8ad076..1620895511 100644
|
||||
--- a/man/systemd.special.xml
|
||||
+++ b/man/systemd.special.xml
|
||||
@@ -753,8 +753,8 @@
|
||||
<listitem>
|
||||
<para>A special target unit that is used for offline system updates.
|
||||
<citerefentry><refentrytitle>systemd-system-update-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
- will redirect the boot process to this target if <filename>/system-update</filename>
|
||||
- exists. For more information see
|
||||
+ will redirect the boot process to this target if <filename>/system-update</filename> or
|
||||
+ <filename>/etc/system-update</filename> exists. For more information see
|
||||
<citerefentry><refentrytitle>systemd.offline-updates</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
|
||||
</para>
|
||||
|
||||
@@ -764,9 +764,10 @@
|
||||
<filename>system-update-pre.target</filename> but not pull it in. Services which want to
|
||||
run during system updates only, but before the actual system update is executed should
|
||||
order themselves before this unit and pull it in. As a safety measure, if this does not
|
||||
- happen, and <filename>/system-update</filename> still exists after
|
||||
+ happen, and <filename>/system-update</filename> or
|
||||
+ <filename>/etc/system-update</filename> still exists after
|
||||
<filename>system-update.target</filename> is reached,
|
||||
- <filename>system-update-cleanup.service</filename> will remove this symlink and reboot
|
||||
+ <filename>system-update-cleanup.service</filename> will remove the symlinks and reboot
|
||||
the machine.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c
|
||||
index fc5aaa9bac..08b357f356 100644
|
||||
--- a/src/system-update-generator/system-update-generator.c
|
||||
+++ b/src/system-update-generator/system-update-generator.c
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "fs-util.h"
|
||||
#include "generator.h"
|
||||
#include "log.h"
|
||||
+#include "path-util.h"
|
||||
#include "proc-cmdline.h"
|
||||
#include "special.h"
|
||||
#include "string-util.h"
|
||||
@@ -19,19 +20,25 @@
|
||||
static const char *arg_dest = NULL;
|
||||
|
||||
static int generate_symlink(void) {
|
||||
- const char *p = NULL;
|
||||
+ _cleanup_free_ char *j = NULL;
|
||||
|
||||
- if (laccess("/system-update", F_OK) < 0) {
|
||||
- if (errno == ENOENT)
|
||||
- return 0;
|
||||
+ FOREACH_STRING(p, "/system-update", "/etc/system-update") {
|
||||
+ if (laccess(p, F_OK) >= 0)
|
||||
+ goto link_found;
|
||||
|
||||
- log_error_errno(errno, "Failed to check for system update: %m");
|
||||
- return -EINVAL;
|
||||
+ if (errno != ENOENT)
|
||||
+ log_warning_errno(errno, "Failed to check if %s symlink exists, ignoring: %m", p);
|
||||
}
|
||||
|
||||
- p = strjoina(arg_dest, "/" SPECIAL_DEFAULT_TARGET);
|
||||
- if (symlink(SYSTEM_DATA_UNIT_DIR "/system-update.target", p) < 0)
|
||||
- return log_error_errno(errno, "Failed to create symlink %s: %m", p);
|
||||
+ return 0;
|
||||
+
|
||||
+link_found:
|
||||
+ j = path_join(arg_dest, SPECIAL_DEFAULT_TARGET);
|
||||
+ if (!j)
|
||||
+ return log_oom();
|
||||
+
|
||||
+ if (symlink(SYSTEM_DATA_UNIT_DIR "/system-update.target", j) < 0)
|
||||
+ return log_error_errno(errno, "Failed to create symlink %s: %m", j);
|
||||
|
||||
return 1;
|
||||
}
|
||||
diff --git a/units/system-update-cleanup.service b/units/system-update-cleanup.service
|
||||
index 5a5dd725a1..a54e74567e 100644
|
||||
--- a/units/system-update-cleanup.service
|
||||
+++ b/units/system-update-cleanup.service
|
||||
@@ -29,7 +29,9 @@ SuccessAction=reboot
|
||||
# reboot or some other action on its own.
|
||||
ConditionPathExists=|/system-update
|
||||
ConditionPathIsSymbolicLink=|/system-update
|
||||
+ConditionPathExists=|/etc/system-update
|
||||
+ConditionPathIsSymbolicLink=|/etc/system-update
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
-ExecStart=rm -fv /system-update
|
||||
+ExecStart=rm -fv /system-update /etc/system-update
|
@ -0,0 +1,26 @@
|
||||
From 05b7dfdcc4893fac9adcbf80bcc3f6a8f8f520c1 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 25 Jan 2023 18:47:05 +0100
|
||||
Subject: [PATCH] journal-def: fix type of signature to match the actual field
|
||||
in the Header structure
|
||||
|
||||
(cherry picked from commit 6fe167d0a77f72086b457125fad6931ca02a4baf)
|
||||
|
||||
Related: #2183546
|
||||
---
|
||||
src/libsystemd/sd-journal/journal-def.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-journal/journal-def.h b/src/libsystemd/sd-journal/journal-def.h
|
||||
index 8f994b0178..ab4880761b 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-def.h
|
||||
+++ b/src/libsystemd/sd-journal/journal-def.h
|
||||
@@ -195,7 +195,7 @@ enum {
|
||||
#endif
|
||||
|
||||
#define HEADER_SIGNATURE \
|
||||
- ((const char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
|
||||
+ ((const uint8_t[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
|
||||
|
||||
#define struct_Header__contents { \
|
||||
uint8_t signature[8]; /* "LPKSHHRH" */ \
|
@ -0,0 +1,63 @@
|
||||
From b418b2d17e258f10211b529f9beb8b090283307f Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 25 Jan 2023 18:48:31 +0100
|
||||
Subject: [PATCH] journal: use compound initialization for journal file Header
|
||||
structure
|
||||
|
||||
(cherry picked from commit c3dd0dcb888fd8da7ce4e5299caf45e90ddcd41b)
|
||||
|
||||
Related: #2183546
|
||||
---
|
||||
src/libsystemd/sd-journal/journal-file.c | 23 +++++++++++------------
|
||||
1 file changed, 11 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
|
||||
index c489436a1e..cf86bab2dc 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.c
|
||||
@@ -320,9 +320,8 @@ static bool compact_mode_requested(void) {
|
||||
}
|
||||
|
||||
static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags, JournalFile *template) {
|
||||
- Header h = {};
|
||||
- ssize_t k;
|
||||
bool seal = false;
|
||||
+ ssize_t k;
|
||||
int r;
|
||||
|
||||
assert(f);
|
||||
@@ -332,16 +331,17 @@ static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags,
|
||||
seal = FLAGS_SET(file_flags, JOURNAL_SEAL) && journal_file_fss_load(f) >= 0;
|
||||
#endif
|
||||
|
||||
- memcpy(h.signature, HEADER_SIGNATURE, 8);
|
||||
- h.header_size = htole64(ALIGN64(sizeof(h)));
|
||||
-
|
||||
- h.incompatible_flags |= htole32(
|
||||
- FLAGS_SET(file_flags, JOURNAL_COMPRESS) *
|
||||
- COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(DEFAULT_COMPRESSION) |
|
||||
- keyed_hash_requested() * HEADER_INCOMPATIBLE_KEYED_HASH |
|
||||
- compact_mode_requested() * HEADER_INCOMPATIBLE_COMPACT);
|
||||
+ Header h = {
|
||||
+ .header_size = htole64(ALIGN64(sizeof(h))),
|
||||
+ .incompatible_flags = htole32(
|
||||
+ FLAGS_SET(file_flags, JOURNAL_COMPRESS) * COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(DEFAULT_COMPRESSION) |
|
||||
+ keyed_hash_requested() * HEADER_INCOMPATIBLE_KEYED_HASH |
|
||||
+ compact_mode_requested() * HEADER_INCOMPATIBLE_COMPACT),
|
||||
+ .compatible_flags = htole32(seal * HEADER_COMPATIBLE_SEALED),
|
||||
+ };
|
||||
|
||||
- h.compatible_flags = htole32(seal * HEADER_COMPATIBLE_SEALED);
|
||||
+ assert_cc(sizeof(h.signature) == sizeof(HEADER_SIGNATURE));
|
||||
+ memcpy(h.signature, HEADER_SIGNATURE, sizeof(HEADER_SIGNATURE));
|
||||
|
||||
r = sd_id128_randomize(&h.file_id);
|
||||
if (r < 0)
|
||||
@@ -356,7 +356,6 @@ static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags,
|
||||
k = pwrite(f->fd, &h, sizeof(h), 0);
|
||||
if (k < 0)
|
||||
return -errno;
|
||||
-
|
||||
if (k != sizeof(h))
|
||||
return -EIO;
|
||||
|
25
0243-journald-fix-log-message.patch
Normal file
25
0243-journald-fix-log-message.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 27c91e79d3cbb79efa9efdd10a7ed5a06c80cba6 Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 17:11:28 +0900
|
||||
Subject: [PATCH] journald: fix log message
|
||||
|
||||
(cherry picked from commit 01aa59979bc61125f599a5b8a6c911fff5daaee7)
|
||||
|
||||
Resolves: #2183546
|
||||
---
|
||||
src/journal/journald-server.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
|
||||
index 71d7a59bda..cbcf1e9d9e 100644
|
||||
--- a/src/journal/journald-server.c
|
||||
+++ b/src/journal/journald-server.c
|
||||
@@ -2011,7 +2011,7 @@ static int vl_method_synchronize(Varlink *link, JsonVariant *parameters, Varlink
|
||||
if (json_variant_elements(parameters) > 0)
|
||||
return varlink_error_invalid_parameter(link, parameters);
|
||||
|
||||
- log_info("Received client request to rotate journal.");
|
||||
+ log_info("Received client request to sync journal.");
|
||||
|
||||
/* We don't do the main work now, but instead enqueue a deferred event loop job which will do
|
||||
* it. That job is scheduled at low priority, so that we return from this method call only after all
|
@ -0,0 +1,66 @@
|
||||
From 509b535eaad77038984604eac486b0bb76accc6d Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 16:43:44 +0900
|
||||
Subject: [PATCH] sd-journal: cache results of parsing environment variables
|
||||
|
||||
(cherry picked from commit 9dfbae203e3afa500163bc46e0070c4cb2180aac)
|
||||
|
||||
Resolves: #2183546
|
||||
---
|
||||
src/libsystemd/sd-journal/journal-file.c | 34 +++++++++++++++---------
|
||||
1 file changed, 22 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
|
||||
index cf86bab2dc..00de564499 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.c
|
||||
@@ -296,27 +296,37 @@ JournalFile* journal_file_close(JournalFile *f) {
|
||||
}
|
||||
|
||||
static bool keyed_hash_requested(void) {
|
||||
+ static thread_local int cached = -1;
|
||||
int r;
|
||||
|
||||
- r = getenv_bool("SYSTEMD_JOURNAL_KEYED_HASH");
|
||||
- if (r >= 0)
|
||||
- return r;
|
||||
- if (r != -ENXIO)
|
||||
- log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_KEYED_HASH environment variable, ignoring: %m");
|
||||
+ if (cached < 0) {
|
||||
+ r = getenv_bool("SYSTEMD_JOURNAL_KEYED_HASH");
|
||||
+ if (r < 0) {
|
||||
+ if (r != -ENXIO)
|
||||
+ log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_KEYED_HASH environment variable, ignoring: %m");
|
||||
+ cached = true;
|
||||
+ } else
|
||||
+ cached = r;
|
||||
+ }
|
||||
|
||||
- return true;
|
||||
+ return cached;
|
||||
}
|
||||
|
||||
static bool compact_mode_requested(void) {
|
||||
+ static thread_local int cached = -1;
|
||||
int r;
|
||||
|
||||
- r = getenv_bool("SYSTEMD_JOURNAL_COMPACT");
|
||||
- if (r >= 0)
|
||||
- return r;
|
||||
- if (r != -ENXIO)
|
||||
- log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_COMPACT environment variable, ignoring: %m");
|
||||
+ if (cached < 0) {
|
||||
+ r = getenv_bool("SYSTEMD_JOURNAL_COMPACT");
|
||||
+ if (r < 0) {
|
||||
+ if (r != -ENXIO)
|
||||
+ log_debug_errno(r, "Failed to parse $SYSTEMD_JOURNAL_COMPACT environment variable, ignoring: %m");
|
||||
+ cached = true;
|
||||
+ } else
|
||||
+ cached = r;
|
||||
+ }
|
||||
|
||||
- return true;
|
||||
+ return cached;
|
||||
}
|
||||
|
||||
static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags, JournalFile *template) {
|
@ -0,0 +1,55 @@
|
||||
From 2c755739d84e409a6331902f5c15943a192a40f4 Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 14:34:32 +0900
|
||||
Subject: [PATCH] compress: introduce compression_supported() helper function
|
||||
|
||||
(cherry picked from commit 83f3d73da8d132773dd91aae0fa7babb74920774)
|
||||
|
||||
Resolves: #2183546
|
||||
---
|
||||
src/basic/compress.c | 10 ++++++++++
|
||||
src/basic/compress.h | 3 +++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/src/basic/compress.c b/src/basic/compress.c
|
||||
index 1e94635397..dce0ebf222 100644
|
||||
--- a/src/basic/compress.c
|
||||
+++ b/src/basic/compress.c
|
||||
@@ -66,6 +66,16 @@ static const char* const compression_table[_COMPRESSION_MAX] = {
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(compression, Compression);
|
||||
|
||||
+bool compression_supported(Compression c) {
|
||||
+ static const unsigned supported =
|
||||
+ (1U << COMPRESSION_NONE) |
|
||||
+ (1U << COMPRESSION_XZ) * HAVE_XZ |
|
||||
+ (1U << COMPRESSION_LZ4) * HAVE_LZ4 |
|
||||
+ (1U << COMPRESSION_ZSTD) * HAVE_ZSTD;
|
||||
+
|
||||
+ return c >= 0 && c < _COMPRESSION_MAX && FLAGS_SET(supported, 1U << c);
|
||||
+}
|
||||
+
|
||||
int compress_blob_xz(const void *src, uint64_t src_size,
|
||||
void *dst, size_t dst_alloc_size, size_t *dst_size) {
|
||||
#if HAVE_XZ
|
||||
diff --git a/src/basic/compress.h b/src/basic/compress.h
|
||||
index 583b105c66..2201bca74c 100644
|
||||
--- a/src/basic/compress.h
|
||||
+++ b/src/basic/compress.h
|
||||
@@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <errno.h>
|
||||
+#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -17,6 +18,8 @@ typedef enum Compression {
|
||||
const char* compression_to_string(Compression compression);
|
||||
Compression compression_from_string(const char *compression);
|
||||
|
||||
+bool compression_supported(Compression c);
|
||||
+
|
||||
int compress_blob_xz(const void *src, uint64_t src_size,
|
||||
void *dst, size_t dst_alloc_size, size_t *dst_size);
|
||||
int compress_blob_lz4(const void *src, uint64_t src_size,
|
115
0246-sd-journal-always-use-the-compression-algorithm-spec.patch
Normal file
115
0246-sd-journal-always-use-the-compression-algorithm-spec.patch
Normal file
@ -0,0 +1,115 @@
|
||||
From 0eb906f1a10a8667ead6f1dc5c308f07c9c2b691 Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 18:22:50 +0900
|
||||
Subject: [PATCH] sd-journal: always use the compression algorithm specified in
|
||||
the header
|
||||
|
||||
Previously, data object may be compressed with an algorithm that is not
|
||||
mentioned in the header.
|
||||
|
||||
(cherry picked from commit 2360352ef02548723ac0c8eaf5ff6905eb9eeca5)
|
||||
|
||||
Resolves: #2183546
|
||||
---
|
||||
src/libsystemd/sd-journal/journal-file.c | 40 ++++++++++++++----------
|
||||
src/libsystemd/sd-journal/journal-file.h | 12 +++++--
|
||||
2 files changed, 33 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
|
||||
index 00de564499..1b8f0abf97 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.c
|
||||
@@ -1593,24 +1593,31 @@ static int journal_file_append_field(
|
||||
}
|
||||
|
||||
static Compression maybe_compress_payload(JournalFile *f, uint8_t *dst, const uint8_t *src, uint64_t size, size_t *rsize) {
|
||||
- Compression compression = COMPRESSION_NONE;
|
||||
-
|
||||
assert(f);
|
||||
assert(f->header);
|
||||
|
||||
#if HAVE_COMPRESSION
|
||||
- if (JOURNAL_FILE_COMPRESS(f) && size >= f->compress_threshold_bytes) {
|
||||
- compression = compress_blob(src, size, dst, size - 1, rsize);
|
||||
- if (compression > 0)
|
||||
- log_debug("Compressed data object %"PRIu64" -> %zu using %s",
|
||||
- size, *rsize, compression_to_string(compression));
|
||||
- else
|
||||
- /* Compression didn't work, we don't really care why, let's continue without compression */
|
||||
- compression = COMPRESSION_NONE;
|
||||
+ Compression c;
|
||||
+ int r;
|
||||
+
|
||||
+ c = JOURNAL_FILE_COMPRESSION(f);
|
||||
+ if (c == COMPRESSION_NONE || size < f->compress_threshold_bytes)
|
||||
+ return COMPRESSION_NONE;
|
||||
+
|
||||
+ r = compress_blob_explicit(c, src, size, dst, size - 1, rsize);
|
||||
+ if (r < 0) {
|
||||
+ log_debug_errno(r, "Failed to compress data object using %s, ignoring: %m", compression_to_string(c));
|
||||
+ /* Compression didn't work, we don't really care why, let's continue without compression */
|
||||
+ return COMPRESSION_NONE;
|
||||
}
|
||||
-#endif
|
||||
|
||||
- return compression;
|
||||
+ assert(r == c);
|
||||
+ log_debug("Compressed data object %"PRIu64" -> %zu using %s", size, *rsize, compression_to_string(c));
|
||||
+
|
||||
+ return c;
|
||||
+#else
|
||||
+ return COMPRESSION_NONE;
|
||||
+#endif
|
||||
}
|
||||
|
||||
static int journal_file_append_data(
|
||||
@@ -3887,20 +3894,21 @@ int journal_file_open(
|
||||
f->close_fd = true;
|
||||
|
||||
if (DEBUG_LOGGING) {
|
||||
- static int last_seal = -1, last_compress = -1, last_keyed_hash = -1;
|
||||
+ static int last_seal = -1, last_keyed_hash = -1;
|
||||
+ static Compression last_compression = _COMPRESSION_INVALID;
|
||||
static uint64_t last_bytes = UINT64_MAX;
|
||||
|
||||
if (last_seal != JOURNAL_HEADER_SEALED(f->header) ||
|
||||
last_keyed_hash != JOURNAL_HEADER_KEYED_HASH(f->header) ||
|
||||
- last_compress != JOURNAL_FILE_COMPRESS(f) ||
|
||||
+ last_compression != JOURNAL_FILE_COMPRESSION(f) ||
|
||||
last_bytes != f->compress_threshold_bytes) {
|
||||
|
||||
log_debug("Journal effective settings seal=%s keyed_hash=%s compress=%s compress_threshold_bytes=%s",
|
||||
yes_no(JOURNAL_HEADER_SEALED(f->header)), yes_no(JOURNAL_HEADER_KEYED_HASH(f->header)),
|
||||
- yes_no(JOURNAL_FILE_COMPRESS(f)), FORMAT_BYTES(f->compress_threshold_bytes));
|
||||
+ compression_to_string(JOURNAL_FILE_COMPRESSION(f)), FORMAT_BYTES(f->compress_threshold_bytes));
|
||||
last_seal = JOURNAL_HEADER_SEALED(f->header);
|
||||
last_keyed_hash = JOURNAL_HEADER_KEYED_HASH(f->header);
|
||||
- last_compress = JOURNAL_FILE_COMPRESS(f);
|
||||
+ last_compression = JOURNAL_FILE_COMPRESSION(f);
|
||||
last_bytes = f->compress_threshold_bytes;
|
||||
}
|
||||
}
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.h b/src/libsystemd/sd-journal/journal-file.h
|
||||
index 1f3c80c912..0321da4a16 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.h
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.h
|
||||
@@ -305,10 +305,16 @@ bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec, int log
|
||||
int journal_file_map_data_hash_table(JournalFile *f);
|
||||
int journal_file_map_field_hash_table(JournalFile *f);
|
||||
|
||||
-static inline bool JOURNAL_FILE_COMPRESS(JournalFile *f) {
|
||||
+static inline Compression JOURNAL_FILE_COMPRESSION(JournalFile *f) {
|
||||
assert(f);
|
||||
- return JOURNAL_HEADER_COMPRESSED_XZ(f->header) || JOURNAL_HEADER_COMPRESSED_LZ4(f->header) ||
|
||||
- JOURNAL_HEADER_COMPRESSED_ZSTD(f->header);
|
||||
+
|
||||
+ if (JOURNAL_HEADER_COMPRESSED_XZ(f->header))
|
||||
+ return COMPRESSION_XZ;
|
||||
+ if (JOURNAL_HEADER_COMPRESSED_LZ4(f->header))
|
||||
+ return COMPRESSION_LZ4;
|
||||
+ if (JOURNAL_HEADER_COMPRESSED_ZSTD(f->header))
|
||||
+ return COMPRESSION_ZSTD;
|
||||
+ return COMPRESSION_NONE;
|
||||
}
|
||||
|
||||
uint64_t journal_file_hash_data(JournalFile *f, const void *data, size_t sz);
|
100
0247-sd-journal-allow-to-specify-compression-algorithm-th.patch
Normal file
100
0247-sd-journal-allow-to-specify-compression-algorithm-th.patch
Normal file
@ -0,0 +1,100 @@
|
||||
From 7816037425c80202ed375cff0cc6249c2bc91e2c Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 14:19:51 +0900
|
||||
Subject: [PATCH] sd-journal: allow to specify compression algorithm through
|
||||
env
|
||||
|
||||
Fixes RHBZ#2183546 (https://bugzilla.redhat.com/show_bug.cgi?id=2183546).
|
||||
|
||||
Previously, journal file is always compressed with the default algorithm
|
||||
set at compile time. So, if a newer algorithm is used, journal files
|
||||
cannot be read by older version of journalctl that does not support the
|
||||
algorithm.
|
||||
|
||||
Co-authored-by: Colin Walters <walters@verbum.org>
|
||||
(cherry picked from commit 1f06ea747b5939a1083c436dd7dae97b37bedee7)
|
||||
|
||||
Resolves: #2183546
|
||||
---
|
||||
docs/ENVIRONMENT.md | 8 +++++
|
||||
src/libsystemd/sd-journal/journal-file.c | 44 +++++++++++++++++++++++-
|
||||
2 files changed, 51 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md
|
||||
index ab3add6031..70fac2e361 100644
|
||||
--- a/docs/ENVIRONMENT.md
|
||||
+++ b/docs/ENVIRONMENT.md
|
||||
@@ -471,3 +471,11 @@ SYSTEMD_HOME_DEBUG_SUFFIX=foo \
|
||||
in a more compact format that reduces the amount of disk space required by the
|
||||
journal. Note that journal files in compact mode are limited to 4G to allow use of
|
||||
32-bit offsets. Enabled by default.
|
||||
+
|
||||
+* `$SYSTEMD_JOURNAL_COMPRESS` – Takes a boolean, or one of the compression
|
||||
+ algorithms "XZ", "LZ4", and "ZSTD". If enabled, the default compression
|
||||
+ algorithm set at compile time will be used when opening a new journal file.
|
||||
+ If disabled, the journal file compression will be disabled. Note that the
|
||||
+ compression mode of existing journal files are not changed. To make the
|
||||
+ specified algorithm takes an effect immediately, you need to explicitly run
|
||||
+ `journalctl --rotate`.
|
||||
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
|
||||
index 1b8f0abf97..3c1385ddb0 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-file.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-file.c
|
||||
@@ -329,6 +329,48 @@ static bool compact_mode_requested(void) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
+#if HAVE_COMPRESSION
|
||||
+static Compression getenv_compression(void) {
|
||||
+ Compression c;
|
||||
+ const char *e;
|
||||
+ int r;
|
||||
+
|
||||
+ e = getenv("SYSTEMD_JOURNAL_COMPRESS");
|
||||
+ if (!e)
|
||||
+ return DEFAULT_COMPRESSION;
|
||||
+
|
||||
+ r = parse_boolean(e);
|
||||
+ if (r >= 0)
|
||||
+ return r ? DEFAULT_COMPRESSION : COMPRESSION_NONE;
|
||||
+
|
||||
+ c = compression_from_string(e);
|
||||
+ if (c < 0) {
|
||||
+ log_debug_errno(c, "Failed to parse SYSTEMD_JOURNAL_COMPRESS value, ignoring: %s", e);
|
||||
+ return DEFAULT_COMPRESSION;
|
||||
+ }
|
||||
+
|
||||
+ if (!compression_supported(c)) {
|
||||
+ log_debug("Unsupported compression algorithm specified, ignoring: %s", e);
|
||||
+ return DEFAULT_COMPRESSION;
|
||||
+ }
|
||||
+
|
||||
+ return c;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+static Compression compression_requested(void) {
|
||||
+#if HAVE_COMPRESSION
|
||||
+ static thread_local Compression cached = _COMPRESSION_INVALID;
|
||||
+
|
||||
+ if (cached < 0)
|
||||
+ cached = getenv_compression();
|
||||
+
|
||||
+ return cached;
|
||||
+#else
|
||||
+ return COMPRESSION_NONE;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags, JournalFile *template) {
|
||||
bool seal = false;
|
||||
ssize_t k;
|
||||
@@ -344,7 +386,7 @@ static int journal_file_init_header(JournalFile *f, JournalFileFlags file_flags,
|
||||
Header h = {
|
||||
.header_size = htole64(ALIGN64(sizeof(h))),
|
||||
.incompatible_flags = htole32(
|
||||
- FLAGS_SET(file_flags, JOURNAL_COMPRESS) * COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(DEFAULT_COMPRESSION) |
|
||||
+ FLAGS_SET(file_flags, JOURNAL_COMPRESS) * COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(compression_requested()) |
|
||||
keyed_hash_requested() * HEADER_INCOMPATIBLE_KEYED_HASH |
|
||||
compact_mode_requested() * HEADER_INCOMPATIBLE_COMPACT),
|
||||
.compatible_flags = htole32(seal * HEADER_COMPATIBLE_SEALED),
|
@ -0,0 +1,54 @@
|
||||
From 1ed71d6c6613509cc851a3099de8dc6a4d181f56 Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 15:03:35 +0900
|
||||
Subject: [PATCH] test: add test case that journal file is created with the
|
||||
requested compression algorithm
|
||||
|
||||
(cherry picked from commit d23a1c52a93206b0dbabcb4336752ccb796c11c3)
|
||||
|
||||
Resolves: #2183546
|
||||
---
|
||||
test/units/testsuite-04.sh | 32 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/test/units/testsuite-04.sh b/test/units/testsuite-04.sh
|
||||
index fdc3273fea..bb41045809 100755
|
||||
--- a/test/units/testsuite-04.sh
|
||||
+++ b/test/units/testsuite-04.sh
|
||||
@@ -179,4 +179,36 @@ sleep 3
|
||||
# https://github.com/systemd/systemd/issues/15528
|
||||
journalctl --follow --file=/var/log/journal/*/* | head -n1 || [[ $? -eq 1 ]]
|
||||
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=2183546
|
||||
+mkdir /run/systemd/system/systemd-journald.service.d
|
||||
+MID=$(cat /etc/machine-id)
|
||||
+for c in "NONE" "XZ" "LZ4" "ZSTD"; do
|
||||
+ cat >/run/systemd/system/systemd-journald.service.d/compress.conf <<EOF
|
||||
+[Service]
|
||||
+Environment=SYSTEMD_JOURNAL_COMPRESS=${c}
|
||||
+EOF
|
||||
+ systemctl daemon-reload
|
||||
+ systemctl restart systemd-journald.service
|
||||
+ journalctl --rotate
|
||||
+
|
||||
+ ID=$(systemd-id128 new)
|
||||
+ systemd-cat -t "$ID" /bin/bash -c "for ((i=0;i<100;i++)); do echo -n hoge with ${c}; done; echo"
|
||||
+ journalctl --sync
|
||||
+ timeout 10 bash -c "while ! SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /var/log/journal/$MID/system.journal 2>&1 | grep -q -F 'compress=${c}'; do sleep .5; done"
|
||||
+
|
||||
+ # $SYSTEMD_JOURNAL_COMPRESS= also works for journal-remote
|
||||
+ if [[ -x /usr/lib/systemd/systemd-journal-remote ]]; then
|
||||
+ for cc in "NONE" "XZ" "LZ4" "ZSTD"; do
|
||||
+ rm -f /tmp/foo.journal
|
||||
+ SYSTEMD_JOURNAL_COMPRESS="${cc}" /usr/lib/systemd/systemd-journal-remote --split-mode=none -o /tmp/foo.journal --getter="journalctl -b -o export -t $ID"
|
||||
+ SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /tmp/foo.journal 2>&1 | grep -q -F "compress=${cc}"
|
||||
+ journalctl -t "$ID" -o cat --file /tmp/foo.journal | grep -q -F "hoge with ${c}"
|
||||
+ done
|
||||
+ fi
|
||||
+done
|
||||
+rm /run/systemd/system/systemd-journald.service.d/compress.conf
|
||||
+systemctl daemon-reload
|
||||
+systemctl restart systemd-journald.service
|
||||
+journalctl --rotate
|
||||
+
|
||||
touch /testok
|
@ -0,0 +1,31 @@
|
||||
From 94c7e260b499cd9e5ad8d99d95b9413df2d50cc6 Mon Sep 17 00:00:00 2001
|
||||
From: Michal Sekletar <msekleta@redhat.com>
|
||||
Date: Thu, 30 Mar 2023 14:56:16 +0200
|
||||
Subject: [PATCH] rules: do not online CPU automatically on IBM platforms
|
||||
|
||||
RHEL-only
|
||||
|
||||
Resolves: #2143107
|
||||
---
|
||||
rules.d/40-redhat.rules | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rules.d/40-redhat.rules b/rules.d/40-redhat.rules
|
||||
index 3c95cd2df0..efb866966e 100644
|
||||
--- a/rules.d/40-redhat.rules
|
||||
+++ b/rules.d/40-redhat.rules
|
||||
@@ -1,7 +1,13 @@
|
||||
# do not edit this file, it will be overwritten on update
|
||||
|
||||
# CPU hotadd request
|
||||
-SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
|
||||
+SUBSYSTEM!="cpu", GOTO="cpu_online_end"
|
||||
+ACTION!="add", GOTO="cpu_online_end"
|
||||
+CONST{arch}=="s390*|ppc64*", GOTO="cpu_online_end"
|
||||
+
|
||||
+TEST=="online", ATTR{online}=="0", ATTR{online}="1"
|
||||
+
|
||||
+LABEL="cpu_online_end"
|
||||
|
||||
# Memory hotadd request
|
||||
SUBSYSTEM!="memory", GOTO="memory_hotplug_end"
|
34
systemd.spec
34
systemd.spec
@ -21,7 +21,7 @@
|
||||
Name: systemd
|
||||
Url: https://systemd.io
|
||||
Version: 252
|
||||
Release: 14%{?dist}
|
||||
Release: 15%{?dist}
|
||||
# For a breakdown of the licensing, see README
|
||||
License: LGPLv2+ and MIT and GPLv2+
|
||||
Summary: System and Service Manager
|
||||
@ -312,6 +312,21 @@ Patch0231: 0231-meson-Store-fuzz-tests-in-structured-way.patch
|
||||
Patch0232: 0232-meson-Generate-fuzzer-inputs-with-directives.patch
|
||||
Patch0233: 0233-oss-fuzz-include-generated-corpora-in-the-final-zip-.patch
|
||||
Patch0234: 0234-unit-In-cgroupv1-gracefully-terminate-delegated-scop.patch
|
||||
Patch0235: 0235-ci-trigger-differential-shellcheck-workflow-on-push.patch
|
||||
Patch0236: 0236-ci-workflow-for-gathering-metadata-for-source-git-au.patch
|
||||
Patch0237: 0237-ci-first-part-of-the-source-git-automation-commit-li.patch
|
||||
Patch0238: 0238-ci-Mergify-check-CodeQL-and-build-workflows-based-on.patch
|
||||
Patch0239: 0239-ci-add-NOTICE-to-also-update-regexp-in-.mergify.yml-.patch
|
||||
Patch0240: 0240-Support-etc-system-update-for-OSTree-systems.patch
|
||||
Patch0241: 0241-journal-def-fix-type-of-signature-to-match-the-actua.patch
|
||||
Patch0242: 0242-journal-use-compound-initialization-for-journal-file.patch
|
||||
Patch0243: 0243-journald-fix-log-message.patch
|
||||
Patch0244: 0244-sd-journal-cache-results-of-parsing-environment-vari.patch
|
||||
Patch0245: 0245-compress-introduce-compression_supported-helper-func.patch
|
||||
Patch0246: 0246-sd-journal-always-use-the-compression-algorithm-spec.patch
|
||||
Patch0247: 0247-sd-journal-allow-to-specify-compression-algorithm-th.patch
|
||||
Patch0248: 0248-test-add-test-case-that-journal-file-is-created-with.patch
|
||||
Patch0249: 0249-rules-do-not-online-CPU-automatically-on-IBM-platfor.patch
|
||||
|
||||
# Downstream-only patches (9000–9999)
|
||||
|
||||
@ -1133,6 +1148,23 @@ getent passwd systemd-oom &>/dev/null || useradd -r -l -g systemd-oom -d / -s /s
|
||||
%files standalone-sysusers -f .file-list-standalone-sysusers
|
||||
|
||||
%changelog
|
||||
* Thu May 18 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-15
|
||||
- ci: trigger `differential-shellcheck` workflow on push (#2100440)
|
||||
- ci: workflow for gathering metadata for source-git automation (#2100440)
|
||||
- ci: first part of the source-git automation - commit linter (#2100440)
|
||||
- ci(Mergify): check CodeQL and build workflows based on changed files (#2100440)
|
||||
- ci: add NOTICE to also update regexp in `.mergify.yml` when updating `paths` property (#2100440)
|
||||
- Support /etc/system-update for OSTree systems (#2203133)
|
||||
- journal-def: fix type of signature to match the actual field in the Header structure (#2183546)
|
||||
- journal: use compound initialization for journal file Header structure (#2183546)
|
||||
- journald: fix log message (#2183546)
|
||||
- sd-journal: cache results of parsing environment variables (#2183546)
|
||||
- compress: introduce compression_supported() helper function (#2183546)
|
||||
- sd-journal: always use the compression algorithm specified in the header (#2183546)
|
||||
- sd-journal: allow to specify compression algorithm through env (#2183546)
|
||||
- test: add test case that journal file is created with the requested compression algorithm (#2183546)
|
||||
- rules: do not online CPU automatically on IBM platforms (#2143107)
|
||||
|
||||
* Tue Mar 21 2023 systemd maintenance team <systemd-maint@redhat.com> - 252-14
|
||||
- systemd: Support OOMPolicy in scope units (#2176918)
|
||||
- systemd: Default to OOMPolicy=continue for login session scopes (#2176918)
|
||||
|
Loading…
Reference in New Issue
Block a user