Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Do not try to escape exclamation marks #399

Conversation

jankatins
Copy link
Contributor

@jankatins jankatins commented Oct 17, 2022

For normal hooks, the exclamation mark handling (which adds entries into ZINIT_EXTS2) was fixed in #227 and for both ZINIT_EXTS and ZINIT_EXTS2 the escaped exclamation marks were adjusted. But annexes could also register hooks with exclamation marks into ZINIT_EXTS and this part was not modified. Therefore annex registering for exclamation mark hooks did not work anymore.

Description

See above + the part where ZINIT_EXTS is modified is now also adjusted in a similar manner as in #227 to not expand history chars (=exclamation marks).

Motivation and Context

See zdharma-continuum/zinit-annex-patch-dl#6

Related Issue(s)

See zdharma-continuum/zinit-annex-patch-dl#6

Usage examples

The following three prints should all three print the same (two) lines (espcially no escaped exclamation mark!) when the dl annex is used in .zshrc:

zsh -i -c 'print -rC1 -- "$ZINIT_EXTS[@]" |sort | grep "patch-dl"'
zsh -c 'source .zshrc && print -rC1 -- "$ZINIT_EXTS[@]" |sort | grep "patch-dl"'
exec zsh 
print -rC1 -- "$ZINIT_EXTS[@]" |sort | grep "patch-dl"

Example:

λ  print -rC1 -- "$ZINIT_EXTS[@]" |sort | grep 'patch-dl'
11 z-annex-data: zinit-annex-patch-dl hook:!atclone-20 za-patch-dl-handler za-patch-dl-help-null-handler dl\'\'\|patch\'\'
12 z-annex-data: zinit-annex-patch-dl hook:!atpull-20 za-patch-dl-handler za-patch-dl-help-null-handler ''

How Has This Been Tested?

λ  zinit delete dltest -y

Done (action executed, exit code: 0)

λ  zi for id-as'dltest' as'null' dl'https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.zsh' nocompile pick'key-bindings.zsh' @zdharma-continuum/null

Downloading zdharma-continuum/null… (at label: dltest…)
Cloning into '/home/jan/.local/share/zinit/plugins/dltest'...
⠙ ███████████ OBJ: 100, PACK: 8/8, COMPR: 100%, REC: 100%
[patch-dl annex]: File key-bindings.zsh downloaded correctly

(the last line didn't show up before this fix, but I have not verified if this actually loads the right file and so on as I don't use fzf that much)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@jankatins
Copy link
Contributor Author

jankatins commented Oct 17, 2022

The ubuntu cases fail with

Run brew install ncurses svn unzip zsh
/home/runner/work/_temp/c245a1ac-e773-41eb-bb97-2f6b316ec4[8](https://github.com/zdharma-continuum/zinit/actions/runs/3267870424/jobs/5373603132#step:4:9)1.sh: line 1: brew: command not found
Error: Process completed with exit code 127.

-> I have no clue, I thought brew would be used on mac?

Seems the zshelldoc test is also completely out of date, at least I didn't change so many places :-) https://github.com/zdharma-continuum/zinit/actions/runs/3267870423/jobs/5373603140

@vladdoster
Copy link
Member

vladdoster commented Oct 17, 2022

In the latest version of the Ubuntu GitHub runner, they don't include Homebrew in $PATH. I'll finish work in #380 to unblock you and get tests green again.

Homebrew on Linux is named Linuxbrew. You use same install script with the only caveat is that Linuxbrew does not support Casks.

@jankatins
Copy link
Contributor Author

jankatins commented Oct 17, 2022

Might be faster to check this PR and then regenerate the zshelldoc test :-)

