cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.75k stars 176 forks source link

Linux Kernel 6.2 issue #333

Closed dedguy21 closed 4 weeks ago

dedguy21 commented 1 year ago

OS: Arch Linux Kernel: 6.2 Shell: Bash, Zsh, & Nushell Terminal: Kitty & Wezterm Mcfly ver: 0.7.1

I was updated to kernel 6.2 the other day, I noticed when using mcfly, though I could ctrl-r and make a selection, that selection wasn't carried through back to the terminal, so it wouldn't execute. Also, selection would not be carried over to be modified either. I checked the issue across three shells, and two different terminal to be sure.

Rolling back to kernel 6.1 fixed the issue for me. This is more of an FYI in case more people update to kernel 6.2

I haven't traced root issues beyond rolling back.

cantino commented 1 year ago

Thanks @dedguy21. Maybe related to https://github.com/cantino/mcfly/issues/212?

dedguy21 commented 1 year ago

More than likely, I'll test and get back to you. Thanks.

Tealk commented 1 year ago

I have the same behavior, where can I set this "CONFIG_LEGACY_TIOCSTI"?

comio commented 1 year ago

I have the same behavior, where can I set this "CONFIG_LEGACY_TIOCSTI"?

In your kernel .config file. You need to compile from sources.

comio commented 1 year ago

Thanks @dedguy21. Maybe related to #212?

Yes. This bug can be marked as duplicate of #212

dedguy21 commented 1 year ago

Should I close the issue since it is a repeat of #212?

kjozsa commented 1 year ago

I had hit the same issue, also on arch, with kernel 6.2.1-arch1-1. Is this something what should get fixed in mcfly then or in the kernel?

somepaulo commented 1 year ago

Just updated to 6.2.2-arch1-1, issue persists.

dedguy21 commented 1 year ago

FYI: An arch maintainer advised me that they are definitely not going to make CONFIG_LEGACY_TIOCSTI available going forward as it poses a potential security risk.

kauruus commented 1 year ago

There is a bug in the kernel that prevents me to set dev.tty.legacy_tiocsti, so I make a simple kernel module to re-enable TIOCSTI.

dedguy21 commented 1 year ago

If this works on zsh as long as zsh is the login, then I'll make the switch.

Thanks. I'll close this dup issue.

cantino commented 1 year ago

It might be worth leaving this open for other people to find.

kjozsa commented 1 year ago

I don't even see how this issue will get resolved. Will bash work around the new kernel limitation? Will mcfly adapt and change the way bash is being used? Will the kernel come up with something which allows again things to work as intented?

Meanwhile, I made the switch to fish, to be able to use the latest kernel while keeping mcfly - so far I'm grateful for getting pushed into this direction.

a-dekker commented 1 year ago

https://github.com/dvorka/hstr/ is also affected by this, see https://github.com/dvorka/hstr/issues/478. https://github.com/junegunn/fzf is not affected.

I can confirm using kauruus kernel module does help (https://github.com/cantino/mcfly/issues/333#issuecomment-1455039317). And in https://github.com/dvorka/hstr/issues/478#issuecomment-1454727507 an attempt is made to fix hstr in a "fzf way".

But so far I did not see McFly having this issue addressed, so in the mean time we need workarounds like the kernel module or alternative tools/shells.

comio commented 1 year ago

I suggest this workaround modifying the bind script:

McFly should support a special option to pass and store the search result.

my 2EurCents.

ciao

luigi

a-dekker commented 1 year ago

The bug that the parameter CONFIG_LEGACY_TIOCSTI cannot be set has been fixed in recent 6.2 kernel releases https://github.com/dvorka/hstr/issues/478#issuecomment-1467633404

dedguy21 commented 1 year ago

The bug that the parameter CONFIG_LEGACY_TIOCSTI cannot be set has been fixed in recent 6.2 kernel releases dvorka/hstr#478 (comment)

I ran the "# sysctl -w dev.tty.legacy_tiocsti=1 " and it works, but rookie question, where do we put the command so we don't have to run it manually every start up?

Not /etc/environment, and the local .bash_profile doesn't have permisson either. What is a good way to automate the process without getting permission failures?

darthShadow commented 1 year ago

Any sysctl parameters generally go in a custom file in /etc/sysctl.d

dedguy21 commented 1 year ago

Any sysctl parameters generally go in a custom file in /etc/sysctl.d

Works like a charm. Thanks 🙏

jkseppan commented 1 year ago

@comio wrote:

I suggest this workaround modifying the bind script:

  • Create a temp file
  • Pass the filename to mcfly executable via a proper option
  • Store the search result to the provided temporary file;
  • source the file and update READLINE_LINE variable accordantly
  • Remove the temporary file

Here's a patch that implements something like this, but only for replacing the edit buffer. What I couldn't get to work was running the command properly. You could insert it into history with history -s, echo the prompt and command to make it look like you ran it, and write it into a file and source the file, but even then any error status returned by the command does not get conveyed to the shell. I guess this is because it gets called through a readline binding, so it looks to the shell like an editing operation instead of executing a command.

There are various hacks in the answers to this Unix & Linux Stackexchange question that might be adapted. Personally I'm fine with pressing Enter another time after choosing the command.

mcfly.bash.patch

RHOOPH commented 1 year ago

@dedguy21 @darthShadow Can you please explain the steps to put custom file in etc/sysctl.d and have it run on boot.

dedguy21 commented 1 year ago

@RHOOPH

You should have a directory: /etc/sysctl.d/

In that directory is where you save your file.

Example:

vim 10_legacy_tiocsti.conf

Then write

legacy_tiocsti=1 in the file

Save to /etc/sysctl.d/10_legacy_tiocsti.conf

somepaulo commented 1 year ago

Then write

legacy_tiocsti=1 in the file

This should read dev.tty.legacy_tiocsti=1 actually.

benyaminl commented 1 year ago

@somepaulo for somereason, /etc/sysctl.d seems doesn't work on new kernel 6.3.x, are they dropping it? Manual set using

sudo sysctl -w dev.tty.legacy_tiocsti=1

Still work, but not the boot .conf file.

any idea why ? Or it's specific to fedora only?

Dlinuigh commented 3 months ago

@somepaulo for somereason, /etc/sysctl.d seems doesn't work on new kernel 6.3.x, are they dropping it? Manual set using

sudo sysctl -w dev.tty.legacy_tiocsti=1

Still work, but not the boot .conf file.

any idea why ? Or it's specific to fedora only?

Work on arch, with kernel 6.8.1.

cantino commented 2 months ago

I'm open to PRs that fix this if anyone sees a path forward.

cantino commented 1 month ago

It'd be great if bash users could test https://github.com/cantino/mcfly/pull/416

digikata commented 1 month ago

building and using #416 works for me on a linux 6.8 kernel that was broken w/ bash on the stable release.

cantino commented 1 month ago

Should hopefully be fixed by https://github.com/cantino/mcfly/pull/416 and https://github.com/cantino/mcfly/releases/tag/v0.9.0.

cantino commented 4 weeks ago

I believe this is fixed! Please re-open if not.