-
-
Notifications
You must be signed in to change notification settings - Fork 562
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
Some commands not showing up and inaccurate command duration #1003
Comments
Hmm. That's very weird. What shell do you use? |
bash 5.2, installed through Homebrew. The terminal is Kitty, but this also happens with Terminal.app (the preinstalled terminal emulator on macOS). |
I just confirmed that this happens to me even if:
|
This does NOT happen with ble.sh (https://github.com/akinomyoga/ble.sh) installed. With some trial and error, I identified:
, which are returned from |
I have a brand-new installation on Bash, and I am finding that lots of my commands do not end up in history. Very odd. I will run a command, hit up arrow to run it again - and it's not there. I have up arrow disabled for Atuin at present, too, but the command also doesn't show int he Atuin interface with Ctrl-R. There is no pattern to this and if I run it again the command will generally then show up. The problem is it leads to very unreliable behaviour and slows down shell interaction as you have to check what's about to be executed and not rely on your memory. |
I think I have found by usage an observation that the problem happens consistently when using Ctrl-R - the command chosen by that process never seems to be added afresh to the current history context, meaning that it's not available when you press Up Arrow. I'm not sure if it happens in other ways as well, but I will continue to observe. |
@danwilliams You haven't said, but I suspect that you are using v17.0.1 has #1342, which will ensure that the command you select using I've opened #1383 to make sure that those commands will be added to the bash history as well so that your up-arrow usage will also work. You can use both these fixes today by putting the code of |
@arcuru thanks for the super-fast and extremely helpful response 🙂 You're right, I should have mentioned the version. I simply did I am not sure if #1342 is working okay, because I'm meant to have that fix and yet it seems commands are not showing up in Atuin's history. I will keep an eye on that, as it's the up-arrow behaviour that is the most noticeable. I'm not sure if I've seen them missing from Atuin's history since applying Thank you for opening #1383 - I am already using I will keep an eye on the Atuin history issue to see if I can confirm that either way. Thanks again! |
Yup, unfortunately #1342 is not fully fixed, as some newly-typed commands are definitely not getting added to Atuin's history (they are in Bash history and I can access them through up-arrow). #1383 is indeed fixed though, and has not been a further problem - hitting enter on the Ctrl-R list does add to Bash history and up-arrow availability. |
I've noticed two types of command that don't show up in Atuin's log:
|
Interactive commands don't seem to get added - e.g. |
This fixes the second issue of 0s or wrong command duration reported at atuinsh#1003. The problem is that, with bash-preexec, the preexec hook may be called even for the commands executed by the keybindings. * In particular, the preexec is called before the command `__atuin_history` is executed on pressing [C-r] and [up]. In this case, $1 passed to __atuin_preexec contains the last entry in the command line, so `atuin history start` is called for the last command. As a result, pressing [C-r] and [up] clears the duration of the last command. This causes the reported 0s duration. * Furthermore, the precmd hook corresponding to the keybinding command will not be called, so the duration is only filled when the next user command starts. This replaces the duration of the last command with the time interval between the last press of [C-r] or [up] and the start time of the next command. This causes the reported wrong duration. There is no general and robust way to distinguish the preexec invocation for keybindings from that for the user commands, but in this patch we exclude the preexec invocation for Atuin's keybindings [C-r] and [up] at least.
This fixes the second issue of "0s or wrong command duration" reported at atuinsh#1003. The problem is that, with bash-preexec, the preexec hook may be called even for the commands executed by the keybindings. * In particular, the preexec is called before the command `__atuin_history` is executed on pressing [C-r] and [up]. In this case, $1 passed to __atuin_preexec contains the last entry in the command line, so `atuin history start` is called for the last command. As a result, pressing [C-r] and [up] clears the duration of the last command. This causes the reported 0s duration. * Furthermore, the precmd hook corresponding to the keybinding command will not be called, so the duration is only filled when the next user command starts. This replaces the duration of the last command with the time interval between the last press of [C-r] or [up] and the start time of the next command. This causes the reported wrong duration. There is no general and robust way to distinguish the preexec invocation for keybindings from that for the user commands, but in this patch we exclude the preexec invocation for Atuin's keybindings [C-r] and [up] at least.
This fixes the second issue of "0s or wrong command duration" reported at atuinsh#1003. The problem is that, with bash-preexec, the preexec hook may be called even for the commands executed by the keybindings. * In particular, the preexec is called before the command `__atuin_history` is executed on pressing [C-r] and [up]. In this case, $1 passed to `__atuin_preexec` contains the last entry in the command history, so `atuin history start` is called for the last command. As a result, pressing [C-r] and [up] clears the duration of the last command. This causes the reported 0s duration. * Furthermore, the precmd hook corresponding to the keybinding command will not be called, so the duration is only filled when the next user command starts. This replaces the duration of the last command with the time interval between the last press of [C-r] or [up] and the start time of the next command. This causes the reported wrong duration. There is no general and robust way to distinguish the preexec invocation for keybindings from that for the user commands, but in this patch we exclude the preexec invocation for Atuin's keybindings [C-r] and [up] at least.
) This fixes the second issue of "0s or wrong command duration" reported at #1003. The problem is that, with bash-preexec, the preexec hook may be called even for the commands executed by the keybindings. * In particular, the preexec is called before the command `__atuin_history` is executed on pressing [C-r] and [up]. In this case, $1 passed to `__atuin_preexec` contains the last entry in the command history, so `atuin history start` is called for the last command. As a result, pressing [C-r] and [up] clears the duration of the last command. This causes the reported 0s duration. * Furthermore, the precmd hook corresponding to the keybinding command will not be called, so the duration is only filled when the next user command starts. This replaces the duration of the last command with the time interval between the last press of [C-r] or [up] and the start time of the next command. This causes the reported wrong duration. There is no general and robust way to distinguish the preexec invocation for keybindings from that for the user commands, but in this patch we exclude the preexec invocation for Atuin's keybindings [C-r] and [up] at least.
In my experience, whenever I use Ctrl-R and then ESC (i.e. I don't select anything), whatever command I then type on the command line does not get added to the history. However, if I do Ctrl-R, ESC and then ENTER (i.e blank command) before I type a new command, it works. Also, when I use Ctrl-R and then TAB to edit the command, the edited command is also not added. I think it should be added? |
This issue has been mentioned on Atuin Community. There might be relevant details there: |
In GitHub atuinsh#1509, we blocked the unintended preexec caused by the keybinding of Atuin. However, with that fix, the preexec event for the intended user command is still missing. In this patch, we try to manually run the preexec hook when we detected the unintended preexec (which means the missing intended preexec). References: atuinsh#1509 https://forum.atuin.sh/t/atuin-bash-and-ble-sh/175 atuinsh#1003 (comment) atuinsh#1727 atuinsh#1728
In GitHub atuinsh#1509, we blocked the unintended preexec caused by the keybinding of Atuin. However, with that fix, the preexec event for the intended user command is still missing. In this patch, we try to manually run the preexec hook when we detected the unintended preexec (which means the missing intended preexec). References: atuinsh#1509 https://forum.atuin.sh/t/atuin-bash-and-ble-sh/175 atuinsh#1003 (comment) atuinsh#1727 atuinsh#1728
In GitHub atuinsh#1509, we blocked the unintended preexec event caused by the keybinding of Atuin. However, with that fix, the preexec event for the intended user command is still missing. In this patch, we try to manually run the preexec hook when we detected the unintended preexec (which means the missing intended preexec). References: atuinsh#1509 https://forum.atuin.sh/t/atuin-bash-and-ble-sh/175 atuinsh#1003 (comment) atuinsh#1727 atuinsh#1728
In GitHub #1509, we blocked the unintended preexec event caused by the keybinding of Atuin. However, with that fix, the preexec event for the intended user command is still missing. In this patch, we try to manually run the preexec hook when we detected the unintended preexec (which means the missing intended preexec). References: #1509 https://forum.atuin.sh/t/atuin-bash-and-ble-sh/175 #1003 (comment) #1727 #1728
In GitHub #1509, we blocked the unintended preexec event caused by the keybinding of Atuin. However, with that fix, the preexec event for the intended user command is still missing. In this patch, we try to manually run the preexec hook when we detected the unintended preexec (which means the missing intended preexec). References: #1509 https://forum.atuin.sh/t/atuin-bash-and-ble-sh/175 #1003 (comment) #1727 #1728
I am using freshly installed Atuin v14.0.1 through Homebrew on bash+macOS.
I have encounterd two weird issues that might or might not be related:
The text was updated successfully, but these errors were encountered: