termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.15k stars 3.02k forks source link

[Bug]: cmake autocompletion prints '_split_longopt: command not found' #19352

Closed leha-bot closed 3 months ago

leha-bot commented 7 months ago

Problem description

After some recent updates cmake autocompletion in Bash became to print the '_split_longopt: command not found'.

After some searching I found some issues in CMake and another autocompletion issue in "bat" repo:

The latter suggests possible cause for their similar issue.

What steps will reproduce the bug?

  1. Type cmake in bash terminal
  2. Press 'Tab' for autocompletion

What is the expected behavior?

It works without error.

System information

termux-info:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=22445
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main stable main
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:
All packages up to date
termux-tools version:
1.40.6
Android version:
14
Kernel build information:
Linux localhost 5.10.177-android13-4-00003-ga7208022a7ea-ab10815828 #1 SMP PREEMPT Fri Sep 15 16:40:54 UTC 2023 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 6
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.window versionCode:15
com.termux.widget versionCode:13
com.termux.x11 versionCode:14
com.termux.api versionCode:51
Biswa96 commented 7 months ago

I can not reproduce the issue in my setup. cmake, then tab does not show any error. Please make sure all the packages are updated with apt update; apt upgrade command.

leha-bot commented 7 months ago

I found that CMake requires the '_split_longopt' function which was provided by bash-completion package before 2.12. In the latest release this function has name '_comp__split_longopt'

I think the autocompletion has been broken after bash-completion upgrade from 2.11 to 2.12 , according to the diff between 2.12 and 2.11: https://github.com/scop/bash-completion/compare/2.12.0..2.11

I fixed this bug via replacing old name in $TERMUX/usr/share/bash-completion/completions/cmake

I may send a PR with patch, if don't mind.

I also planning to fix it properly in upstream CMake

TomJo2000 commented 7 months ago

(Since I'm set as the maintainer for the bash-completion package I guess I should chime in.) We could definitely patch the completion until the issue is fixed upstream (be that in cmake or bash-completion) But that would more so be a band-aid fix.

What confuses me is that the behavior doesn't appear to be replicable though. I'll test this myself later.

Biswa96 commented 7 months ago

Oh, my bad. I assumed that bash-completion is installed already. I can reproduce the issue after installing bash-completion package manually. :bow:

TomJo2000 commented 7 months ago

Yep, I can also reproduce this and have already identified the issue. A simple API breakage due to a renamed function in the main bash-completion script. https://github.com/scop/bash-completion/blob/master/bash_completion#L760-L786 Should be trivial to patch, I'll see if there's already a PR upstream.

leha-bot commented 4 months ago

The upstream will seems to fix it a proper way here: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9564 Waiting for merging and CMake 3.30 😊

Biswa96 commented 3 months ago

This should be fixed in cmake version 3.30.0 and above.