leo-arch / clifm

The shell-like, command line terminal file manager: simple, fast, extensible, and lightweight as hell.
https://github.com/leo-arch/clifm/wiki
GNU General Public License v2.0
1.35k stars 39 forks source link

crashes some shells #176

Closed Justaus3r closed 1 year ago

Justaus3r commented 1 year ago

Describe the bug Clifm is breaking some shells like nushell and powershell. both shells elict some kind of IO error. other shells like sh,bash,zsh,xonsh work like expected. stacktrace: powershell:

^[[11;1RProcess terminated. Input/output error
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
   at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
System.IO.IOException: Input/output error
   at System.ConsolePal.TryGetCursorPosition(Int32& left, Int32& top, Boolean reinitializeForRead)
   at System.ConsolePal.GetCursorPosition()
   at System.Console.get_CursorLeft()
   at Microsoft.PowerShell.ConsoleHostRawUserInterface.get_CursorPosition()
   at Microsoft.PowerShell.ConsoleHost.InputLoop.Run(Boolean inputLoopIsNested)
   at Microsoft.PowerShell.ConsoleHost.InputLoop.RunNewInputLoop(ConsoleHost parent, Boolean isNested)
   at Microsoft.PowerShell.ConsoleHost.EnterNestedPrompt()
   at Microsoft.PowerShell.ConsoleHost.DoRunspaceLoop(String initialCommand, Boolean skipProfiles, Collection`1 initialCommandArgs, Boolean staMode, String configurationName)
   at Microsoft.PowerShell.ConsoleHost.Run(CommandLineParameterParser cpp, Boolean isPrestartWarned)
   at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
Warning: Program '/usr/bin/pwsh' crashed.

nushell just gives an io error indefinitely:

Error: Os { code: 5, kind: Uncategorized, message: "Input/output error" }
Error: Os { code: 5, kind: Uncategorized, message: "Input/output error" }
Error: Os { code: 5, kind: Uncategorized, message: "Input/output error" }
...
...
...

To Reproduce Steps to reproduce the behavior:

  1. Run clifm
  2. exit from clifm Expected behavior It shouldn't crash any of the above listed shells Desktop (please complete the following information):
    • OS: Archcraft, 5.18.3-arch1-1
    • Terminal: Konsole, xfce terminal
    • CliFM version : clifm 1.8-Otis
    • Installation source: AUR

Additional context Maybe some of resource like control to stdin is not given properly, other than that i don't know.

leo-arch commented 1 year ago

Hi @Justaus3r. Thanks for reporting! I'll take a look at it.

leo-arch commented 1 year ago

Quick test

Tested clifm 1.8 on both nushell and powershell.

  1. No crash nor any error on nushell (fresh/default config)
  2. Powershell actually crashed (no IO error though), but what's crashing is powershell itself. I see no error at all belonging to clifm. Indeed, here's the output of valgrind (running clifm on powershell):
==30204== HEAP SUMMARY:
==30204==     in use at exit: 278,227 bytes in 244 blocks
==30204==   total heap usage: 19,570 allocs, 19,326 frees, 10,802,680 bytes allocated
==30204== 
==30204== LEAK SUMMARY:
==30204==    definitely lost: 0 bytes in 0 blocks
==30204==    indirectly lost: 0 bytes in 0 blocks
==30204==      possibly lost: 0 bytes in 0 blocks
==30204==    still reachable: 278,227 bytes in 244 blocks
==30204==         suppressed: 0 bytes in 0 blocks
==30204== Reachable blocks (those to which a pointer was found) are not shown.
==30204== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==30204== 
==30204== For lists of detected and suppressed errors, rerun with: -s
==30204== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

[2]+  Stopped                 pwsh

Though I cannot reproduce the crash on nushell, maybe the fault is on the side of nushell itself. Again, I can detect no error caused by clifm (and maybe the fact that other shells behave as expected supports this point).

This is not intended to be conclusive, of course, but just the first diagnostic.

leo-arch commented 1 year ago

Correction:

In my tests, powershell does not crash: it it just sent to the background as soon as clifm exits.

Justaus3r commented 1 year ago

Now after updating nu from previous verison 0.66.1 to 0.72.0 , the bug seems to have been fixed by nu devs. the only problematic shell now is powershell, which sadly is my default one. ig i will report the issue on their bugtracker. maybe the issue is already fixed on latest release, which i am not on. thanks for your time..

leo-arch commented 1 year ago

Closing. Please let me know if you get any answer.