GNU bug report logs - #63411
29.0.90; pcomplete/systemctl cannot complete units for old versions of systemd

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Wed, 10 May 2023 09:48:02 UTC

Severity: normal

Found in version 29.0.90

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 63411 in the body.
You can then email your comments to 63411 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#63411; Package emacs. (Wed, 10 May 2023 09:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Liu Hui <liuhui1610 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 10 May 2023 09:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.90; pcomplete/systemctl cannot complete units for old versions
 of systemd
Date: Wed, 10 May 2023 17:47:09 +0800
Hi,

It is very convenient that Emacs 29 supports eshell completion for
systemctl, but I find units cannot be completed on Ubuntu 20.04 LTS:

1. emacs -Q
2. M-x eshell
3. type "systemctl stop ", and press TAB

There is no completion for units.

The reason is that 'pcmpl-linux--systemd-units' uses a new option
'--legend=no' that is introduced since Feb 18, 2021[1], and the option
cannot be recognized by systemd v245 on my system. Since the old
option '--no-legend' is still kept for compatibility[2], I suggest we
can just replace '--legend=no' with '--no-legend' to make systemctl
completion works for old systems.

[1] https://github.com/systemd/systemd/pull/18596
[2] https://github.com/systemd/systemd/blob/main/src/systemctl/systemctl.c#L485

Best,
Liu Hui




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63411; Package emacs. (Wed, 17 May 2023 08:54:01 GMT) Full text and rfc822 format available.

Message #8 received at 63411 <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: 63411 <at> debbugs.gnu.org
Subject: bug#63411: [PATCH] pcomplete/systemctl cannot complete units for old
 versions of systemd
Date: Wed, 17 May 2023 16:53:13 +0800
[Message part 1 (text/plain, inline)]
Here is the patch that fixes the problem.
[0001-Fix-systemd-unit-completion-for-old-versions-of-syst.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63411; Package emacs. (Thu, 18 May 2023 10:41:02 GMT) Full text and rfc822 format available.

Message #11 received at 63411 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: 63411 <at> debbugs.gnu.org
Subject: Re: bug#63411: [PATCH] pcomplete/systemctl cannot complete units for
 old versions of systemd
Date: Thu, 18 May 2023 13:40:29 +0300
> From: Liu Hui <liuhui1610 <at> gmail.com>
> Date: Wed, 17 May 2023 16:53:13 +0800
> 
> Here is the patch that fixes the problem.
> 
> From aaba4753ada1c003171d9a5342c87a945992e62f Mon Sep 17 00:00:00 2001
> From: Liu Hui <liuhui1610 <at> gmail.com>
> Date: Wed, 17 May 2023 16:39:18 +0800
> Subject: [PATCH] Fix systemd unit completion for old versions of systemd
> 
> * lisp/pcmpl-linux.el (pcmpl-linux--systemd-units): Use '--no-legend'
> for compatibility.
> ---
>  lisp/pcmpl-linux.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lisp/pcmpl-linux.el b/lisp/pcmpl-linux.el
> index 082072d87d2..589b4799c8d 100644
> --- a/lisp/pcmpl-linux.el
> +++ b/lisp/pcmpl-linux.el
> @@ -119,7 +119,8 @@ pcmpl-linux--systemd-units
>    (with-temp-buffer
>      (apply #'call-process
>             "systemctl" nil '(t nil) nil
> -           "list-units" "--full" "--legend=no" "--plain" args)
> +           ;; "--legend=no" doesn't exist before systemd v248
> +           "list-units" "--full" "--no-legend" "--plain" args)
>      (goto-char (point-min))
>      (let (result)
>        (while (re-search-forward (rx bol (group (+ (not space)))
> -- 
> 2.25.1

Thanks.

I'm not an expert on systemctl; would someone who uses that please
tell if this could have any downsides?  E.g., is --no-legend expected
to be deprecated, perhaps resulting in a warning message or something?
If not, why did the systemd developers add another option with the
same semantics?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63411; Package emacs. (Thu, 18 May 2023 13:31:02 GMT) Full text and rfc822 format available.

Message #14 received at 63411 <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63411 <at> debbugs.gnu.org
Subject: Re: bug#63411: [PATCH] pcomplete/systemctl cannot complete units for
 old versions of systemd
Date: Thu, 18 May 2023 21:29:46 +0800
> I'm not an expert on systemctl; would someone who uses that please
> tell if this could have any downsides?  E.g., is --no-legend expected
> to be deprecated, perhaps resulting in a warning message or something?
> If not, why did the systemd developers add another option with the
> same semantics?

--no-legend is indeed superseded by --legend=yes/no in systemd v248+,
but it is not deprecated. It is kept for compatibility and is totally
equivalent to --legend=no, and doesn't produce any warning message. I
have tested with systemctl v249 on Ubuntu 22.04 and the outputs are
same. In fact, the point of the new option is it allows to display
legends by --legend=yes in spite of other options such as --quiet,
which is explained in https://github.com/systemd/systemd/pull/18596.

Another simple solution is adding a variable, e.g.
pcmpl-linux-systemd-list-unit-arguments, to allow users to change
options passing to systemctl. WDYT?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63411; Package emacs. (Thu, 18 May 2023 14:17:02 GMT) Full text and rfc822 format available.

Message #17 received at 63411 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: 63411 <at> debbugs.gnu.org
Subject: Re: bug#63411: [PATCH] pcomplete/systemctl cannot complete units for
 old versions of systemd
Date: Thu, 18 May 2023 17:16:16 +0300
> From: Liu Hui <liuhui1610 <at> gmail.com>
> Date: Thu, 18 May 2023 21:29:46 +0800
> Cc: 63411 <at> debbugs.gnu.org
> 
> > I'm not an expert on systemctl; would someone who uses that please
> > tell if this could have any downsides?  E.g., is --no-legend expected
> > to be deprecated, perhaps resulting in a warning message or something?
> > If not, why did the systemd developers add another option with the
> > same semantics?
> 
> --no-legend is indeed superseded by --legend=yes/no in systemd v248+,
> but it is not deprecated. It is kept for compatibility and is totally
> equivalent to --legend=no, and doesn't produce any warning message. I
> have tested with systemctl v249 on Ubuntu 22.04 and the outputs are
> same. In fact, the point of the new option is it allows to display
> legends by --legend=yes in spite of other options such as --quiet,
> which is explained in https://github.com/systemd/systemd/pull/18596.

Thanks, I think I will wait for a few days to let others chime in.

> Another simple solution is adding a variable, e.g.
> pcmpl-linux-systemd-list-unit-arguments, to allow users to change
> options passing to systemctl. WDYT?

If --no-legend will continue to be supported for the observable
future, asking users to control that would be an annoyance, I think.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63411; Package emacs. (Thu, 18 May 2023 18:58:02 GMT) Full text and rfc822 format available.

Message #20 received at 63411 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Liu Hui <liuhui1610 <at> gmail.com>
Cc: 63411 <at> debbugs.gnu.org
Subject: Re: bug#63411: [PATCH] pcomplete/systemctl cannot complete units for
 old versions of systemd
Date: Thu, 18 May 2023 11:57:46 -0700
On 5/18/2023 7:16 AM, Eli Zaretskii wrote:
>> From: Liu Hui <liuhui1610 <at> gmail.com>
>> Date: Thu, 18 May 2023 21:29:46 +0800
>> Cc: 63411 <at> debbugs.gnu.org
>>
>> --no-legend is indeed superseded by --legend=yes/no in systemd v248+,
>> but it is not deprecated. It is kept for compatibility and is totally
>> equivalent to --legend=no, and doesn't produce any warning message. I
>> have tested with systemctl v249 on Ubuntu 22.04 and the outputs are
>> same. In fact, the point of the new option is it allows to display
>> legends by --legend=yes in spite of other options such as --quiet,
>> which is explained in https://github.com/systemd/systemd/pull/18596.
> 
> Thanks, I think I will wait for a few days to let others chime in.

I stumbled on this too, and was about to post a patch before I noticed 
this bug, so I support this change.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 20 May 2023 15:03:01 GMT) Full text and rfc822 format available.

Notification sent to Liu Hui <liuhui1610 <at> gmail.com>:
bug acknowledged by developer. (Sat, 20 May 2023 15:03:02 GMT) Full text and rfc822 format available.

Message #25 received at 63411-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: liuhui1610 <at> gmail.com, 63411-done <at> debbugs.gnu.org
Subject: Re: bug#63411: [PATCH] pcomplete/systemctl cannot complete units for
 old versions of systemd
Date: Sat, 20 May 2023 18:02:49 +0300
> Date: Thu, 18 May 2023 11:57:46 -0700
> Cc: 63411 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
> 
> On 5/18/2023 7:16 AM, Eli Zaretskii wrote:
> >> From: Liu Hui <liuhui1610 <at> gmail.com>
> >> Date: Thu, 18 May 2023 21:29:46 +0800
> >> Cc: 63411 <at> debbugs.gnu.org
> >>
> >> --no-legend is indeed superseded by --legend=yes/no in systemd v248+,
> >> but it is not deprecated. It is kept for compatibility and is totally
> >> equivalent to --legend=no, and doesn't produce any warning message. I
> >> have tested with systemctl v249 on Ubuntu 22.04 and the outputs are
> >> same. In fact, the point of the new option is it allows to display
> >> legends by --legend=yes in spite of other options such as --quiet,
> >> which is explained in https://github.com/systemd/systemd/pull/18596.
> > 
> > Thanks, I think I will wait for a few days to let others chime in.
> 
> I stumbled on this too, and was about to post a patch before I noticed 
> this bug, so I support this change.

Thanks, installed on the emacs-29 branch, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Jun 2023 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 306 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.