olets / zsh-abbr

The zsh manager for auto-expanding abbreviations, inspired by fish. ~13,000 unique cloners as of May '24, 580+ Homebrew installs 6/23-6/24
https://zsh-abbr.olets.dev
Other
511 stars 18 forks source link

Using zi/zinit's `sbin'**/eza -> ls'` to replace `ls` with `eza` breaks zsh-abbr initialization #133

Closed arielsalvo closed 1 month ago

arielsalvo commented 1 month ago

Is there an existing issue for this?

Update the issue title

Expected Behavior

I expected abbr to complete installation even if eza replaced ls

Actual Behavior

Sometimes the installation hangs for a long time and needs to be interrupted and others I get messages like this:

abbr: A job added at 11:20:02 May 29 2024 has timed out.
The job was related to initialization.
This could be the result of manually terminating an abbr activity, for example during session startup.
If you believe it reflects an abbr bug, please report it at https://github.com/olets/zsh-abbr/issues/new

From the list of processes, the line taking a long time is this one

It seems eza and ls don't have the exact same parameters: Tool Meaning and use of -t
ls -t sort by time, newest first; see --time
eza -t, --time FIELD which timestamp field to list (modified, accessed, created)

Steps To Reproduce

I'm using ZI to install both eza and abbr. Some instructions to install eza call for replacing ls with eza.

Environment

zsh-abbr version 5.8.0
zsh 5.9 (x86_64-ubuntu-linux-gnu)
OSTYPE linux-gnu

Installation method

Plugin manager

Installation method details

 

[!CAUTION] maintainer edit The following installation method uses zi. As of this writing, zi is considered by some to be unsafe. Read the comments in this Issue for details.

zi for \
from'gh-r' \
dl'https://github.com/eza-community/eza/raw/main/completions/zsh/_eza' \
as'program' \
sbin'**/eza -> ls' \
eza-community/eza
zi for \
  atload'typeset -gx ABBR_SET_EXPANSION_CURSOR=1' \
  load olets/zsh-abbr

Anything else?

I don't know if you'd want to fix this one or even if it can be fixed but I submit it all the same at least to add to the docs

olets commented 1 month ago

Do you still have the problem if you use an officially-supported eza installation method (see https://github.com/eza-community/eza/blob/main/INSTALL.md), and then use an alias?

With eza installed, aliasing is done like so

# .zshrc
alias -g ls=eza

Then you'll be able to

% ls # runs `eza`
% foo bar ls # runs `foo bar eza`

As of #13, zsh-abbr should play nicely with that alias.

--

Sidenote: be cautious using zi. It and all z-shell software is widely considered unsafe. Some links in chronological order. (Disclaimer: some of these comments are from me)

  1. https://www.reddit.com/r/zsh/comments/sqsni7/comment/hwodbgv/
  2. https://www.reddit.com/r/zsh/comments/xlrdnq/comment/ipnrr77/
  3. https://www.reddit.com/r/zsh/comments/1as77bn/comment/kqt8yz4/
  4. https://recurse.social/@dylnuge/112224580867240812
  5. https://www.reddit.com/r/zsh/comments/1c3r5gn/comment/kziti8a/
arielsalvo commented 1 month ago

Doesn't seem to have any issues when using an alias, no. That's why I don't know how much this merits a fix (maybe it's just a matter of saying "don't mess with ls).

I know this is going off-track from the issue but I switched from bash not too long ago so I'm looking for honest opinion from someone with more zsh exp...

Regarding the warning regarding ZI, I did come across some of that: mostly those regarding the lack of acknowledgement to Zdharma (which was added by the time I looked) and the installation method (which I don't use and, I believe, is more lazy/incompetent than malicious)

How far would you say ZI is, in terms of features, from zdharma-continuum/zinit ? I guess I could try to swap them but is there any sure reason to fear ZI? I ask this because I know the owner of ZI about as much as the owner of this new zinit and, from what I've seen of the code, the only think I definitely don't agree with is the installation script.

olets commented 1 month ago

Good to hear. I haven't dug into what sbin'**/eza -> ls' but the effect must be really replace ls with eza. I would expect that to break other things, not just zsh-abbr. I don't think it's a zsh-abbr bug. But glad you reported.

My impression is a lot of people do alias or otherwise replace ls (I did briefly too), but I see eza docs don't say to do it, and their screenshots use eza not ls (same for exa).

//

The simple fact that z-shell took all of psprint's work and repackaged it as if it were their own doesn't feel good to some people. (zdharma-continuum, on the other hand, is like if psprint had transferred his repos to a GitHub org, instead of deleting them all.) // This year's xz utils security incident highlighted the possibility of long-game sleeper black hats, and may play into some of the stronger "I'm certain z-shell is sketchy" comments; the installation method may encourage that read for some people. // z-shell people haven't been involved in r/zsh, which is a if not the big zsh online community (I don't know how it compares in popularity to the official email newsgroup). I could be misremembering (and mean no slander if I'm remembering wrong) but I think a/the z-shell person was the creator and mod of r/zplugin; if so that makes their not engaging with r/zsh, and the account's deletion, striking.

I don't know what features, if any, zi has added on top of its zinit starting point.

It's a good question to be asking. You don't know z-shell, or zdharma-continuum, or me, but we choose to trust OS devs and to install things that don't go through e.g. Apple App Store security checks. One thing that might help you make a decision is to look into the accounts involved — https://github.com/orgs/z-shell/people and https://github.com/orgs/zdharma-continuum/people. But whatever conclusion you draw will be subjective.

arielsalvo commented 1 month ago

Thank you for taking the time to respond. I think you make a strong case and, even if ZI is just scary and not malicious, it is nonetheless scary (and may become malicious without much effort). I started trying out the switch after my previous response and it took me about an hour with minimal changes. After reading this, I decided to drop ZI and keep the new code. Again, thank you very much.