Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ZFS Compression Autocomplete Does Not Suggest ZSTD compression
- X-seq: zsh-workers 54280
- From: hguenfaf@xxxxxxxxx
- To: Oliver Kiddle <opk@xxxxxxx>
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: ZFS Compression Autocomplete Does Not Suggest ZSTD compression
- Date: Fri, 03 Apr 2026 15:19:25 +0000
- Archived-at: <https://zsh.org/workers/54280>
- Feedback-id: 65187252:user:proton
- In-reply-to: <17719-1775142140.457626@OLVP.lA6X.Qumi>
- List-id: <zsh-workers.zsh.org>
- References: <ReLpw8UieMahf8bSu6Sk485FFbVfu72Lo1CZAvtzcnFu3qwgR88JJ20eR7G4WxpFlGvTKFx3fNFuZgbnwGgWXO0Rb0xXyJdSE4X2P2HQpJo=@proton.me> <17719-1775142140.457626@OLVP.lA6X.Qumi>
Hello Oliver,
Thank you kindly for the feedback,
The patch worked like a charm :) I truly appreciate it
For the sake of completeness, Please find below the new result of the applying patch,
```
gzip gzip-8 zstd-1 zstd-17 zstd-7 zstd-fast-2 zstd-fast-500 zstd-fast-90
gzip-1 gzip-9 zstd-10 zstd-18 zstd-8 zstd-fast-20 zstd-fast-6
gzip-2 lz4 zstd-11 zstd-19 zstd-9 zstd-fast-3 zstd-fast-60
gzip-3 lzjb zstd-12 zstd-2 zstd-fast zstd-fast-30 zstd-fast-7
gzip-4 off zstd-13 zstd-3 zstd-fast-1 zstd-fast-4 zstd-fast-70
gzip-5 on zstd-14 zstd-4 zstd-fast-10 zstd-fast-40 zstd-fast-8
gzip-6 zle zstd-15 zstd-5 zstd-fast-100 zstd-fast-5 zstd-fast-80
gzip-7 zstd zstd-16 zstd-6 zstd-fast-1000 zstd-fast-50 zstd-fast-9
```
==================================================
The below is another "issue" (could be intended behavior idk) I've noticed but I'm not sure if I need to open a new issue or not (I probably should, but IDK TBH). Please let me know _/\_
Another thing I wanted to point out is that the `zfs` command pool or dataset auto-completion is adding a trailing backslash `/` wich `zfs` doesn't like. This only happens for `zfs` commands and not `zpool`.
`zfs [SUBCMD] [POOL]` or `zfs [SUBCMD] [POOL]/[DATASET]` when the `[POOL]` or `[DATASET]` is tabbed to auto complete it will be completed to `[POOL]/` or `[DATASET]/` if ZSH detects a sub-directory in the filesystem (which is fine when traversing directories, but IMHO this case is a bit different), however, I would assume that most users would prefer to have the choice (via a parameter or an environment variable) to either add or omit the trailing backslash since usually the `-r` (recursive, to show all datasets under a pool, in which case only the pool name is required without the trailing backslash) option is used and only `[POOL]` is specified. Example below,
```
zfs list -r tank/
cannot open 'tank/': trailing slash in name
```
Br,
On Thursday, April 2nd, 2026 at 4:02 PM, Oliver Kiddle <opk@xxxxxxx> wrote:
> hguenfaf@xxxxxxxxx wrote:
> > So sorry if this is the wrong mailing list to report this, this is my first,
>
> Reporting here is perfect.
>
> > The issue is that zfs set compression=[ALGO] [POOL] command does not show a
> > completion for zstd compression algorithm. Please find below the suggested
> > algorithms
>
> This is a bug in the completion definition and the patch below fixes it.
>
> There's a $comp_algorithms array which is first set to the basic set and
> then extended depending on things like whether you're running openzfs
> or Solaris zfs. But it is used before getting extended. In this case,
> preventing the early expansion by using single quotes works fine because
> it does get expanded later in the _values helper.
>
> > I'm using OpenZFS under Archlinux, with the latest ZSH as of now "zsh 5.9
>
> There have also been other updates to the zfs completion since zsh 5.9
> covering OpenZFS 2.2 features. I'll try to update it up to 2.4 soon.
> Individual completions taken from our git repository will usually work
> fine against the latest release if there are particular commands you
> care about.
>
> The patch also fixes one other small error related to quoting in
> _values.
>
> Oliver
>
> diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
> index ec904a41b..9012bb6b2 100644
> --- a/Completion/Unix/Command/_zfs
> +++ b/Completion/Unix/Command/_zfs
> @@ -65,10 +65,10 @@ rw_ds_props=(
> 'aclinherit:value:(discard noallow restricted passthrough passthrough-x)'
> 'atime:value:(on off)'
> 'canmount:value:(on off noauto)'
> - "checksum:value:($sum_algorithms)"
> - "compression:value:($comp_algorithms)"
> + 'checksum:value:($sum_algorithms)'
> + 'compression:value:($comp_algorithms)'
> 'copies:value:(1 2 3)'
> - "dedup:value:($dedup_algorithms)"
> + 'dedup:value:($dedup_algorithms)'
> 'devices:value:(on off)'
> 'encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)'
> 'exec:value:(on off)'
> @@ -1416,7 +1416,7 @@ while (( $#state )); do
> case $MATCH in
> *feature@) _wanted states expl state compadd active enabled disabled ;;
> *quota@) _alternative \
> - 'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \
> + 'sizes: :_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
> 'properties:property:(none)'
> ;;
> esac
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author