diff mbox series

[master] systemd: fix a dead link under /var/log

Message ID 20230629091318.1038965-1-changqing.li@windriver.com
State New
Headers show
Series [master] systemd: fix a dead link under /var/log | expand

Commit Message

Changqing Li June 29, 2023, 9:13 a.m. UTC
From: Changqing Li <changqing.li@windriver.com>

Commit 6fe23ff31c0 changed README to a symlink to README.logs, and
install README.logs under systemd doc dir.

But for OE, systemd doc dir is splited into package systemd-doc, when it
is not installed on the target, there will be an dead link:
Eg:
root@intel-x86-64:/var/log# ls -l README
lrwxrwxrwx 1 root root 39 Jun 20 08:57 README -> ../../usr/share/doc/systemd/README.logs
root@intel-x86-64:/var/log# ls -l ../../usr/share/doc/systemd/README.logs
ls: cannot access '../../usr/share/doc/systemd/README.logs': No such file or directory

Meantime, relative path for a symlink also will meet issue like
"No such file or directory"

So remove this symlink from package systemd, and create legacy-doc.conf,
only create the symlink when systemd-doc is installed.

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 ...on-t-create-symlink-README-in-this-f.patch | 42 +++++++++++++++++++
 ....in-split-out-the-doc-related-config.patch | 41 ++++++++++++++++++
 meta/recipes-core/systemd/systemd_253.3.bb    |  3 ++
 3 files changed, 86 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-legacy.conf.in-Don-t-create-symlink-README-in-this-f.patch
 create mode 100644 meta/recipes-core/systemd/systemd/0002-legacy-doc.conf.in-split-out-the-doc-related-config.patch
diff mbox series

Patch

diff --git a/meta/recipes-core/systemd/systemd/0001-legacy.conf.in-Don-t-create-symlink-README-in-this-f.patch b/meta/recipes-core/systemd/systemd/0001-legacy.conf.in-Don-t-create-symlink-README-in-this-f.patch
new file mode 100644
index 0000000000..a2644bba8e
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-legacy.conf.in-Don-t-create-symlink-README-in-this-f.patch
@@ -0,0 +1,42 @@ 
+From b17826490c1db2051dda23550ebdcd7f10e23479 Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Wed, 28 Jun 2023 13:49:41 +0800
+Subject: [PATCH 1/2] legacy.conf.in: Don't create symlink README in this file
+
+Commit 6fe23ff31c0 changed README to an symlink to README.logs, and
+install README.logs under systemd doc dir.
+
+But for OE, systemd doc dir is splited into package systemd-doc, when it
+is not installed on the target, there will be an dead link:
+Eg:
+root@intel-x86-64:/var/log# ls -l README
+lrwxrwxrwx 1 root root 39 Jun 20 08:57 README -> ../../usr/share/doc/systemd/README.logs
+root@intel-x86-64:/var/log# ls -l ../../usr/share/doc/systemd/README.logs
+ls: cannot access '../../usr/share/doc/systemd/README.logs': No such file or directory
+
+So remove this symlink from package systemd
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+---
+ tmpfiles.d/legacy.conf.in | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/tmpfiles.d/legacy.conf.in b/tmpfiles.d/legacy.conf.in
+index 4f2c0d7c43..62e2ae0986 100644
+--- a/tmpfiles.d/legacy.conf.in
++++ b/tmpfiles.d/legacy.conf.in
+@@ -12,9 +12,6 @@
+ 
+ d /run/lock 0755 root root -
+ L /var/lock - - - - ../run/lock
+-{% if CREATE_LOG_DIRS %}
+-L /var/log/README - - - - ../..{{DOC_DIR}}/README.logs
+-{% endif %}
+ 
+ # /run/lock/subsys is used for serializing SysV service execution, and
+ # hence without use on SysV-less systems.
+-- 
+2.25.1
+
diff --git a/meta/recipes-core/systemd/systemd/0002-legacy-doc.conf.in-split-out-the-doc-related-config.patch b/meta/recipes-core/systemd/systemd/0002-legacy-doc.conf.in-split-out-the-doc-related-config.patch
new file mode 100644
index 0000000000..47af64f12f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0002-legacy-doc.conf.in-split-out-the-doc-related-config.patch
@@ -0,0 +1,41 @@ 
+From 865974a2f268ae6b4dab4f37ba39d86e6600180d Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Wed, 28 Jun 2023 16:00:13 +0800
+Subject: [PATCH 2/2] legacy-doc.conf.in: split out the doc related config
+
+split out the doc related config, only install this when
+package systemd-doc is installed.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+---
+ tmpfiles.d/legacy-doc.conf.in | 3 +++
+ tmpfiles.d/meson.build        | 1 +
+ 2 files changed, 4 insertions(+)
+ create mode 100644 tmpfiles.d/legacy-doc.conf.in
+
+diff --git a/tmpfiles.d/legacy-doc.conf.in b/tmpfiles.d/legacy-doc.conf.in
+new file mode 100644
+index 0000000000..9b1cef5a18
+--- /dev/null
++++ b/tmpfiles.d/legacy-doc.conf.in
+@@ -0,0 +1,3 @@
++{% if CREATE_LOG_DIRS %}
++L /var/log/README - - - - {{DOC_DIR}}/README.logs
++{% endif %}
+diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build
+index 4d94e3743f..f78bddf136 100644
+--- a/tmpfiles.d/meson.build
++++ b/tmpfiles.d/meson.build
+@@ -31,6 +31,7 @@ endforeach
+ 
+ in_files = [['etc.conf',                      ''],
+             ['legacy.conf',                   'HAVE_SYSV_COMPAT'],
++            ['legacy-doc.conf',               'HAVE_SYSV_COMPAT'],
+             ['static-nodes-permissions.conf', ''],
+             ['systemd.conf',                  ''],
+             ['var.conf',                      ''],
+-- 
+2.25.1
+
diff --git a/meta/recipes-core/systemd/systemd_253.3.bb b/meta/recipes-core/systemd/systemd_253.3.bb
index 87fbf6f785..7db25db617 100644
--- a/meta/recipes-core/systemd/systemd_253.3.bb
+++ b/meta/recipes-core/systemd/systemd_253.3.bb
@@ -28,6 +28,8 @@  SRC_URI += " \
            file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            file://27254.patch \
            file://27253.patch \
+           file://0001-legacy.conf.in-Don-t-create-symlink-README-in-this-f.patch \
+           file://0002-legacy-doc.conf.in-split-out-the-doc-related-config.patch \
            "
 
 # patches needed by musl
@@ -760,6 +762,7 @@  FILES:udev += "${base_sbindir}/udevd \
 
 FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \
                    "
+FILES:${PN}-doc += "${exec_prefix}/lib/tmpfiles.d/legacy-doc.conf"
 
 RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"