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
hstr stops working on linux >=6.2.0 (depending on kernel config) #478
Comments
Edit: Never mind, probably only switchable with CONFIG_LEGACY_TIOCSTI=y.
It can't be set though.
Arch Linux 6.2.1 |
I came here as well cause hstr stopped working. Cheers |
❯ uname -r ❯ date Hstr is confirmed NOT working on the above kernel as of the time above. |
If you run |
I can confirm that it's the CONFIG_LEGACY_TIOCSTI option. I had the same problem after I updated my Gentoo to 6.2, and after reenabling that option in my Kernel, it started to work again with 6.2. |
Seems |
fzf has a bash function around it for the history function, that sets the readline input buffer with the history line that was selected in fzf. The same can be done with hstr! What I did:
Now if I open a new terminal, press Ctrl+R, hstr works again and the selected history line is placed on the readline input. I don't fully understand all of the above — and it can probably be cleaned up and made nicer — but at least I have a working hstr again. |
CopyQ is another candidate that still works. I'm not sure but i think they load the clipboard and send a keystroke via X11 to paste the text. |
Thanks @jakedane for the workaround. It works! |
I am on debian sid and stopped working too with
Compiled with the patch, it still not work. I just get the command in the terminal after the selection compared to before. |
That sounds like you did step 1 from #478 (comment) but didn't proceed with step 2 and 3 to modify your .bashrc file (and open a new terminal after). |
So I tried that bash changes and in this way works only Ctrl+r not
|
While I still hope for
I only confirmed that with |
I can confirm that with |
I can confirm too on Debian sid (siduction) with 6.2.6-1 the hstr package from debian repository works again. |
Re-enabling |
@Mte90 @chrischmo @karlovskiy @leapfog @jakedane @papavlos @mmeier86 thank you all for detailed descriptions of the problem, root cause identification and proposed solutions! I worked on a version of The PR just enables existing Anyway if the PR will work for you, I will fix it also for Do you think that it would make sense to release Thank you all your interest in |
@dvorka I built hstr with #481 and with LINUX_KERNEL_6 defined, I put the new config in my .bashrc and with that Ctrl+R works properly in Bash. Thank you! I'm on Arch Linux with kernel 6.2.6. No issue compiling. I don't know how to safely detect TIOCSTI is available. Probably too hacky and not portable but on Linux if |
Preliminary
Detect TIOCSTI from C:
|
The C code detects TIOCSTI correctly. I tested it both with The bash code does not detect it correctly. Edit: ah, removing the redirect to /dev/null I get |
@jakedane thank you for testing the code! It really helped. As |
…, updating year to 2023, removing WIP defines for TIOCSTI debugging #478
FYI working on the fix @ |
The fix only seems to work to some extent. After entering the hstr_notiocsti() function in my .bashrc, the history can be opened via CTRL+R but the selected command now appears in the console and is not executed until ENTER is pressed. This corresponds more to the function of the right cursor key (->) - to display the command and to be able to change it if necessary. |
Imo the fix is not working as expected. I'm running Arch Linux with hstr version "3.1.0" (2023-04-18T08:50:00) and Linux Kernel 6.2.12-arch1-1. My understanding was that hstr should work /w and w/o TIOCSTI. |
Yes can confirm on fedora, ENTER writes to console but not executes. But I can live with that for now, close enough 😂 Thanks for the fix @dvorka |
My error I think. Where I wrote for the earlier patch "with that Ctrl+R works properly in Bash" I meant it works the same as my workaround, which has this behavior (which I actually prefer), and should have clarified with the patch Enter puts the command on the console and Enter is needed again to execute it. Sorry @dvorka if I put you on wrong footing here! |
Is the version Enabling TIOCSTI with Thank you for the great work btw. |
Hello, My understanding is that latest hstr release should work w/o TIOCSTI, therefore I don't understand why this issue is closed. |
Same issue on Fedora 38 (running on kernel |
Should there be a separate bug for this "selecting command does not execute directly" issue? I ask because this bug is closed. |
Same here, it was fixed for a while and then it broke again. kernel 6.3.9 |
Void Linux, kernel 6.3.10, |
Confirming on Debian Sid kernel 6.3.0-1-amd64 has the same issue. |
This needs to be reopened. |
Several comments above saying hstr doesn't work. It's not clear what "doesn't work" means. Does it mean hstr doesn't work at all without setting I'm on Arch Linux with kernel 6.4.4 and hstr works for me in Bash. Enter needs to be pressed twice to run a command from history which is different from with setting |
The same behavior as before the fix was applied
bash
No, that's not it |
@Gooberpatrol66 which distro are you on? Which terminal are you using? Which hstr version and how does your configuration in # HSTR configuration - add this to ~/.bashrc
alias hh=hstr # hh to be alias for hstr
export HSTR_CONFIG=hicolor # get more colors
shopt -s histappend # append new history items to .bash_history
export HISTCONTROL=ignorespace # leading space hides commands from history
export HISTFILESIZE=10000 # increase history file size (default is 500)
export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
# ensure synchronization between bash memory and history file
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
function hstrnotiocsti {
{ READLINE_LINE="$( { </dev/tty hstr ${READLINE_LINE}; } 2>&1 1>&3 3>&- )"; } 3>&1;
READLINE_POINT=${#READLINE_LINE}
}
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "hstrnotiocsti"'; fi
export HSTR_TIOCSTI=n I'm using hstr 3.1, bash 5.1.016 and Linux 6.4.4 on Arch Linux. That works. I tried with Gnome Terminal, Console and Black Box. My I also tried hstr 3.0 on Fedora 38 and after manually fixing |
oh, i didn't see the bashrc changed |
I forgot I was still using the sysctl "fix", so I removed it and now hstr doesn't work for me. I'm using hstr 3.1.0 on arch linux, kernel 6.5.5, and my bashrc has the same lines as in jakedane's comment above. I can search history but pressing enter doesn't select the entry, it only echo'es it. |
You have to press Enter twice. 1st Enter puts the selected history item on the bash prompt, 2nd Enter runs it. If any expect hstr to work differently (that 1st Enter runs the command directly), I think that needs to be a separate issue. |
@eleius another suggestion is to select your command, use TAB to bring it to your prompt, and then press enter; removing the need to hit Enter twice. |
@jakedane @jasonnab I've already tried Tab+Enter and Enter+Enter, but for some reason when I press either Tab or Enter, the selected history item is just displayed as when you type the echo command (hstr doesn't bring it to the bash prompt.) |
@eleius, don't be upset. I have hstr behaving exactly the same way on Void Linux 6.3.13. |
any update for this issue? |
@Mte90 hstr 3.1.0 fixed the issue. Currently with bash 5.2.21 in gnome-terminal 3.50.1 (vte 0.74.1) on Arch Linux, kernel 6.6.3, with the output of If it doesn't work for you, what specifically are you using? |
I didn't saw the new parameter for bash |
Just wanted to leave a note, that hstr stops working with linux kernel 6.2.0, when CONFIG_LEGACY_TIOCSTI isn't set. So maybe you want to add that information to a trouble shooting guide or FAQ or something.
(re: "stops working": the history can still be browsed, but cannot be inserted anymore)
The text was updated successfully, but these errors were encountered: