Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fish_update_completions creates invalid files if man file is duplicated #9787

Copy link
Copy link

Description

@ThunderKey
Issue body actions

On Arch Linux, jre-openjdk-headless creates a symlink from /usr/lib/jvm/java-20-openjdk/manto /usr/share/man/ therefore the command fish_update_completions finds all man pages twice. The first time it can generate the completions, but with the second file it ignores all commands because they are already added to already_output_completions.

The simplest way to reproduce this is to pass the same manpage file twice to create_manpage_completions.py.

In most cases this is no issue and it just ignores the last file, because it fails to generate the completions.

But for The Silver Searcher (ag) the second pass falls back to the TypeDeroffManParser and is able to generate a different, but incomplete, completion file and overwrites the previous one.

Reproducing the errors:

  • Ignores failure of second file:
    • python share/tools/create_manpage_completions.py --progress /usr/share/man/man1/grep.1.gz /usr/share/man/man1/grep.1.gz --stdout
  • Creates two different completion files:
    • python share/tools/create_manpage_completions.py --progress /usr/share/man/man1/ag.1.gz /usr/share/man/man1/ag.1.gz --stdout

I'd be happy to create a pull request to fix this but I see multiple options:

  1. Skip generating the completion if the command was already created, unlike already_output_completions which is done per argument
  2. Reset already_output_completions at the start of parse_manpage_at_path
  3. Add all values in already_output_completions to the built_command_output to ensure that all options are written to the completions file.
  4. Make the list of manpage files unique by using their checksums

I'm not sure how those workarounds would change the behaviour mentioned in

# Make sure we don't output the same completion multiple times, which can happen

System Information

  • fish --version: fish, version 3.6.1
  • uname -a: Linux ng-lenovo-2 5.15.110-2-MANJARO #1 SMP PREEMPT Thu May 4 06:51:53 UTC 2023 x86_64 GNU/Linux
  • echo $TERM: xterm-kitty
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.