(the last time I couldn't get that part to work and in the end I manually edited the files to confirm to whatever the test wanted :-))

@jankatins
Copy link
Contributor Author

So, I ran into this now myself:

zinit default-ice --quiet as'null' from"gh-r" lbin'!' lucid nocompile nocompletions
# Faster way to switch between clusters and namespaces in kubectl
zinit id-as'kubectx' lbin'!kubectx' bpick'kubectx*' dl'https://raw.githubusercontent.com/ahmetb/kubectx/master/completion/_kubectx.zsh -> _kubectx' for @ahmetb/kubectx
zinit id-as'kubens' lbin'!kubens' bpick'kubens*' dl'https://raw.githubusercontent.com/ahmetb/kubectx/master/completion/_kubens.zsh -> _kubens' for @ahmetb/kubectx

Without the change in this PR:

λ exec zsh

Downloading zdharma-continuum/zinit-annex-patch-dl…
Cloning into '/Users/jankatins/.local/share/zinit/plugins/zdharma-continuum---zinit-annex-patch-dl'...
⠙ ███████████ OBJ: 100, PACK: 9/9, COMPR: 100%, REC: 100%
Note: Compiling: z-a-patch-dl.plugin.zsh… OK.

Downloading ahmetb/kubectx… (at label: kubectx…)
(Requesting `kubectx_v0.9.4_darwin_x86_64.tar.gz'…)
#################################################################################################################################################################################################### 100.0%
ziextract: Unpacking the files from: `kubectx_v0.9.4_darwin_x86_64.tar.gz'…
ziextract: Successfully extracted and assigned +x chmod to the file: `kubectx'.
linkbin annex: Created the kubectx soft link and set +x on the kubectx binary

Downloading ahmetb/kubectx… (at label: kubens…)
(Requesting `kubens_v0.9.4_darwin_x86_64.tar.gz'…)
#################################################################################################################################################################################################### 100.0%
ziextract: Unpacking the files from: `kubens_v0.9.4_darwin_x86_64.tar.gz'…
ziextract: Successfully extracted and assigned +x chmod to the file: `kubens'.
linkbin annex: Created the kubens soft link and set +x on the kubens binary

With the patch:

λ  exec zsh

Downloading ahmetb/kubectx… (at label: kubectx…)
(Requesting `kubectx_v0.9.4_darwin_x86_64.tar.gz'…)
#################################################################################################################################################################################################### 100.0%
ziextract: Unpacking the files from: `kubectx_v0.9.4_darwin_x86_64.tar.gz'…
ziextract: Successfully extracted and assigned +x chmod to the file: `kubectx'.
[patch-dl annex]: File _kubectx downloaded correctly
linkbin annex: Created the kubectx soft link and set +x on the kubectx binary

Downloading ahmetb/kubectx… (at label: kubens…)
(Requesting `kubens_v0.9.4_darwin_x86_64.tar.gz'…)
#################################################################################################################################################################################################### 100.0%
ziextract: Unpacking the files from: `kubens_v0.9.4_darwin_x86_64.tar.gz'…
ziextract: Successfully extracted and assigned +x chmod to the file: `kubens'.
[patch-dl annex]: File _kubens downloaded correctly
linkbin annex: Created the kubens soft link and set +x on the kubens binary

Interestingly, I have found no way with other ices to actually get the completions getting recognized during installation: could it be that the completions are searched for before the dl ice runs (compile seems to also run beforehand!) ? In the end I ran zinit creinstall kubens && zinit creinstall kubectx once and it works now (seems the symlinks are enough to get this loaded).

@seagle0128
Copy link

I can confirm this fix the issue. Please merge the PR. Thanks!

@vladdoster vladdoster merged commit 0e55b2e into zdharma-continuum:main Oct 29, 2022
@vladdoster
Copy link
Member

@jankatins you are on fire with bug fixes! Your contributions have fixed some subtle bugs, much thanks for taking the time to triage and fix them.

github-actions bot pushed a commit that referenced this pull request Nov 7, 2022
# [3.8.0](v3.7.0...v3.8.0) (2022-11-07)

### Bug Fixes

* account for systems where musl is present ([#269](#269)) ([8620574](8620574))
* alist repository for gh-r test ([#305](#305)) ([fb3c082](fb3c082))
* allow zinit to be run from non-interactive scripts ([#227](#227)) ([c3d1bb5](c3d1bb5)), closes [#199](#199)
* broken yaml syntax in issue template ([#355](#355)) ([f729e06](f729e06))
* calico gh-r zunit test ([#356](#356)) ([56fb9e0](56fb9e0))
* change ctags symbols browser key  binding from `ctrl-k` to `alt-Q` ([#387](#387)) ([7f6dc7d](7f6dc7d)), closes [#386](#386)
* Do not try to escape exclamation marks ([#399](#399)) ([0e55b2e](0e55b2e))
* docs workflow should fail if out-of-date ([#278](#278)) ([07cde66](07cde66))
* Don't error if $OPTS is not yet defined in .zinit-compinit call ([44765e0](44765e0))
* filter by runtime detected CPU before compiled CPU ([#304](#304)) ([a4dc13f](a4dc13f)), closes [#287](#287)
* gh-r & plugin zunit tests ([dd12fce](dd12fce))
* gh-r filters i686 (32 bit) for x86_64 ([#226](#226)) ([57f0d82](57f0d82)), closes [#225](#225)
* gh-r logic ignores [36]86 assets ([#235](#235)) ([d60638f](d60638f)), closes [#225](#225) [#246](#246) [#247](#247)
* gh-r removes linux32 assets on 64 bit OS ([1864c0b](1864c0b))
* gh-r retrieves release data GH REST API  ([#373](#373)) ([4a2a120](4a2a120)), closes [#374](#374)
* modify regex in gh-r for assets to not consider for selection ([#244](#244)) ([6ef8439](6ef8439))
* more cleaning up urls ([672ae51](672ae51)), closes [#47](#47)
* names of ctag Make target deps ([#407](#407)) ([9987d5c](9987d5c))
* package are broken again ([24f10f6](24f10f6))
* permissions for PR labeler GH action workflow ([#236](#236)) ([8a0d567](8a0d567))
* read without -r is generally bad. ([00c70a4](00c70a4))
* remove curl option "--tcp-fastopen" which is not always available ([#299](#299)) ([308c9d4](308c9d4))
* remove macOS 10.5 & 11 from test matrix ([c613193](c613193))
* remove use less line ([4f87076](4f87076))
* rename `docs` to `doc` to match doc dir ([#212](#212)) ([3a7dc95](3a7dc95))
* rm linux32 assets in aarch64/arm64 gh-r regex ([#414](#414)) ([529aa20](529aa20))
* syntax error when checking for `realpath` command  ([#259](#259)) ([05559eb](05559eb)), closes [#257](#257)
* trigger for PR labeler GH action workflow ([#237](#237)) ([49af866](49af866))
* typo & triggers in documentation workflow ([#308](#308)) ([161d7c1](161d7c1))
* unmatched "(" in windows gh-r patterns ([#280](#280)) ([1f4ba5a](1f4ba5a))
* update `zdharma` to `zdharma-continuum` ([66b1700](66b1700))
* update docs for new jq-check ([6207427](6207427))
* use [*] inside arbitrary strings. ([73a8c92](73a8c92))
* workflow pkg mgmt due to base OS changes ([195f72d](195f72d))
* ziextract execs discovery regex ([#410](#410)) ([105b38a](105b38a))
* zunit install in GH workflow ([#412](#412)) ([f4787dc](f4787dc))

### Features

* ability to set program for `zinit ls` to use ([#221](#221)) ([bad7af3](bad7af3)), closes [#170](#170)
* add `-a` (actual time) to `zinit times` cmd ([#223](#223)) ([450d3c1](450d3c1))
* add `krew` and `prebuilt-ripgrep` gh-r zunit tests ([#267](#267)) ([f25b4ae](f25b4ae))
* add compile vim from source zunit test ([#232](#232)) ([126528c](126528c))
* add configure"" ice ([#334](#334)) ([40a46c6](40a46c6))
* add GH action to remove old workflow logs ([#248](#248)) ([6647bdc](6647bdc))
* add PR labeler to show what parts of Zinit are changed ([#211](#211)) ([42e83d7](42e83d7))
* add releases via semantic-release ([73542b4](73542b4))
* add releases via semantic-release ([#415](#415)) ([cfa2f0e](cfa2f0e))
* expand linted file types to markdown and shell ([96fe03f](96fe03f))
* **git-process-output:** simplify progress-bar ([#204](#204)) ([c888917](c888917))
* update output messaging to be more informative ([047320a](047320a))
@github-actions
Copy link

github-actions bot commented Nov 7, 2022

🎉 This PR is included in version 3.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

psprint pushed a commit to psprint/.priv-zinit-fork that referenced this pull request Dec 30, 2022
psprint pushed a commit to psprint/.priv-zinit-fork that referenced this pull request Dec 30, 2022
# [3.8.0](zdharma-continuum/zinit@v3.7.0...v3.8.0) (2022-11-07)

### Bug Fixes

* account for systems where musl is present ([zdharma-continuum#269](zdharma-continuum#269)) ([8620574](zdharma-continuum@8620574))
* alist repository for gh-r test ([zdharma-continuum#305](zdharma-continuum#305)) ([fb3c082](zdharma-continuum@fb3c082))
* allow zinit to be run from non-interactive scripts ([zdharma-continuum#227](zdharma-continuum#227)) ([c3d1bb5](zdharma-continuum@c3d1bb5)), closes [zdharma-continuum#199](zdharma-continuum#199)
* broken yaml syntax in issue template ([zdharma-continuum#355](zdharma-continuum#355)) ([f729e06](zdharma-continuum@f729e06))
* calico gh-r zunit test ([zdharma-continuum#356](zdharma-continuum#356)) ([56fb9e0](zdharma-continuum@56fb9e0))
* change ctags symbols browser key  binding from `ctrl-k` to `alt-Q` ([zdharma-continuum#387](zdharma-continuum#387)) ([7f6dc7d](zdharma-continuum@7f6dc7d)), closes [zdharma-continuum#386](zdharma-continuum#386)
* Do not try to escape exclamation marks ([zdharma-continuum#399](zdharma-continuum#399)) ([0e55b2e](zdharma-continuum@0e55b2e))
* docs workflow should fail if out-of-date ([zdharma-continuum#278](zdharma-continuum#278)) ([07cde66](zdharma-continuum@07cde66))
* Don't error if $OPTS is not yet defined in .zinit-compinit call ([44765e0](zdharma-continuum@44765e0))
* filter by runtime detected CPU before compiled CPU ([zdharma-continuum#304](zdharma-continuum#304)) ([a4dc13f](zdharma-continuum@a4dc13f)), closes [zdharma-continuum#287](zdharma-continuum#287)
* gh-r & plugin zunit tests ([dd12fce](zdharma-continuum@dd12fce))
* gh-r filters i686 (32 bit) for x86_64 ([zdharma-continuum#226](zdharma-continuum#226)) ([57f0d82](zdharma-continuum@57f0d82)), closes [zdharma-continuum#225](zdharma-continuum#225)
* gh-r logic ignores [36]86 assets ([zdharma-continuum#235](zdharma-continuum#235)) ([d60638f](zdharma-continuum@d60638f)), closes [zdharma-continuum#225](zdharma-continuum#225) [zdharma-continuum#246](zdharma-continuum#246) [zdharma-continuum#247](zdharma-continuum#247)
* gh-r removes linux32 assets on 64 bit OS ([1864c0b](zdharma-continuum@1864c0b))
* gh-r retrieves release data GH REST API  ([zdharma-continuum#373](zdharma-continuum#373)) ([4a2a120](zdharma-continuum@4a2a120)), closes [zdharma-continuum#374](zdharma-continuum#374)
* modify regex in gh-r for assets to not consider for selection ([zdharma-continuum#244](zdharma-continuum#244)) ([6ef8439](zdharma-continuum@6ef8439))
* more cleaning up urls ([672ae51](zdharma-continuum@672ae51)), closes [zdharma-continuum#47](zdharma-continuum#47)
* names of ctag Make target deps ([zdharma-continuum#407](zdharma-continuum#407)) ([9987d5c](zdharma-continuum@9987d5c))
* package are broken again ([24f10f6](zdharma-continuum@24f10f6))
* permissions for PR labeler GH action workflow ([zdharma-continuum#236](zdharma-continuum#236)) ([8a0d567](zdharma-continuum@8a0d567))
* read without -r is generally bad. ([00c70a4](zdharma-continuum@00c70a4))
* remove curl option "--tcp-fastopen" which is not always available ([zdharma-continuum#299](zdharma-continuum#299)) ([308c9d4](zdharma-continuum@308c9d4))
* remove macOS 10.5 & 11 from test matrix ([c613193](zdharma-continuum@c613193))
* remove use less line ([4f87076](zdharma-continuum@4f87076))
* rename `docs` to `doc` to match doc dir ([zdharma-continuum#212](zdharma-continuum#212)) ([3a7dc95](zdharma-continuum@3a7dc95))
* rm linux32 assets in aarch64/arm64 gh-r regex ([zdharma-continuum#414](zdharma-continuum#414)) ([529aa20](zdharma-continuum@529aa20))
* syntax error when checking for `realpath` command  ([zdharma-continuum#259](zdharma-continuum#259)) ([05559eb](zdharma-continuum@05559eb)), closes [zdharma-continuum#257](zdharma-continuum#257)
* trigger for PR labeler GH action workflow ([zdharma-continuum#237](zdharma-continuum#237)) ([49af866](zdharma-continuum@49af866))
* typo & triggers in documentation workflow ([zdharma-continuum#308](zdharma-continuum#308)) ([161d7c1](zdharma-continuum@161d7c1))
* unmatched "(" in windows gh-r patterns ([zdharma-continuum#280](zdharma-continuum#280)) ([1f4ba5a](zdharma-continuum@1f4ba5a))
* update `zdharma` to `zdharma-continuum` ([66b1700](zdharma-continuum@66b1700))
* update docs for new jq-check ([6207427](zdharma-continuum@6207427))
* use [*] inside arbitrary strings. ([73a8c92](zdharma-continuum@73a8c92))
* workflow pkg mgmt due to base OS changes ([195f72d](zdharma-continuum@195f72d))
* ziextract execs discovery regex ([zdharma-continuum#410](zdharma-continuum#410)) ([105b38a](zdharma-continuum@105b38a))
* zunit install in GH workflow ([zdharma-continuum#412](zdharma-continuum#412)) ([f4787dc](zdharma-continuum@f4787dc))

### Features

* ability to set program for `zinit ls` to use ([zdharma-continuum#221](zdharma-continuum#221)) ([bad7af3](zdharma-continuum@bad7af3)), closes [zdharma-continuum#170](zdharma-continuum#170)
* add `-a` (actual time) to `zinit times` cmd ([zdharma-continuum#223](zdharma-continuum#223)) ([450d3c1](zdharma-continuum@450d3c1))
* add `krew` and `prebuilt-ripgrep` gh-r zunit tests ([zdharma-continuum#267](zdharma-continuum#267)) ([f25b4ae](zdharma-continuum@f25b4ae))
* add compile vim from source zunit test ([zdharma-continuum#232](zdharma-continuum#232)) ([126528c](zdharma-continuum@126528c))
* add configure"" ice ([zdharma-continuum#334](zdharma-continuum#334)) ([40a46c6](zdharma-continuum@40a46c6))
* add GH action to remove old workflow logs ([zdharma-continuum#248](zdharma-continuum#248)) ([6647bdc](zdharma-continuum@6647bdc))
* add PR labeler to show what parts of Zinit are changed ([zdharma-continuum#211](zdharma-continuum#211)) ([42e83d7](zdharma-continuum@42e83d7))
* add releases via semantic-release ([73542b4](zdharma-continuum@73542b4))
* add releases via semantic-release ([zdharma-continuum#415](zdharma-continuum#415)) ([cfa2f0e](zdharma-continuum@cfa2f0e))
* expand linted file types to markdown and shell ([96fe03f](zdharma-continuum@96fe03f))
* **git-process-output:** simplify progress-bar ([zdharma-continuum#204](zdharma-continuum#204)) ([c888917](zdharma-continuum@c888917))
* update output messaging to be more informative ([047320a](zdharma-continuum@047320a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants