public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [oe-core][PATCH] systemd: fix edit functionality with vi
@ 2026-04-14 19:02 rs
  2026-04-15  9:22 ` Adam Duskett
  0 siblings, 1 reply; 4+ messages in thread
From: rs @ 2026-04-14 19:02 UTC (permalink / raw)
  To: richard.purdie, ross.burton, mathieu.dubois-briand
  Cc: openembedded-core, peter.kjellerstedt, joerg.sommer

From: Randolph Sapp <rs@ti.com>

Systemd currently expects any $EDITOR to support +LINE functionality for
jumping to a specified line in a file. This makes busybox vi misbehave a
little as it opens a file called +LINE and shows the user this file
first, as it's the last argument passed to it.

This has been submitted upstream as even IEEE Std 1003.1-2024 doesn't
dictate that the default editors need to support +LINE functionality.

Signed-off-by: Randolph Sapp <rs@ti.com>
---
 ...ot-assume-the-editor-can-handle-LINE.patch | 46 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_259.5.bb    |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-edit-util-do-not-assume-the-editor-can-handle-LINE.patch

diff --git a/meta/recipes-core/systemd/systemd/0001-edit-util-do-not-assume-the-editor-can-handle-LINE.patch b/meta/recipes-core/systemd/systemd/0001-edit-util-do-not-assume-the-editor-can-handle-LINE.patch
new file mode 100644
index 0000000000..cbcb472201
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-edit-util-do-not-assume-the-editor-can-handle-LINE.patch
@@ -0,0 +1,46 @@
+From bc4177de928fa9c80f2cdd70fd79d07a37d7b2e2 Mon Sep 17 00:00:00 2001
+From: Randolph Sapp <rs@ti.com>
+Date: Tue, 14 Apr 2026 13:25:55 -0500
+Subject: [PATCH] edit-util: do not assume the editor can handle +LINE
+
+If we're checking $EDITOR and trying to use an arbitrary list of text
+editors we shouldn't just assume they know how to handle the +LINE
+notation for jumping to a line in the specified file.
+
+Nano and Ed can handle it, but require that the line number is given
+before the file. Vim and Neovim can take it as any positional argument
+and just assume the last file specified was the intended target. Vi
+cannot handle a line number specifier at all.
+
+There's nothing that states the $EDITOR has to take anything other than
+a list of file names. Even that isn't really written anywhere. The
+latest version of IEEE Std 1003.1-2024 does not indicate that the two
+required utilities (vi and ex) need to support this functionality.
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/41642]
+Signed-off-by: Randolph Sapp <rs@ti.com>
+---
+ src/shared/edit-util.c | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
+index d48c36c1d5..b813c206c9 100644
+--- a/src/shared/edit-util.c
++++ b/src/shared/edit-util.c
+@@ -260,13 +260,6 @@ static int run_editor_child(const EditFileContext *context) {
+                 }
+         }
+
+-        if (context->n_files == 1 && context->files[0].line > 1) {
+-                /* If editing a single file only, use the +LINE syntax to put cursor on the right line */
+-                r = strv_extendf(&args, "+%u", context->files[0].line);
+-                if (r < 0)
+-                        return log_oom();
+-        }
+-
+         FOREACH_ARRAY(i, context->files, context->n_files) {
+                 r = strv_extend(&args, i->temp);
+                 if (r < 0)
+--
+2.53.0
+
diff --git a/meta/recipes-core/systemd/systemd_259.5.bb b/meta/recipes-core/systemd/systemd_259.5.bb
index d84e38d7cd..4f443cc2d0 100644
--- a/meta/recipes-core/systemd/systemd_259.5.bb
+++ b/meta/recipes-core/systemd/systemd_259.5.bb
@@ -35,6 +35,7 @@ SRC_URI += " \
            file://0003-Do-not-create-var-log-README.patch \
            file://0001-meson-use-libfido2_cflags-dependency.patch \
            file://0018-shared-fdset-add-detailed-debug-logging-to-fdset_new.patch \
+           file://0001-edit-util-do-not-assume-the-editor-can-handle-LINE.patch \
            "
 
 PAM_PLUGINS = " \
-- 
2.53.0



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

end of thread, other threads:[~2026-04-15 20:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14 19:02 [oe-core][PATCH] systemd: fix edit functionality with vi rs
2026-04-15  9:22 ` Adam Duskett
2026-04-15 19:48   ` Randolph Sapp
     [not found]   ` <18A69F836DD2AD37.1523159@lists.openembedded.org>
2026-04-15 20:10     ` Randolph Sapp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox