atuinsh/atuin

[Bug]: `atuin dotfiles alias import` imports control codes as well

USA-RedDragon opened this issue · 3 comments

What did you expect to happen?

I accidentally ran atuin dotfiles alias import in Termux. I expected it to not import invalid aliases.

What happened?

Running atuin dotfiles alias import imported the neofetch lines, including the control codes used to format it. Now, atuin dotfiles alias list looks like
image

I am able to delete some of them that don't have control characters, i.e. atuin dotfiles alias delete ' .. yyyyyyyyyyyyyyyyyyyy ..', but the ones that do remain have control codes that make it quite difficult to remove and breaks the aliases on my other system (eval "$(atuin init zsh)" errors with (eval):120: bad pattern: ^[[18A^[[9999999D^[[35C^[[0m^[[1m^[[32m^[[1mu0_a381^[[0m@^[[32m^[[1mlocalhost^[[0m). I'm looking for a way to recover this.

Atuin doctor output

atuin:
  version: 18.2.0
  sync:
    cloud: false
    records: true
    auto_sync: true
    last_sync: 2024-05-02 14:11:27.734397214 +00:00:00
shell:
  name: zsh
  default: unknown
  plugins:
  - atuin
system:
  os: Arch Linux
  arch: x86_64
  version: rolling
  disks:
  - name: /dev/mapper/vg-root
    filesystem: btrfs
  - name: /dev/mapper/vg-root
    filesystem: btrfs
  - name: /dev/mapper/vg-root
    filesystem: btrfs
  - name: /dev/nvme1n1p1
    filesystem: vfat
  - name: /dev/nvme2n1
    filesystem: f2fs

Code of Conduct

  • I agree to follow this project's Code of Conduct

After clearing the aliases I could, I'm left with
image

$ atuin dotfiles aliu0_a381@localhost =
                                   CPU: (8) @ 1.900GHz =
                                   Host: samsung SM-F946B =
                                   Kernel: 5.15.94-android13-8-27940245-abF946BXXS1BWL7 =
                                   Memory: 8085MiB / 11129MiB =
                                   OS: Android 14 aarch64 =
                                   Packages: 118 (dpkg), 1 (pkg) =
                                   Shell: zsh 5.9 =
                                   Terminal: atuin =
                                   Uptime: 1 day, 2 hours, 3 mins =
                                   ----------------- =
=
         -o          o-=
          oNMm-  -mMNs=
      `/++MMMMh++hMMMM++/`=
      `dMMm:NMMMMMMN:mMMd`=
genpass=bash -c 'LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 64; echo'
k=kubectl
ka='kubectl apply -f'
kc='kubectl create'
kcc=kubectx
kcn=kubens
kd='kubectl describe'
ke='kubectl exec -it'
kg='kubectl get'
kgp='kubectl get pods'
kgs='kubectl get service'
kl='kubectl logs'
klf='kubectl logs -f'
krr='kubectl rollout restart'
tf=terraform

Notably, trying atuin dotfiles alias delete with some of these doesn't work, i.e.

atuin dotfiles alias delete -- '      `dMMm:NMMMMMMN:mMMd`'

returns

Cannot delete '      `dMMm:NMMMMMMN:mMMd`': Alias not set.
ellie commented

Ah, that's not great. I've disabled alias import for now, as there's a whole bunch of edge cases it seems (people printing stuff in .zshrc)

If you run the latest main, I've added atuin dotfiles alias clear, which will delete all of your aliases. You can then manually add any you're interested in!

See #1995

ellie commented

Closing, I might rework alias import in the future but likely not soon