atuinsh / atuin

✨ Magical shell history
https://atuin.sh
MIT License
18.54k stars 519 forks source link

[Bug]: Deleted commands don't stay deleted #2178

Open jbellis opened 1 week ago

jbellis commented 1 week ago

What did you expect to happen?

After deleting commands from history, they should stay gone next time I hit ctrl-r

What happened?

ctrl-r exec:java [5 results] ctrl-o ctrl-d, for 4 results [only 1 result now visible] esc

ctrl-r exec:java [5 results]

Atuin doctor output

$ atuin doctor
Atuin Doctor
Checking for diagnostics

Please include the output below with any bug reports or issues

{
  "atuin": {
    "version": "18.3.0",
    "sync": {
      "cloud": true,
      "records": true,
      "auto_sync": true,
      "last_sync": "2024-06-21 20:21:56.851349026 +00:00:00"
    },
    "sqlite_version": "3.44.0"
  },
  "shell": {
    "name": "bash",
    "default": "bash",
    "plugins": [
      "atuin",
      "bash-preexec"
    ],
    "preexec": null
  },
  "system": {
    "os": "Ubuntu",
    "arch": "x86_64",
    "version": "20.04",
    "disks": [
      {
        "name": "/dev/nvme0n1p3",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/nvme0n1p1",
        "filesystem": "vfat"
      },
      {
        "name": "/dev/sda1",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/sdb2",
        "filesystem": "ext4"
      }
    ]
  }
}


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
jbellis commented 1 week ago

I saw the same behavior on two different machines, fwiw. One was 18.2.0 until I upgraded it. (Behavior did not change.)

ellie commented 1 week ago

Couple of questions;

  1. Did you definitely delete all instances of that command? I assume so by what you wrote, but just to double check
  2. Does it get resolved if you run atuin store rebuild history?
jbellis commented 3 days ago
  1. Yes
  2. rebuild history does not help, either immediately or after re-attempting the deletes
lespea commented 3 days ago

I think it's the esc that's tripping it up... if you delete command(s) and then choose a history item to use it then seems to delete okay. At least in my testing.

ellie commented 3 days ago

I'm still struggling to replicate this, having tried a few different ways. Is there minimally reproducible example either of you could give?

Eg run a few specific commands, delete, then they're still there?

jbellis commented 3 days ago

I think I figured it out. ctrl-r interface deduplicates the command history, but ctrl-o ctrl-d only deletes one of the instances. (the most recent?) atuin history list shows instances of the command disappearing after deletion, and after all the instances are deleted then it stops showing up in ctrl-r.

So the confusion was that I thought that ctrl-o ctrl-d should delete all the instances and there was no feedback telling me that it was deleting instances of the command but only one.

jbellis commented 3 days ago

Suggested fix:

Alternatively, let ctrl-o ctrl-d delete all the instances. (Arguably more intuitive.)