public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: <rs@ti.com>
To: <richard.purdie@linuxfoundation.org>, <ross.burton@arm.com>,
	<mathieu.dubois-briand@bootlin.com>
Cc: <openembedded-core@lists.openembedded.org>,
	<peter.kjellerstedt@axis.com>, <joerg.sommer@navimatix.de>
Subject: [oe-core][PATCH] systemd: fix edit functionality with vi
Date: Tue, 14 Apr 2026 14:02:46 -0500	[thread overview]
Message-ID: <20260414190245.2182865-2-rs@ti.com> (raw)

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



             reply	other threads:[~2026-04-14 19:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14 19:02 rs [this message]
2026-04-15  9:22 ` [oe-core][PATCH] systemd: fix edit functionality with vi Adam Duskett
2026-04-15 19:48   ` Randolph Sapp
     [not found]   ` <18A69F836DD2AD37.1523159@lists.openembedded.org>
2026-04-15 20:10     ` Randolph Sapp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260414190245.2182865-2-rs@ti.com \
    --to=rs@ti.com \
    --cc=joerg.sommer@navimatix.de \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=peter.kjellerstedt@axis.com \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=ross.burton@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox