Skip to content
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

Proper way to update via scoop or clink update? #615

Closed
maximunited opened this issue Jun 9, 2024 · 7 comments
Closed

Proper way to update via scoop or clink update? #615

maximunited opened this issue Jun 9, 2024 · 7 comments
Labels
external The issue is due to external causes outside of Clink

Comments

@maximunited
Copy link

So I installed clink via scoop.
now with each new version I do the following:
> scoop update
> clink update

Then when I type clink info, the version does show the latest, but this version does not match the value of binaries or the scripts . It also shows an "old" version in the clink autorun show.

Example where version is 1.6.5, and other values are 1.6.3:

> clink autorun show                                                                        
Current AutoRun values

  Current user:

    native : "C:\Users\admin\scoop\apps\clink\1.6.3\clink.bat" inject --autorun
     wow64 : "C:\Users\admin\scoop\apps\clink\1.6.3\clink.bat" inject --autorun

  All users:

    native : <unset>
     wow64 : <unset>

and:

> clink info                                                                              
version  : 1.6.15.626c80
session  : 26160
injected : clink_dll_x64.dll
binaries : C:\Users\admin\scoop\apps\clink\1.6.3
state    : C:\Users\admin\AppData\Local\clink
log      : C:\Users\admin\AppData\Local\clink\clink.log
settings : C:\Users\admin\AppData\Local\clink\clink_settings
history  : C:\Users\admin\AppData\Local\clink\clink_history
scripts  : C:\Users\admin\scoop\apps\clink\1.6.3 ; C:\Users\admin\AppData\Local\clink ; C:\Users\admin\MyProgs\clink-completions;C:\Users\admin\MyProgs\clink-completions-extra\;C:\Users\admin\MyProgs\clink-gizmos\;C:\Users\admin\scoop\apps\clink-flex-prompt\0.17
inputrc  : %clink_inputrc%
             (unset)
         : state directory
             C:\Users\admin\AppData\Local\clink\.inputrc
             C:\Users\admin\AppData\Local\clink\_inputrc
         : %userprofile%
             C:\Users\admin\.inputrc
             C:\Users\admin\_inputrc
         : %localappdata%
             C:\Users\admin\AppData\Local\.inputrc
             C:\Users\admin\AppData\Local\_inputrc
         : %appdata%
             C:\Users\admin\AppData\Roaming\.inputrc
             C:\Users\admin\AppData\Roaming\_inputrc
         : %home%
             C:\Users\admin\.inputrc
             C:\Users\admin\_inputrc
system   : 10.0.19045.4412
codepage : 1252
keyboard langid : 8192
keyboard layout : 00000409

What is the "correct" way to update?

@chrisant996
Copy link
Owner

This is something about scoop, which is interfering with Clink.
It's also not normal behavior for scoop.
You'll probably need to look for help in the scoop forums.

Specific details follow:

So I installed clink via scoop. now with each new version I do the following:
> scoop update
> clink update

Specifically how did install clink via scoop?

I tried it just now, and scoop installed it in ~\scoop\apps\clink\current\.
There's no version number in the directory name.

I tried clink autorun install and it also doesn't have a version number in the directory name:

C:\Users\chrisant>clink autorun install
Current AutoRun values

  Current user:

    native : "C:\Users\chrisant\scoop\apps\clink\current\clink.bat" inject --autorun
     wow64 : "C:\Users\chrisant\scoop\apps\clink\current\clink.bat" inject --autorun

  All users:

    native : <unset>
     wow64 : <unset>

Clink successfully installed to run when cmd.exe starts (for current user).

Then when I type clink info, the version does show the latest, but this version does not match the value of binaries or the scripts . It also shows an "old" version in the clink autorun show.

Example where version is 1.6.5, and other values are 1.6.3:

...

What is the "correct" way to update?

The problem is that somehow scoop has gotten into an unusual state where it's putting the version number in the directory name. That breaks installing for AutoRun, since installing for AutoRun has to use the full pathname, which then gets invalidated with each new version.

How did scoop come to put the version number in the directory name?

That's something about scoop, not about Clink.
I don't know much about scoop, so I can't directly help.

@chrisant996 chrisant996 added the external The issue is due to external causes outside of Clink label Jun 9, 2024
@chrisant996
Copy link
Owner

I figured out what's going on:

You ran clink autorun install after Clink was already injected.

Injecting Clink defines an alias clink which points to the exact copy of Clink that was loaded -- and that ends up getting the version number in the directory name.

  • If you ran clink autorun install before Clink was injected, then typing clink would cause CMD to search for Clink in the system PATH, and it would find the directory name with "current", and then that's what would get registered for AutoRun (instead of the version number directory).
  • Or if you ran %userprofile%\scoop\apps\clink\current\clink autorun install then that would work fine.

So, at this point, then simplest thing is just run %userprofile%\scoop\apps\clink\current\clink autorun install, and that should get you back into a normal state where scoop and clink can coexist fine.

(And I'll try to see if there's anything Clink can do to compensate for what scoop is doing, but no guarantees since Clink has no control over scoop.)

chrisant996 added a commit that referenced this issue Jun 9, 2024
Scoop tries to control app versions and updates.  But it makes
assumptions which are inaccurate for some apps (such as Clink).

Fine.  Clink will try to work around that by getting the path that was
used to invoke Clink, rather than the path where Clink actually exists.
This ends up getting scoop's "current" directory symlink for the app,
instead of the real "version" directory of the app.

It looks like this shouldn't cause any regressions.

Related to issue #615.
@chrisant996
Copy link
Owner

I believe I found a way to compensate for what scoop is doing, so that the clink alias can end up pointing at scoop's "current" app directory symlink, instead of at the actual app version directory.

@maximunited
Copy link
Author

Thanks for the workaround.
Manually succeeded to overcome:

  1. scoop update clink
  2. clink autorun uninstall
  3. %userprofile%\scoop\apps\clink\current\clink autorun install
  4. %userprofile%\scoop\apps\clink\current\clink inject

@chrisant996
Copy link
Owner

(Step 3 by itself is the key. The other steps weren't needed.)

@maximunited
Copy link
Author

Actually I've tried that step separetly previously. Didnt help. Unless I must run it as a full path, not just clink autorun install

@chrisant996
Copy link
Owner

chrisant996 commented Jun 10, 2024

Yes. I said you have to run it as the full exact path.

Literally run
%userprofile%\scoop\apps\clink\current\clink autorun install

Running something else, such as clink autorun install, is not the same as running %userprofile%\scoop\apps\clink\current\clink autorun install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external The issue is due to external causes outside of Clink
Projects
None yet
Development

No branches or pull requests

2 participants