-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clink doesn't launch clink_start.cmd from custom profile folder #382
Comments
@Rygor83 I don't think it's a Clink issue: I've confirmed that it works as described, and as you expected. But there's another aspect in your specific case: Your profile is in OneDrive. Which means the clink_start.cmd file is downloaded from the Internet. So I would expect it should be getting marked as being Blocked from executing, until the Unblock button is clicked in the File Properties dialog in File Explorer. When a file is blocked, CMD won't execute it. I haven't set up OneDrive to test that theory, but I suspect that's what's going on here. Because certainly for other profile directories (custom or default), the script gets executed as expected. Can you check whether the script is marked as Blocked? |
Interesting. I've tried to reproduce the problem, but I can't -- when I try, clink_start.cmd files are run as expected from all of the possible locations (binaries dir, default profile dir, custom profile dir, or both binaries dir and profile dir). Does it make a difference if there's a clink_start.cmd file in the binaries directory as well? What are the contents of each of the clink_start.cmd files? What happens if the script includes (E.g. to help troubleshoot whether the script might be getting executed but output might be getting redirected somehow) |
@Rygor83 I see that the profile (state) directory is a custom location, which gave me some further ideas:
What if the reason |
@chrisant996 , sorry for the silence.
|
If clink_start.cmd is only in profile directory - nothing happens,
chcp 65001
If clink_start.cmd is only in profile directory - nothing happens, |
I found a way to reproduce the issue, and tracked down the problems (there's more than one, which is why it was hard to figure out what was happening). AnalysisIf you press Ctrl-X,Ctrl-Z then Clink will report its internal info directly (versus launching a separate clink_x64.exe which has to backtrack to find the Clink session it's associated with and then extract info from it). Doing that reports that the profile (state) directory is "c:\users{current_user}\appdata\local\clink". Which comes from the Autorun command having explicitly set it to that. It turns out that CLINK_PROFILE is only used if the profile directory has not been set at all by any other mechanism yet. It was documented as "takes precedence over any other mechanism", but a change in 2016 accidentally broke that. And that's also why
The change that broke itOn 2016/09/15 Martin made the following change: app_context.cpp @@ -32,8 +32,11 @@
// The environment variable 'clink_profile' overrides all other state
// path mechanisms.
- if (!os::get_env("clink_profile", state_dir))
- if (state_dir.empty())
+ if (state_dir.empty())
+ os::get_env("clink_profile", state_dir);
+
+ // Look for a state directory that's been inherited in out environment.
+ if (state_dir.empty())
- load_from_env();
+ load_from_env();
// Still no state directory set? Derive one.
if (state_dir.empty()) Notice the comment didn't change and still says "clink_profile overrides all other state path mechanisms". But the functionality changed: it made clink_profile be used only when a profile directory hasn't been specified by any other mechanisms. The description of the commit is "State dir that's set externally should trump all.", but that's not how it actually behaves. (The original logic wasn't correct either; it had a different flaw. The good news is I see how to solve both flaws.) Conclusions
|
The fix is available in v1.4.6. |
Good morning,
I am trying to configure clink to launch clink_start.cmd file from custom profile folder. It doesn't work. clink_start.cmd contains chcp 65001 command.
Here is clink info
clink.autostart value
clink custom profile folder
clink_start.cmd in different folders.
If clink_start.cmd is in binaries folder - everything is ok. but if it's in profile folder - nothing happens
The text was updated successfully, but these errors were encountered: