mcfly icon indicating copy to clipboard operation
mcfly copied to clipboard

Linux Kernel 6.2 issue

Open dedguy21 opened this issue 2 years ago • 26 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.

dedguy21 avatar Feb 27 '23 15:02 dedguy21

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

cantino avatar Feb 28 '23 02:02 cantino

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

dedguy21 avatar Feb 28 '23 04:02 dedguy21

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

Tealk avatar Feb 28 '23 17:02 Tealk

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 avatar Mar 01 '23 07:03 comio

Thanks @dedguy21. Maybe related to #212?

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

comio avatar Mar 01 '23 08:03 comio

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

dedguy21 avatar Mar 01 '23 08:03 dedguy21

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?

kjozsa avatar Mar 01 '23 15:03 kjozsa

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

somepaulo avatar Mar 04 '23 15:03 somepaulo

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.

dedguy21 avatar Mar 05 '23 03:03 dedguy21

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.

kauruus avatar Mar 05 '23 09:03 kauruus

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.

dedguy21 avatar Mar 05 '23 23:03 dedguy21

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

cantino avatar Mar 06 '23 03:03 cantino

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.

kjozsa avatar Mar 06 '23 13:03 kjozsa

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.

a-dekker avatar Mar 12 '23 11:03 a-dekker

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

comio avatar Mar 12 '23 13:03 comio

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

a-dekker avatar Mar 15 '23 07:03 a-dekker

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?

dedguy21 avatar Mar 16 '23 10:03 dedguy21

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

darthShadow avatar Mar 16 '23 10:03 darthShadow

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

Works like a charm. Thanks 🙏

dedguy21 avatar Mar 16 '23 12:03 dedguy21

@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

jkseppan avatar Apr 02 '23 18:04 jkseppan

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

RHOOPH avatar Apr 20 '23 14:04 RHOOPH

@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

dedguy21 avatar Apr 20 '23 14:04 dedguy21

Then write

legacy_tiocsti=1 in the file

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

somepaulo avatar May 17 '23 08:05 somepaulo

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

benyaminl avatar Jun 07 '23 02:06 benyaminl

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

Dlinuigh avatar Mar 17 '24 08:03 Dlinuigh

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

cantino avatar Apr 28 '24 23:04 cantino

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

cantino avatar May 26 '24 03:05 cantino

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

digikata avatar May 28 '24 20:05 digikata

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

cantino avatar Jun 01 '24 03:06 cantino

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

cantino avatar Jun 03 '24 04:06 cantino