termux / termux-packages

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

[Bug]: zsh `setopt nocaseglob` breaking plugins but not on non-termux systems #17485

Open hasezoey opened 1 year ago

hasezoey commented 1 year ago

Problem description

Currently when using a zsh config and oh-my-zsh with setopt nocaseglob, it breaks some plugins, resulting in:

(all of these issues do not happen after calling unsetopt nocaseglob if it was set, or setopt nocaseglob was never called in the first place)

likely related to #2569

What steps will reproduce the bug?

Full .zshrc config ```zsh export ZSH="/data/data/com.termux/files/home/.oh-my-zsh" # Set ZSH Options setopt correct # Auto correct mistakes setopt nocaseglob # Case insensitive globbing setopt rcexpandparam # Better Expand Array parameters setopt checkjobs # Warn for any background or suspended jobs managed by the current shell setopt numericglobsort # When possible, sort by number and not by alphabet setopt nobeep # Disable any beeps setopt appendhistory # Better history keeping when multiple shell instances are used setopt histignorealldups # Remove old (exact) history entries, and append new one setopt autocd # If only a directory path is ented, interpret it as a "cd" setopt inc_append_history # Write command to history file directly after entering it setopt extended_glob # Allow more patterns with glob # Set ZSH completion behaviour zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc) zstyle ':completion:*' rehash true # automatically find new executables in path ## Speed up completions zstyle ':completion:*' accept-exact '*(N)' zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.zsh/cache # Set ZSH Variables HISTFILE=~/.zsh_history # Set History file location HISTSIZE=1000 # Set the ZSH Command history length to 1k SAVEHIST=1000 # Set something to 1k HIST_STAMPS="dd.mm.yyyy" # Set History file timestamp format WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word ZSH_THEME_TERM_TAB_TITLE_IDLE="%30<..<%~%<<" # Set TAB idle to 30 char left truncated of current PWD ZSH_THEME_TERM_TITLE_IDLE="%n@%m:%~" # no idea ZSH_CACHE_DIR=~/.cache/zsh # Set ZSH cache directory to use the home-cache CASE_SENSITIVE="false" # Change ZSH to be case-insensitive fpath=($ZSH_CUSTOM $fpath) # no idea DISABLE_AUTO_UPDATE="true" # disable oh-my-zsh update checking # ZSH Themeing autoload -U compinit colors zcalc # compinit -d # Init auto-completion of files _comp_options+=(globdots) # Enable ".files" for auto-completions colors # Enable ZSH colors? ZSH_THEME="agnoster" # Set ZSH theme # Set ZSH keybindings bindkey -e bindkey '^[[7~' beginning-of-line # Home key bindkey '^[[H' beginning-of-line # Home key if [[ "${terminfo[khome]}" != "" ]]; then bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line fi bindkey '^[[8~' end-of-line # End key bindkey '^[[F' end-of-line # End key if [[ "${terminfo[kend]}" != "" ]]; then bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line fi bindkey '^[[2~' overwrite-mode # Insert key bindkey '^[[3~' delete-char # Delete key bindkey '^[[C' forward-char # Right key bindkey '^[[D' backward-char # Left key bindkey '^[[5~' history-beginning-search-backward # Page up key bindkey '^[[6~' history-beginning-search-forward # Page down key ## Navigate words with ctrl+arrow keys bindkey '^[Oc' forward-word # bindkey '^[Od' backward-word # bindkey '^[[1;5D' backward-word # bindkey '^[[1;5C' forward-word # bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace bindkey '^[[Z' undo # Shift+tab undo last action export EDITOR="nano" # ZSH Plugins ## Use ohmyzsh plugins=( git git-extras history-substring-search colored-man-pages # zsh-syntax-highlighting # zsh-autosuggestions ) source $ZSH/oh-my-zsh.sh ```

What is the expected behavior?

to work without problems given the zshrc, because it is the exact same as i use in manjaro (23.0.0), linux mint (21.2) and ubuntu (22.04)

System information

termux-info:

Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=24453
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main/ stable main
Updatable packages:
All packages up to date
termux-tools version:
1.38.3
Android version:
13
Kernel build information:
Linux localhost 5.4.242-qgki-gafa23b20dc17 #1 SMP PREEMPT Tue Jul 18 01:36:34 UTC 2023 aarch64 Android
Device manufacturer:
OnePlus
Device model:
LE2123
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so

termux install:

manjaro install:

in case it matters:

$ diff compinit_termux compinit_manjaro               
76d75
< unsetopt nocaseglob
TomJo2000 commented 8 months ago

Will look into this in a couple hours.

ylwhatt commented 1 month ago

so i did this janky thing and it fixed it in so far as i can tell... im no power user so the scope of what i do on the daily is very narrow...

at line 527 of zsh-syntax-highlighting.zsh i put

cd $HOME
for highlighter_dir (..${1#*com.termux/files}/*/); do

then at line 550

done
cd $OLDPWD

prolly dont need the two cd commands i just had a feeling it might help... dunno about the noglob thing with this... please lemme know if theres a better way or if this is dangerous in some way... came up with it half asleep last night outta nowhere thought id share...