Replies: 1 comment 2 replies
-
|
@daxgames Good catch! Apologizes for the late response, this is the commit in question: After a bit of investigation I think the lack of elaboration is a oversight on my part. The removed code in question has two roles, disabling clink on tcc/le hosts, and disabling Cmder aliases. Regarding the first role, I recall that due to Clink's own internal detection (code block at the end), I deemed that it would be unnecessary for Cmder to also do it using batch script. There is a related Clink issue about tcc/le here: chrisant996/clink#177 So I think it would be best to ask @chrisant996's opinion, do we need to detect and disable injecting Clink from the Cmder's batch script side, or, is it acceptable to run Clink in a tcc/le shell and expect no issues (including any produced warnings)? I'm fine with either way -- if we need to do it from the batch scripts, then I apologize for the removal without explanation and need to restore it as it is indeed a regression. Otherwise, it would be fine to execute Clink and expect it to handle the ComSpec host. Note Clink has explicit checks for "tcc.exe", but not "tccle.exe", which could possibly be an inconsistency. @daxgames The only other role is to disable Cmder aliases in TCC/LE hosts. Unfortunately I don't seem to recall the results of my experiments when I ran Cmder + TCC, I assume the were no problems at the time, and that is the reason for the guard removal. I need to install TCC and Cmder in a sandbox environment to do some tests to make sure about it. Here's the history and Copilot's recommendation, for archival sake (click to expand)Why
|
| Date | Commit | Author | Change |
|---|---|---|---|
| Sep 2, 2018 | 823e6fe |
Dax T. Games | Added tcc.exe/tccle detection + disable-Clink/aliases guards |
| Sep 9, 2022 | d1b1012 |
David Refoua | Replaced find.exe-based detection with %~n1 (fixes #2744 / Avecto blocking) |
| Nov 6, 2022 | e3d9f81 |
David Refoua | Removed the remaining tcc/tccle guards entirely (cleanup/refactor) |
chrisant996/clink handles TCC natively — Cmder does NOT need to add guards back
The current Clink (chrisant996's fork) has explicit, deliberate TCC/4NT awareness built into its C++ injection code in two places:
1. clink/app/src/loader/inject.cpp — Injection-time host check
// Check for supported host (keep in sync with initialise_clink in dll.cpp).
const bool is_tcc = !stricmp(host_name, "tcc.exe");
const bool is_4nt = !stricmp(host_name, "4nt.exe");
if (is_tcc || is_4nt)
{
// Take Command (and 4NT) from JPSoft are recognized during
// autorun as benignly invalid hosts. They may invoke the
// AutoRun regkey contents and try to inject Clink, which is
// just a side effect of their design. Since the scenario
// is well understood, it's reasonable to be silent about it
// during autorun.
if (is_autorun)
return {-1, nullptr}; // Silent rejection
LOG("Host '%s' is not supported; Clink is not compatible with the JPSoft command shells.", host_name);
return {}; // Hard rejection
}When Clink is triggered via autorun (as happens in Cmder), it silently returns -1 for TCC/4NT — no error, no message, no crash. When injected manually it logs the incompatibility and exits cleanly.
2. clink/app/src/loader/inject.cpp — find_inject_target() also skips TCC
static DWORD find_inject_target()
{
...
if (_stricmp(name, "cmd.exe") == 0)
return pid;
if (_stricmp(name, "tcc.exe") == 0 || _stricmp(name, "4nt.exe"))
return pid;
...
}3. clink/app/src/dll/dll.cpp — Post-injection DLL host check
The initialise_clink function in the DLL (which runs after injection) also only supports cmd.exe in its hosts[] table and bails out with "Unknown host" for anything else — so even if injection somehow proceeded, Clink would safely do nothing.
Conclusion
Cmder does NOT need to add the guards back. The old Cmder guards (if CMDER_SHELL == tcc set CMDER_CLINK=0) were a workaround for the old mridgers/clink which had no TCC awareness. chrisant996/clink has handled this properly in its own C++ code since at least v1.x — it explicitly recognizes tcc.exe and 4nt.exe, and when invoked via autorun silently does nothing, preventing any crash or error dialog. The problem that originally motivated the Cmder guards no longer exists.
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@DRSDavidSoft Do you know why the below was removed in
v1.3.21:This was to avoid compatibility issues with the
tccshell some users were using.I think it should be added back unless you found those issues have been resolved.
Beta Was this translation helpful? Give feedback.
All reactions