cantino/mcfly

Linux Kernel 6.2 issue

dedguy21 opened this issue ยท 30 comments

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.

Thanks @dedguy21. Maybe related to #212?

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

Tealk commented

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

comio commented

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

Thanks @dedguy21. Maybe related to #212?

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

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

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?

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

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.

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.

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.

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

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.

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

I can confirm using kauruus kernel module does help (#333 (comment)).
And in dvorka/hstr#478 (comment) 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

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

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

my 2EurCents.

ciao

luigi

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

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?

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

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

Works like a charm. Thanks ๐Ÿ™

@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

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

@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

Then write

legacy_tiocsti=1 in the file

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

@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?