Open davidhaley opened 2 years ago
Under Haiku we get that same behavior. Upon hitting ENTER after selecting an entry from the history, it gets printed on the console.
Currently using bash version 5.1.16, and hstr 2.5.0 (but it happened too with the original Haiku port of hstr, that was was at version 2.0).
@davidhaley: can you share more info regarding your OS, terminal app, and bash version? Maybe by comparing info, we can start to narrow the search of where the problem might lie.
For the record. The issue on the Haiku port was that it needs to use the same bash function as the CYGWIN port (as Haiku also lacks TIOCSTI):
https://github.com/dvorka/hstr/blob/be59f8cf5a48af43a66963c8220b888563aeea0c/src/hstr.c#L193
And that wasn't reflected on the install/config instructions.
Defining that hstr_cygwin()
(I guess it could be called hstr_no_tiocsti()
now) bash function and binding it to CTRL+R now works like a charm!
Time to fix/update the Haiku package :-)
I'm on Archlinux and I am also having this problem. Maybe related also to , https://github.com/dvorka/hstr/issues/346 ?
I do remember it was working fine some weeks ? month? ago.
But now, whatever I choose after running "hstr", it always "echoes it", and puts it before the prompt .
It doesnt give me any chance to either,
$ hstr --version
hstr version "3.1.0" (2023-04-18T08:50:00)
Running it says,
RET/TAB select,
the man page itself is not very consistent with this information,
TAB, RIGHT arrow
Choose currently selected item for completion and let user to
edit it on the command prompt.
ENTER Choose currently selected item for completion and execute it.
I'v also tried it in different terminals and with zero configurations or customizations on bashrc.
sudo useradd - test_user su -l test_user
Same problem. Wether I choose "RETURN", "TAB" or "RIGHT", i never get that line of history in the prompt. It always gets printed before the prompt.
Other functionalities like, favourites, deleting etc seems to be working
Same problem as above on Manjaro
hstr version "3.1.0" (2023-04-18T08:50:00)
Must be some kernel thing as It was working for me fine on Debian Sid until I did a kernel upgrade to 6.3.0-1-amd64 and now it echo's but if you type echo !! you notice it doesn't show an echo command.
hstr version "3.1.0" (2023-04-18T08:50:00) as the others
EDIT: Just noticed this has been mentioned in a bigger issue https://github.com/dvorka/hstr/issues/478 and solution seems to be to run command sysctl -w dev.tty.legacy_tiocsti=1
@s-mahm solution of running sysctl -w dev.tty.legacy_tiocsti=1
worked for me. Thank you!
To ensure that this persists across system restarts on distros using recent systemd versions, create new conf file:
sudo sh -c "echo 'dev.tty.legacy_tiocsti=1' > /etc/sysctl.d/9999-legacy-tiocsti.conf"
sysctl -w dev.tty.legacy_tiocsti=1
There is a reason they disabled that. It's a security issue.
https://cateee.net/lkddb/web-lkddb/LEGACY_TIOCSTI.html
So, anybody who wants to disable it, just be aware that there are things in the wild which use that for privilege escalation.
I guess I can live with it just printing instead of allowing me to edit, but that only works on the newest versions of hstr. If you are using an older version that is packaged in Ubuntu or Debian's current stable repositories, you don't even get that. You just get a return to the shell with nothing printed at all.
I also get tis on arch, and the @s-mahm solution corrects it.
@davidhaley Can you close this issue if it was resolved?
@davidhaley Can you close this issue if it was resolved?
Sorry, I haven't had this installed now for quite some time.
It was working on linux mint 21.3 (ubuntu 22.04) but upgrading to LM22 (24.04) causes this problem.
Summarising earlier posts from @leapfog and @vparitskiy (and making them even more clear for people like me, i.e. not very expert in the linux environment!), this is what I did:
sudo sysctl -w dev.tty.legacy_tiocsti=1
and then
sudo sh -c "echo 'dev.tty.legacy_tiocsti=1' > /etc/sysctl.d/9999-legacy-tiocsti.conf"
worked for me too. Maybe the cause was the kernel change associated with my OS upgrade? Current kernel is 6.8.0-40-generic
[edited to reference the earlier posts so that the brain power is correctly ascribed]
It was working on linux mint 21.3 (ubuntu 22.04) but upgrading to LM22 (24.04) causes this problem.
sudo sysctl -w dev.tty.legacy_tiocsti=1
and thensudo sh -c "echo 'dev.tty.legacy_tiocsti=1' > /etc/sysctl.d/9999-legacy-tiocsti.conf"
worked for me too. Maybe the cause was the kernel change associated with my OS upgrade? Current kernel is 6.8.0-40-generic
Thank you a lot, that worked for me on Ubuntu 22.04
@davidhaley Can you close this issue if it was resolved?
I don't think the issue was resolved if the solution is turning off a protection against privilege escalation. @dvorka is there any status update on this issue? I really love this program but I don't feel comfortable with the current solution being proposed here and it's been open for over two years. If it makes any difference I'm not on a Debian or Arched based distro, I'm on Fedora so this seems to affect all three of the big linux base distros.
I'm not sure what could be causing this.
For example:
echo testing
Then, I press
ctrl+r
, search fortesting
, and pressenter
on the command that we just ran and it echoes:Or, if I use the alias
hh
, find the previous command and run it:My config in
.bashrc
is:hstr version "2.5.0" (2021-12-13T22:00:00)