Bug 438530 - ./kdesrc-build --initial-setup adds invalid `complete` command to .zshrc
Summary: ./kdesrc-build --initial-setup adds invalid `complete` command to .zshrc
Status: RESOLVED FIXED
Alias: None
Product: kdesrc-build
Classification: Developer tools
Component: setup wizard (show other bugs)
Version: Git
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Xynt Xo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-13 02:52 UTC by skierpage
Modified: 2024-02-20 18:59 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description skierpage 2021-06-13 02:52:30 UTC
SUMMARY
Following https://community.kde.org/Get_Involved/development#Set_up_kdesrc-build , I let `./kdesrc-build --initial-setup` make changes to my .zshrc. But when I ran source ~/.zshrc, it failed with "command not found: complete".

STEPS TO REPRODUCE
1. Be using zsh (I'm using Fedora 34's zsh 5.8)
2. Follow steps to set up in https://community.kde.org/Get_Involved/development
3. Enter ./kdesrc-build --initial-setup , enter 'y' when it prompts "* Update your /home/spage/.zshrc? (y/N)"
4. Enter source ~/.zshrc

OBSERVED RESULT
home/spage/.zshrc:125: command not found: complete
zsh has a different completion system to bash.

EXPECTED RESULT
I don't know. I spent some time with https://stackoverflow.com/questions/3249432/can-a-bash-tab-completion-script-be-used-in-zsh , but adding `bashcompinit` or `autoload bashcompinit` before the function _comp-kdesrc-run didn't help 🙁.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2 on Wayland
Comment 1 Brent Mackey 2021-10-14 03:28:24 UTC
Can reproduce this bug on Arch Linux using the same repro steps

Operating System: Arch Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
Kernel Version: 5.14.11-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 1700 Eight-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: Radeon RX 580 Series
Comment 2 Snehit Sah 2022-01-20 08:50:23 UTC
Adding `autoload -U +X bashcompinit && bashcompinit` before the call to `complete` removed the error for me.
Comment 3 Snehit Sah 2022-01-20 09:14:15 UTC
I have added a tiny note on wiki page : https://community.kde.org/index.php?title=Get_Involved/development&diff=prev&oldid=93638
Comment 4 Xynt Xo 2022-12-03 04:59:22 UTC
Confirming.  The completion function is bash-only, and we're putting it into .zshrc.  zsh does have a bash compatibility plugin (`bashcompinit`), but 1) this is not loaded by default on many systems (including Neon), and 2) loading the bash layer also requires loading a broad set of zsh completions which the user might not want.

It seems to me that the correct path forward is to:
1) Test for the presence of the bash compatibility layer, and if it is not present then don't put bash code into .zshrc
2) Create a zsh-specific completion function

I'll create a merge request for #1 and look into #2.
Comment 5 Bug Janitor Service 2022-12-04 03:06:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/sdk/kdesrc-build/-/merge_requests/172
Comment 6 Xynt Xo 2022-12-04 17:42:35 UTC
FYI, there is another MR open for a zsh completion function: https://invent.kde.org/sdk/kdesrc-build/-/merge_requests/165
Comment 7 Andrew Shark 2024-02-20 18:59:00 UTC
This is not installed now.