Skip to content

bump(main/zsh): 5.9.1#30006

Open
TomJo2000 wants to merge 2 commits into
termux:masterfrom
TomJo2000:zsh-5.9.1
Open

bump(main/zsh): 5.9.1#30006
TomJo2000 wants to merge 2 commits into
termux:masterfrom
TomJo2000:zsh-5.9.1

Conversation

@TomJo2000
Copy link
Copy Markdown
Member

This PR updates Zsh to version 5.9.1
The PCRE2 patch is now part of upstream.
A couple other patches needed regenerating.
And I've renamed a few other patches for consistency.

I'm currently working on another commit to enable completions by default,
similarly to what we do for Bash.

@TomJo2000
Copy link
Copy Markdown
Member Author

TomJo2000 commented Jun 1, 2026

This is gonna need more testing.
It appears that neither setting --enable-site-fndir=no

--enable-site-fndir=no

nor the previous hunk in configure.ac.patch,
diff --git a/configure.ac b/configure.ac
index c72148d06..1cecd2faa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -318,7 +318,7 @@ dnl Add /usr/local/share/zsh/site-functions if not yet present
dnl owing to $sitefndir, whether or not explicitly given.
dnl If not explicitly given, it hasn't been expanded yet.
if test X$sitefndir = X/usr/local/share/zsh/site-functions || \
- test X$sitefndir = Xno
+ test X$sitefndir = Xno || true
then fixed_sitefndir=''
elif test X$prefix != X/usr/local; then
if test X$prefix = XNONE && test X$ac_default_prefix = X/usr/local; then

actually worked to disable the version specific site directory at $TERMUX_PREFIX/usr/share/zsh/$ZSH_VERSION/functions.

What we want is a structure similar to what's present in e.g. Arch Linux.

/usr/share/zsh//
├── 5.9/
│   └── help/
├── functions/
├── scripts/
└── site-functions/

With only the help entries for the built-in commands under a version specific directory.
Whereas we currently have:

data/data/com.termux/files/usr/share/zsh/
└── 5.9.1/
    ├── functions/
    ├── help/
    └── scripts/

(This is also the case for 5.9, at least as far back as 5.9-7, I need to do some earlier builds to confirm.)

@TomJo2000
Copy link
Copy Markdown
Member Author

Okay, what was missing here was;

--enable-function-subdirs
--enable-fndir=$TERMUX_PREFIX/share/zsh/functions
--enable-scriptdir=$TERMUX_PREFIX/share/zsh/scripts

That way functions/ and scripts/ doesn't end up in the versioned directory, only the help/ directory does.

The site-functions/ directory is intended to be used for additional vendored completions, similar to e.g. fish/vendor_completions.d/.

@TomJo2000
Copy link
Copy Markdown
Member Author

TomJo2000 commented Jun 2, 2026

--enable-function-subdirs actually preserves the upstream distinctions between completions categories
The ${fpath[@]} prior to enabling it is:

/data/data/com.termux/files/usr/share/zsh/5.9/functions

After enabling it (with newlines inserted between entries for separation)

/data/data/com.termux/files/usr/share/zsh/site-functions
/data/data/com.termux/files/usr/share/zsh/functions/Calendar
/data/data/com.termux/files/usr/share/zsh/functions/Chpwd
/data/data/com.termux/files/usr/share/zsh/functions/Completion
/data/data/com.termux/files/usr/share/zsh/functions/Completion/AIX
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Base
/data/data/com.termux/files/usr/share/zsh/functions/Completion/BSD
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Cygwin
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Darwin
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Debian
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Linux
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Mandriva
/data/data/com.termux/files/usr/share/zsh/functions/Completion/openSUSE
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Redhat
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Solaris
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Unix
/data/data/com.termux/files/usr/share/zsh/functions/Completion/X
/data/data/com.termux/files/usr/share/zsh/functions/Completion/Zsh
/data/data/com.termux/files/usr/share/zsh/functions/Exceptions
/data/data/com.termux/files/usr/share/zsh/functions/Math
/data/data/com.termux/files/usr/share/zsh/functions/MIME
/data/data/com.termux/files/usr/share/zsh/functions/Misc
/data/data/com.termux/files/usr/share/zsh/functions/Newuser
/data/data/com.termux/files/usr/share/zsh/functions/Prompts
/data/data/com.termux/files/usr/share/zsh/functions/VCS_Info
/data/data/com.termux/files/usr/share/zsh/functions/VCS_Info/Backends
/data/data/com.termux/files/usr/share/zsh/functions/Zle

I don't know if keeping that distinction is all that useful.
(Although it wouldn't hurt anything to keep it, just adds extra array entries in a built-in array.)
When I remove --enable-function-subdirs from the build the standard ${fpath[@]} becomes

/data/data/com.termux/files/usr/share/zsh/site-functions
/data/data/com.termux/files/usr/share/zsh/functions

Which still covers the site-functions/ by default, which is what we wanted.

I don't have a preference here one way or the other.
But we are not currently splitting these into separate directories.
We are also not currently shipping site-functions/ in the default ${fpath[@]} either though,
so if we're making sure that ends up in there we can make sure the functions are differentiated while we're at it.

@TomJo2000
Copy link
Copy Markdown
Member Author

Eh in case I buried the lead on this in the above comment.
The package works as expected on-device and passes every test I can come up with as expected.

Comment thread packages/zsh/src-init.c.patch
TomJo2000 added 2 commits June 3, 2026 16:21
Also port the ability to pass PS1 to the shell on invocation from bash.
And fix some missing helper functions for the Debian completions.
Comment thread packages/zsh/build.sh
Comment on lines +83 to 95
# This becomes $TERMUX_PREFIX/share/zsh/functions/Completion/Unix/ after compilation.
# Command and Type are not differentiated in the final directory structure.
local compdef
local -a used_on_termux=(
'Debian/Command/_apt' # packages/apt
'Debian/Command/_apt-file' # packages/apt-file
'Debian/Command/_apt-show-versions' # packages/apt-show-versions
'Debian/Command/_dpkg' # packages/dpkg
'Debian/Type/_deb_files' # Used by _apt
'Debian/Type/_deb_packages' # Used by _apt, _apt-file, _apt-show-versions, _dpkg
'Debian/Command/_update-alternatives' # packages/dpkg
'Redhat/Command/_rpm' # packages/rpm
)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually pretty important and I should have caught this earlier.
I missed two of the needed files with library functions for the _apt completions and related.

I only noticed the problem after testing the completions with no ~/.zshrc since I apparently had another copy of them in my ${fpath[@]}.

@TomJo2000 TomJo2000 requested a review from robertkirkman June 3, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants