chrisant996 / clink

Bash's powerful command line editing in cmd.exe
https://chrisant996.github.io/clink/
GNU General Public License v3.0
3.62k stars 143 forks source link

Clink is attached to anaconda prompt #560

Closed SnJaB closed 8 months ago

SnJaB commented 8 months ago

Clink was working fine, when I installed anaconda navigator and did some things clink stopped working.

and I uninstalled anaconda and clink and reinstalled clink,

Clink doesn't' open in command prompt. and when I run it from C:\Program Files (x86)\clink\0.4.9

and then run > clink info *** ERROR: Unknown verb -- 'info' Clink v0.4.9 [git:2fd2c2] Copyright (c) 2012-2016 Martin Ridgers http://mridgers.github.io/clink

and when I run > clink autorun show

Current AutoRun values

Current user:

native : if exist "C:\Users\pc\anaconda3\condabin\conda_hook.bat" "C:\Users\pc\anaconda3\condabin\conda_hook.bat"&"C:\Program Files (x86)\clink\0.4.9\clink.bat" inject --autorun --profile ~\clink
 wow64 : "C:\Program Files (x86)\clink\0.4.9\clink.bat" inject --autorun --profile ~\clink

All users:

native : <unset>
wow64 : <unset>

clink log 4332 do_inject 185 System: ver=6.2 0.0 arch=9 cpus=12 cpu_type=8664 page_size=4096 4332 do_inject 190 Version: 0.4.9 4332 do_inject 191 DLL: C:\Program Files (x86)\clink\0.4.9\clink_dll_x64.dll 4332 do_inject 193 Parent pid: 9220 4332 check_dll_version 52 DLL version: 00000004 0009b2fe 4332 do_inject_impl 283 Creating remote thread at 00007FFA192192C0 with parameter 000001C4DD4D0000 9220 set_rl_readline_name 58 Setting rl_readline_name to 'cmd.exe' 9220 hook_trap_veh 120 VEH hit - caller is 00007FF7833F4A11. 9220 hook_jmp 408 Attemping jump hook. 9220 hook_jmp 409 Target is kernelbase.dll, ReadConsoleW @ 00007FFA170B5A60 9220 hook_jmp_impl 351 Attempting to hook at 00007FFA170B5A60 with 00007FF9D60B63A0 9220 hook_jmp_impl 360 Unable to match instruction 245C8948 9220 hook_jmp 415 Jump hook failed.07FF9D60B62D4 failed. 9220 apply_hook_jmp 73 Unable to hook ReadConsoleW in kernelbase.dll 9220 hook_trap_veh 125 Hook trap 000

chrisant996 commented 8 months ago

You somehow have the ancient mridgers 0.4.9 version of Clink installed (it's from a different repo, which has been abandoned for many years).

You need to install the Clink from this repo.

You didn't say how you installed Clink, but I'm guessing you used Scoop and chose "Clink" instead of "clink-maintained". The owner of the "Clink" entry in Scoop refuses to update it to the current version. Complain to that person; there's nothing I can do to fix the Scoop confusion.

SnJaB commented 8 months ago

I apologize for confusing the versions, I uninstalled the old version and installed version (setup.exe) from this repo.

I still face the same problem, which is clink is not recognized in command prompt when opened normally.

C:\Program Files (x86)\clink>clink info version : 1.6.3.af47db session : 1800 injected : clink_dll_x64.dll binaries : C:\Program Files (x86)\clink state : C:\Users\pc\AppData\Local\clink log : C:\Users\pc\AppData\Local\clink\clink.log default settings : C:\Program Files (x86)\clink\default_settings settings : C:\Users\pc\AppData\Local\clink\clink_settings history : C:\Users\pc\AppData\Local\clink\clink_history scripts : C:\Program Files (x86)\clink ; C:\Users\pc\AppData\Local\clink default_inputrc : C:\Program Files (x86)\clink\default_inputrc inputrc : %clink_inputrc% (unset) : state directory C:\Users\pc\AppData\Local\clink.inputrc C:\Users\pc\AppData\Local\clink_inputrc : %userprofile% C:\Users\pc.inputrc C:\Users\pc_inputrc : %localappdata% C:\Users\pc\AppData\Local.inputrc C:\Users\pc\AppData\Local_inputrc : %appdata% C:\Users\pc\AppData\Roaming.inputrc C:\Users\pc\AppData\Roaming_inputrc : %home% C:\Users\pc.inputrc C:\Users\pc_inputrc codepage : 1252 keyboard langid : 1033 keyboard layout : 00000409

C:\Program Files (x86)\clink>clink autorun show

Current AutoRun values

Current user:

native : if exist "C:\Users\pc\anaconda3\condabin\conda_hook.bat" "C:\Users\pc\anaconda3\condabin\conda_hook.bat"&"C:\Program Files (x86)\clink\clink.bat" inject --autorun --profile ~\clink
 wow64 : "C:\Program Files (x86)\clink\clink.bat" inject --autorun --profile ~\clink

All users:

native : <unset>
 wow64 : <unset>

clink.log 0708 app_context::start_logger 476 ---- 2024/02/16 22:56:44.418 ------------------------------------------------- 0708 app_context::start_logger 479 Host process is 'cmd.exe' (pid 1800) 0708 app_context::start_logger 483 DLL path is 'C:\Program Files (x86)\clink' 0708 app_context::start_logger 498 Windows version 10.0.22631 (x64) 0708 app_context::start_logger 500 Clink version 1.6.3.af47db (x64) 0708 hook_setter::hook_setter 159 >>> Started hook transaction. 0708 hook_setter::attach_iat 316 Attempting to hook SetEnvironmentVariableW in IAT for module 00007FF6528B0000. 0708 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-processenvironment-l1-1-0.dll' 0708 find_iat 124 Found import at 00007FF6528E6E98 (value is 00007FFFAD89A4B0). 0708 hook_setter::attach_iat 316 Attempting to hook SetEnvironmentStringsW in IAT for module 00007FF6528B0000. 0708 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-processenvironment-l1-1-0.dll' 0708 find_iat 124 Found import at 00007FF6528E6EA8 (value is 00007FFFAD9798C0). 0708 hook_setter::attach_iat 316 Attempting to hook WriteConsoleW in IAT for module 00007FF6528B0000. 0708 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-console-l1-1-0.dll' 0708 find_iat 124 Found import at 00007FF6528E6AF0 (value is 00007FFFAD85CD50). 0708 hook_setter::attach_iat 316 Attempting to hook GetEnvironmentVariableW in IAT for module 00007FF6528B0000. 0708 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-processenvironment-l1-1-0.dll' 0708 find_iat 124 Found import at 00007FF6528E6E68 (value is 00007FFFAD845BE0). 0708 hook_setter::commit 207 <<< Hook transaction committed. 0708 hook_setter::hook_setter 159 >>> Started hook transaction. 0708 hook_setter::detach_iat 359 Attempting to unhook 00007FFF27A1D770 from GetEnvironmentVariableW in IAT for module 00007FF6528B0000. 0708 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-processenvironment-l1-1-0.dll' 0708 find_iat 124 Found import at 00007FF6528E6E68 (value is 00007FFF27A1D770). 0708 hook_setter::commit 207 <<< Hook transaction committed. 0708 hook_setter::hook_setter 159 >>> Started hook transaction. 0708 hook_setter::attach_iat 316 Attempting to hook ReadConsoleW in IAT for module 00007FF6528B0000. 0708 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-console-l1-1-0.dll' 0708 find_iat 124 Found import at 00007FF6528E6AE8 (value is 00007FFFAD8D5A60). 0708 hook_setter::commit 207 <<< Hook transaction committed. 0708 hook_setter::hook_setter 159 >>> Started hook transaction. 0708 hook_setter::attach_iat 316 Attempting to hook SetConsoleTitleW in IAT for module 00007FF6528B0000. 0708 pe_info::iterate_imports 195 Found import in 'api-ms-win-core-console-l2-2-0.dll' 0708 find_iat 124 Found import at 00007FF6528E6B48 (value is 00007FFFAD8D64F0). 0708 hook_setter::commit 207 <<< Hook transaction committed. 0708 win_screen_buffer::begin 366 Using native terminal support (auto mode found 'OpenConsoleProxy.dll'). 0708 reset_handle 144 resetting mismatched stdout handle 0708 reset_handle 144 resetting mismatched stderr handle 0708 host_lua::load_scripts 192 Loaded 0 Lua scripts in 0 ms 0708 ={update.lua} 0 Clink updater: updating because there is no record of having updated before. 0708 extract_ctag 924 read 0 bytes 0708 extract_ctag 924 read 0 bytes 0708 history_db::initialise 1262 master bank ctag: |CTAG_1708117004_352031_1800_0 0708 history_db::compact 1540 History: 0 active, 0 deleted 0708 ={update.lua} 0 Clink updater: latest release is v1.6.3; install type is zip. 0708 ={update.lua} 0 Clink updater: no update available; local version v1.6.3 is not older than latest release v1.6.3. 0708 reset_handle 144 resetting mismatched stdout handle 0708 reset_handle 144 resetting mismatched stderr handle 0708 history_db::compact 1540 History: 0 active, 0 deleted 0708 reset_handle 144 resetting mismatched stdout handle 0708 reset_handle 144 resetting mismatched stderr handle 0708 history_db::compact 1540 History: 0 active, 0 deleted 0708 reset_handle 144 resetting mismatched stdout handle 0708 reset_handle 144 resetting mismatched stderr handle 0708 history_db::compact 1540 History: 0 active, 0 deleted 0708 reset_handle 144 resetting mismatched stdout handle 0708 reset_handle 144 resetting mismatched stderr handle 0708 history_db::compact 1540 History: 0 active, 0 deleted 0708 reset_handle 144 resetting mismatched stdout handle 0708 reset_handle 144 resetting mismatched stderr handle 0708 history_db::compact 1540 History: 0 active, 0 deleted 0708 reset_handle 144 resetting mismatched stdout handle 0708 reset_handle 144 resetting mismatched stderr handle 0708 history_db::compact 1540 History: 0 active, 0 deleted 0708 reset_handle 144 resetting mismatched stdout handle 0708 reset_handle 144 resetting mismatched stderr handle 0708 history_db::compact 1540 History: 0 active, 0 deleted

chrisant996 commented 8 months ago

Oh, it's a duplicate of #357. It's a bug in anaconda's install code; see the other issue for more info and workaround.

You can open an issue against anaconda asking for the install code to get fixed to not interfere with other programs that also make use of the AutoRun regkey.