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

clink update fails with "Failed to unzip the latest release" #303

Closed
MagicAndre1981 opened this issue Jun 17, 2022 · 69 comments
Closed

clink update fails with "Failed to unzip the latest release" #303

MagicAndre1981 opened this issue Jun 17, 2022 · 69 comments
Labels
bug Something isn't working

Comments

@MagicAndre1981
Copy link

I tried to update from .23 to .24 on Windows 8.1, but it fails:

C:\WINDOWS\system32>clink update
Checking latest version...
Downloading latest release...
Expanding zip file...
Failed to unzip the latest release.
@MagicAndre1981
Copy link
Author

I get a response, so TLS1.2 works:

{"url":"https://api.github.com/repos/chrisant996/clink/releases/69738025","assets_url":"https://api.github.com/repos/chrisant996/clink/releases/69738025/assets","upload_url":"https://uploads.github.com/repos/chrisant996/clink/releases/69738025/assets{?name,label}","html_url":"https://github.com/chrisant996/clink/releases/tag/v1.3.24","id":69738025,"author":{"login":"chrisant996","id":17440311,"node_id":"MDQ6VXNlcjE3NDQwMzEx","avatar_url":"https://avatars.githubusercontent.com/u/17440311?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisant996","html_url":"https://github.com/chrisant996","followers_url":"https://api.github.com/users/chrisant996/followers","following_url":"https://api.github.com/users/chrisant996/following{/other_user}","gists_url":"https://api.github.com/users/chrisant996/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisant996/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisant996/subscriptions","organizations_url":"https://api.github.com/users/chrisant996/orgs","repos_url":"https://api.github.com/users/chrisant996/repos","events_url":"https://api.github.com/users/chrisant996/events{/privacy}","received_events_url":"https://api.github.com/users/chrisant996/received_events","type":"User","site_admin":false},"node_id":"RE_kwDOEZT_vc4EKB4p","tag_name":"v1.3.24","target_commitish":"master","name":"v1.3.24","draft":false,"prerelease":false,"created_at":"2022-06-17T17:42:50Z","published_at":"2022-06-17T17:58:07Z","assets":[{"url":"https://api.github.com/repos/chrisant996/clink/releases/assets/68800793","id":68800793,"node_id":"RA_kwDOEZT_vc4EGdEZ","name":"clink.1.3.24.a8a0d2.zip","label":null,"uploader":{"login":"chrisant996","id":17440311,"node_id":"MDQ6VXNlcjE3NDQwMzEx","avatar_url":"https://avatars.githubusercontent.com/u/17440311?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisant996","html_url":"https://github.com/chrisant996","followers_url":"https://api.github.com/users/chrisant996/followers","following_url":"https://api.github.com/users/chrisant996/following{/other_user}","gists_url":"https://api.github.com/users/chrisant996/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisant996/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisant996/subscriptions","organizations_url":"https://api.github.com/users/chrisant996/orgs","repos_url":"https://api.github.com/users/chrisant996/repos","events_url":"https://api.github.com/users/chrisant996/events{/privacy}","received_events_url":"https://api.github.com/users/chrisant996/received_events","type":"User","site_admin":false},"content_type":"application/x-zip-compressed","state":"uploaded","size":1724401,"download_count":4,"created_at":"2022-06-17T17:57:59Z","updated_at":"2022-06-17T17:58:00Z","browser_download_url":"https://github.com/chrisant996/clink/releases/download/v1.3.24/clink.1.3.24.a8a0d2.zip"},{"url":"https://api.github.com/repos/chrisant996/clink/releases/assets/68800799","id":68800799,"node_id":"RA_kwDOEZT_vc4EGdEf","name":"clink.1.3.24.a8a0d2_setup.exe","label":null,"uploader":{"login":"chrisant996","id":17440311,"node_id":"MDQ6VXNlcjE3NDQwMzEx","avatar_url":"https://avatars.githubusercontent.com/u/17440311?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisant996","html_url":"https://github.com/chrisant996","followers_url":"https://api.github.com/users/chrisant996/followers","following_url":"https://api.github.com/users/chrisant996/following{/other_user}","gists_url":"https://api.github.com/users/chrisant996/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisant996/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisant996/subscriptions","organizations_url":"https://api.github.com/users/chrisant996/orgs","repos_url":"https://api.github.com/users/chrisant996/repos","events_url":"https://api.github.com/users/chrisant996/events{/privacy}","received_events_url":"https://api.github.com/users/chrisant996/received_events","type":"User","site_admin":false},"content_type":"application/x-msdownload","state":"uploaded","size":1438087,"download_count":0,"created_at":"2022-06-17T17:58:00Z","updated_at":"2022-06-17T17:58:01Z","browser_download_url":"https://github.com/chrisant996/clink/releases/download/v1.3.24/clink.1.3.24.a8a0d2_setup.exe"},{"url":"https://api.github.com/repos/chrisant996/clink/releases/assets/68800800","id":68800800,"node_id":"RA_kwDOEZT_vc4EGdEg","name":"clink.1.3.24.a8a0d2_symbols.zip","label":null,"uploader":{"login":"chrisant996","id":17440311,"node_id":"MDQ6VXNlcjE3NDQwMzEx","avatar_url":"https://avatars.githubusercontent.com/u/17440311?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisant996","html_url":"https://github.com/chrisant996","followers_url":"https://api.github.com/users/chrisant996/followers","following_url":"https://api.github.com/users/chrisant996/following{/other_user}","gists_url":"https://api.github.com/users/chrisant996/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisant996/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisant996/subscriptions","organizations_url":"https://api.github.com/users/chrisant996/orgs","repos_url":"https://api.github.com/users/chrisant996/repos","events_url":"https://api.github.com/users/chrisant996/events{/privacy}","received_events_url":"https://api.github.com/users/chrisant996/received_events","type":"User","site_admin":false},"content_type":"application/x-zip-compressed","state":"uploaded","size":7721538,"download_count":0,"created_at":"2022-06-17T17:58:01Z","updated_at":"2022-06-17T17:58:02Z","browser_download_url":"https://github.com/chrisant996/clink/releases/download/v1.3.24/clink.1.3.24.a8a0d2_symbols.zip"}],"tarball_url":"https://api.github.com/repos/chrisant996/clink/tarball/v1.3.24","zipball_url":"https://api.github.com/repos/chrisant996/clink/zipball/v1.3.24","body":"**Oops, sorry:** If you see \"Unable to find latest release zip file\", then you will need to manually update to v1.3.23 or higher.\r\n\r\n**Recent highlights:** The v1.3.13 release added features that make the [i.lua](https://github.com/chrisant996/clink/discussions/263) script possible. Argmatchers can now be written to do match completion in directories other than the current directory. Argmatchers can also be written to take a whole command line as an argument: for example the built-in cmd argmatcher (cmd some_command).\r\n\r\n#### v1.3.24\r\n- Standardized the order in which completionsdirectories are searched.\r\n- Fixed the second return value fromclink.popuplist(), which was backwards by mistake.\r\n"}

@UweKeim
Copy link

UweKeim commented Jun 17, 2022

Can confirm.

✅ Works successfully on:

  • Windows 11
  • Windows Server 2022

🛑 Does not work on:

  • Windows Server 2016

When it fails, it fails like this:

Clink v1.3.23.5d5aed
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink

C:\>clink update
Checking latest version...
Downloading latest release...
Expanding zip file...
Failed to unzip the latest release.

@chrisant996
Copy link
Owner

Can you attempt clink update and then upload the clink.log file?

Maybe on Win8.x Powershell doesn't support unzipping?
Powershell v5.0 is supposed to be present on Win7 and higher, and the Expand-Archive cmdlet requires v5.0 or greater.

Do you have Clink installed under Program Files?
Did you get a prompt for elevation?

@UweKeim
Copy link

UweKeim commented Jun 17, 2022

In my case, the clink.log says:

6188 start_logger              154 ---- 2022/06/17 20:20:23.751 -------------------------------------------------
6188 start_logger              160 Host process is 'cmd.exe' (pid 24968)
6188 start_logger              164 DLL path is 'C:\Program Files (x86)\clink'
6188 start_logger              178 Windows version 10.0.14393 (x64)
6188 start_logger              181 Clink version 1.3.23.5d5aed (x64)
6188 host_cmd::validate        304 Host is not interactive; cancelling inject.
17b0 =?                          0 Clink updater: failed to unzip the latest release.
0508 history_db::compact      1494 History:  539 active, 167 deleted

I'm running this from an already UAC-elevated command prompt.

@MagicAndre1981
Copy link
Author

here is my log:

2728 start_logger              154 ---- 2022/06/17 20:25:36.007 -------------------------------------------------
2728 start_logger              160 Host process is 'cmd.exe' (pid 10024)
2728 start_logger              164 DLL path is 'C:\Program Files (x86)\clink'
2728 start_logger              178 Windows version 6.3.9600 (x64)
2728 start_logger              181 Clink version 1.3.23.5d5aed (x64)
2728 host_cmd::validate        304 Host is not interactive; cancelling inject.
2b80 =?                          0 Clink updater: failed to unzip the latest release.
27a8 history_db::compact      1494 History:  9998 active, 22 deleted

@chrisant996
Copy link
Owner

chrisant996 commented Jun 17, 2022

Can you try bypassing AutoRun and see if that makes a difference?

e.g. cmd /d \myclinkdir\clink inject

@UweKeim
Copy link

UweKeim commented Jun 17, 2022

Hopefully, I did understand correctly what you suggested.

This is what I did:

C:\>cmd /d "c:\Program Files (x86)\clink\clink" inject
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\>clink update
Checking latest version...
Expanding zip file...
Failed to unzip the latest release.

C:\>

The content of the log file now looks like this:

23a8 start_logger              154 ---- 2022/06/17 20:30:33.443 -------------------------------------------------
23a8 start_logger              160 Host process is 'cmd.exe' (pid 9128)
23a8 start_logger              164 DLL path is 'C:\Program Files (x86)\clink'
23a8 start_logger              178 Windows version 10.0.14393 (x64)
23a8 start_logger              181 Clink version 1.3.23.5d5aed (x64)
23a8 host_cmd::validate        304 Host is not interactive; cancelling inject.
0834 =?                          0 Clink updater: failed to unzip the latest release.

@chrisant996
Copy link
Owner

Ok what does this command report?

%systemroot%\system32\windowspowershell\v1.0\powershell.exe -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath "%temp%\clink\updater\v1.3.24.zip" -DestinationPath "c:\program files (x86)\clink" ; echo $error.count

@UweKeim
Copy link

UweKeim commented Jun 17, 2022

This is the script and the result:

C:\>%systemroot%\system32\windowspowershell\v1.0\powershell.exe -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath "%temp%\clink\updater\v1.3.24.zip" -DestinationPath "c:\program files (x86)\clink" ; echo $error.count
x86 : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:177
+ ... nk\updater\v1.3.24.zip -DestinationPath c:\program files (x86)\clink  ...
+                                                               ~~~
    + CategoryInfo          : ObjectNotFound: (x86:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

1

C:\>

Maybe the white space in the path to clink is the issue here?

@MagicAndre1981
Copy link
Author

same for me, also CommandNotFoundException

@chrisant996
Copy link
Owner

Ah. Cmd is stripping quotes. 😑 Must add another layer of quotes.

@chrisant996
Copy link
Owner

But that's not the problem, unless your %TEMP% directory name contains spaces.

Clink expands the zip file into %TEMP%\clink\updater\v1.3.24 directory.

So the command I should have asked you to run is actually this:

%systemroot%\system32\windowspowershell\v1.0\powershell.exe -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath "%temp%\clink\updater\v1.3.24.zip" -DestinationPath "%temp%\clink\updater\v1.3.24" ; echo $error.count

@UweKeim
Copy link

UweKeim commented Jun 17, 2022

OK, I ran the script:

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

Clink v1.3.23.5d5aed
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink

Clink v1.3.24 is available.
- To apply the update, run 'clink update'.
- To stop checking for updates, run 'clink set clink.autoupdate false'.
- To view the release notes, visit the Releases page:
  https://github.com/chrisant996/clink/releases

C:\>%systemroot%\system32\windowspowershell\v1.0\powershell.exe -Command $ProgressPreference='Silentl
yContinue' ; Expand-Archive -Force -LiteralPath "%temp%\clink\updater\v1.3.24.zip" -DestinationPath "%temp%\clink\update
r\v1.3.24" ; echo $error.count
New-Object : Exception calling ".ctor" with "3" argument(s): "Central Directory corrupt."
At
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:934
char:23
+ ... ipArchive = New-Object -TypeName System.IO.Compression.ZipArchive -Ar ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

1

C:\>

@MagicAndre1981
Copy link
Author

my temp has no space:

C:\Users\André\AppData\Local\Temp\clink\updater

but the zip in the folder has 0kb in size 🤔

@chrisant996
Copy link
Owner

Uh lol whoa.

So maybe the unzip algorithm in the Win8.x Powershell has a flaw, or maybe a network error corrupted the .zip file during download?

Can you upload the %temp%\clink\updater\v1.3.24.zip file here for inspection, to see if the file got corrupted?

@chrisant996
Copy link
Owner

my temp has no space:

C:\Users\André\AppData\Local\Temp\clink\updater

but the zip in the folder has 0kb in size 🤔

Oh, ok. So it somehow got interrupted or didn't download at all.

What happens if you delete the zip file and try clink update again?

@MagicAndre1981
Copy link
Author

What happens if you delete the zip file and try clink update again?

I already tried this and it always happens the same. zip is 0kb. What is the download command you use? I could run it and post any errors.

@MagicAndre1981
Copy link
Author

under Windows 10 it works fine:

C:\WINDOWS\system32>clink update
Checking latest version...
Downloading latest release...
Expanding zip file...
Updated Clink to v1.3.24.


0624 start_logger              154 ---- 2022/06/18 20:56:48.662 -------------------------------------------------
0624 start_logger              160 Host process is 'cmd.exe' (pid 1572)
0624 start_logger              164 DLL path is 'C:\Program Files (x86)\clink'
0624 start_logger              178 Windows version 10.0.17763 (x64)
0624 start_logger              181 Clink version 1.3.23.5d5aed (x64)
0624 host_cmd::validate        304 Host is not interactive; cancelling inject.
1e2c =?                          0 Clink updater: updated Clink to v1.3.24.
24d0 history_db::compact      1494 History:  73 active, 66 deleted

@UweKeim
Copy link

UweKeim commented Jun 18, 2022

It seems that this is the unzip method.

Looks like it is using the Expand-Archive cmdlet.

@MagicAndre1981
Copy link
Author

my zip is 0kb, so download is somehow broken on 8.1 🤔 🤷‍♂️

@MagicAndre1981
Copy link
Author

on my Windows 10, where the update worked, I still see the update when I run winget upgrade . So maybe try to download the setup and run it silently to update clink without doing any unzipping.

@chrisant996
Copy link
Owner

I made the http call to check for latest release use TLS 1.2.
I did not make the http call to download the latest release use TLS 1.2.

/facepalm

@chrisant996
Copy link
Owner

Fixed by f724b0a.

@MagicAndre1981
Copy link
Author

MagicAndre1981 commented Jun 19, 2022

ok, will test this in next update to .26.

But updatecheck doesn't find the .25 version:

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.

Clink v1.3.25.080a5d
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink

C:\WINDOWS\system32>clink update
Checking latest version...
No update available; local version v1.3.25 is not older than latest release v1.3.24.

@chrisant996
Copy link
Owner

ok, will test this in next update to .26.

But updatecheck doesn't find the .25 version:

Last time that happened, it was a GitHub service issue, most likely with cache replication delays.

@MagicAndre1981
Copy link
Author

Last time that happened, it was a GitHub service issue, most likely with cache replication delays.

I still see it. How long can this take? what about the winget upgrade issue? Should I open a new issue with the suggestion to switch to installer?

@MagicAndre1981
Copy link
Author

today I still see the message that .24 is latest release:

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.

Clink v1.3.25.080a5d
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink

C:\WINDOWS\system32>clink update
Checking latest version...
No update available; local version v1.3.25 is not older than latest release v1.3.24.

C:\WINDOWS\system32>

@chrisant996
Copy link
Owner

chrisant996 commented Jun 20, 2022

@MagicAndre1981 Does your Win10 computer see v1.3.25?

The fact that Clink is able to say "not older than latest release v1.3.24" means it successfully queried the github API for "get latest release", and github reported "v1.3.24" as the latest release.

Here is the github API link: https://api.github.com/repos/chrisant996/clink/releases/latest.

To see what github is reporting:

  1. Open the link above.
  2. Find "tag_name" -- that's the version number of the latest release reported by the github API.
  3. Find "browser_download_url" -- that's the URL for downloading the zip file.

The fact that Clink is able to say "v1.3.24" shows that the API request succeeded, and reported "v1.3.24". If the github API reports an inaccurate version, there is nothing Clink could do to fix whatever problem the github web site is encountering.

EDIT: Maybe something is caching web requests and return old cached results -- maybe your ISP, maybe a proxy between you and github, maybe your employer, maybe malware detection software, maybe something else.

@MagicAndre1981
Copy link
Author

can you please post the powershell command you use to expand the zip? Maybe running it normally shows more details what is wrong.

@MagicAndre1981
Copy link
Author

Looking at the folder mentioned in the log file:

image

strange, in your case the file is still 0kb, so nothing to unzip. So the download is still an issue for you and I have unzip issues.

@UweKeim
Copy link

UweKeim commented Jun 23, 2022

Now I've manually installed v1.3.26 on my Windows Server 2016.

Maybe this fixed some download issues.

Will try again when v1.3.27 comes out, whether works better.

@chrisant996 chrisant996 added the bug Something isn't working label Jun 23, 2022
@chrisant996
Copy link
Owner

Please try this pre-release installer: clink_setup_0.0.1.zip

It is the latest Clink, plus additional logging for updater failures, but its version number is artificially set to v0.0.1 so it will always want to update.

If/when it fails, the log file should contain details about the command line that failed, and any error text that was output by the command.

@chrisant996 chrisant996 reopened this Jun 23, 2022
@UweKeim
Copy link

UweKeim commented Jun 23, 2022

Crazy! This version works correctly on my Windows Server 2016!

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

Clink v0.0.1.7c097e
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink

Clink v1.3.26 is available.
- To apply the update, run 'clink update'.
- To stop checking for updates, run 'clink set clink.autoupdate false'.
- To view the release notes, visit the Releases page:
  https://github.com/chrisant996/clink/releases

C:\>clink update
Checking latest version...
Expanding zip file...
Updating registry keys...
Updated Clink to v1.3.26.

C:\>

The clink.log contains:

7d98 start_logger              154 ---- 2022/06/23 19:41:30.374 -------------------------------------------------
7d98 start_logger              160 Host process is 'cmd.exe' (pid 32152)
7d98 start_logger              164 DLL path is 'C:\Program Files (x86)\clink'
7d98 start_logger              178 Windows version 10.0.14393 (x64)
7d98 start_logger              181 Clink version 1.3.26.eec90c (x64)
7d98 host_cmd::validate        304 Host is not interactive; cancelling inject.
532c =?                          0 Clink updater: updated Clink to v1.3.26.
5910 history_db::compact      1494 History:  543 active, 181 deleted

@MagicAndre1981
Copy link
Author

MagicAndre1981 commented Jun 23, 2022

ok, this helped. Expand-Archive is not found as command:

0df0 start_logger              154 ---- 2022/06/23 19:41:33.895 -------------------------------------------------
0df0 start_logger              160 Host process is 'cmd.exe' (pid 3568)
0df0 start_logger              164 DLL path is 'C:\Program Files (x86)\clink'
0df0 start_logger              178 Windows version 6.3.9600 (x64)
0df0 start_logger              181 Clink version 0.0.1.7c097e (x64)
0df0 host_cmd::validate        304 Host is not interactive; cancelling inject.
0a98 =?                          0 Clink updater: 2>&1 "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath \"C:\Users\ANDR~1\AppData\Local\Temp\clink\updater\v1.3.26.zip\" -DestinationPath \"C:\Users\ANDR~1\AppData\Local\Temp\clink\updater\v1.3.26\" ; echo $error.count
0a98 =?                          0 Clink updater: output from command:
0a98 =?                          0 Clink updater:     Expand-Archive : Die Benennung "Expand-Archive" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines 
0a98 =?                          0 Clink updater:     ausf�hrbaren Programms erkannt. šberpr�fen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und 
0a98 =?                          0 Clink updater:     wiederholen Sie den Vorgang.
0a98 =?                          0 Clink updater:     In Zeile:1 Zeichen:42
0a98 =?                          0 Clink updater:     + $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath "C:\ ...
0a98 =?                          0 Clink updater:     +                                          ~~~~~~~~~~~~~~
0a98 =?                          0 Clink updater:         + CategoryInfo          : ObjectNotFound: (Expand-Archive:String) [], CommandNotFoundException
0a98 =?                          0 Clink updater:         + FullyQualifiedErrorId : CommandNotFoundException
0a98 =?                          0 Clink updater:      
0a98 =?                          0 Clink updater:     1
0a98 =?                          0 Clink updater: failed to unzip the latest release.
15e0 history_db::compact      1494 History:  9995 active, 68 deleted

Output of $PSVersionTable command:

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. Alle Rechte vorbehalten.

PS C:\Users\André> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.42000
BuildVersion                   6.3.9600.20337
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2

Looks like I have to install the 5.1 Update first:

Windows Management Framework 5.1
https://www.microsoft.com/en-us/download/details.aspx?id=54616

@chrisant996
Copy link
Owner

😑

I will look for a way to check the Powershell version and report an informative error message.

😑

@MagicAndre1981
Copy link
Author

it works: 🥰🥳

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.

Clink v0.0.1.7c097e
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink

Clink v1.3.26 is available.
- To apply the update, run 'clink update'.
- To stop checking for updates, run 'clink set clink.autoupdate false'.
- To view the release notes, visit the Releases page:
  https://github.com/chrisant996/clink/releases

C:\WINDOWS\system32>clink update
Checking latest version...
Expanding zip file...
Updating registry keys...
Updated Clink to v1.3.26.

so yes, check for PS 5.1 on Win7, 8.1, Server 2008 R2, Server 2012 R2 systems to avoid this

@chrisant996
Copy link
Owner

Crazy! This version works correctly on my Windows Server 2016!

It means the changes that will show up in .27 fixed the issues you were encountering.

Or another possibility is that antivirus protection is intermittently blocking operations.

@UweKeim
Copy link

UweKeim commented Jun 23, 2022

Thanks for all your efforts, @chrisant996, highly appreciated by me!

I'm only using the built-in Windows Defender, no 3rd party snake oil. So I hope this does not interfer.

@chrisant996
Copy link
Owner

chrisant996 commented Jun 24, 2022

@UweKeim @MagicAndre1981 can one of you try powershell -Command Get-Host with German as the current UI language? I want to make sure that the field names always show up in English, so that they can be used programmatically. Particularly the "Version" field.

@chrisant996
Copy link
Owner

Phew. I expect the updater in v1.3.27 will finally work on Win8.x. But we'll have to wait until v1.3.28 to know for certain, of course.

I also noticed that the PowerShell output in the log file showed up with the wrong encoding, so I added a Lua API for codepage/UTF8 conversion so that the log file can contain accurate output from the PowerShell commands. And the functions can be used for output from other programs in general -- in fact, for any programs whose output is in the current Active Code Page rather than UTF8. Lua scripts must explicitly use unicode.fromcodepage(text) to do it, though, there's no good way to safely do it automatically.

@MagicAndre1981
Copy link
Author

@UweKeim @MagicAndre1981 can one of you try powershell -Command Get-Host with German as the current UI language?

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.

Clink v1.3.26.eec90c
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink

C:\Users\André>powershell -Command Get-Host


Name             : ConsoleHost
Version          : 5.1.14409.1027
InstanceId       : b6d9e103-068f-4633-b404-e56ffd57b3b0
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : de-DE
CurrentUICulture : de-DE
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

I did the update to .27, but now I see an error:

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.

Clink v1.3.27.cc94e1
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2022 Christopher Antos
https://github.com/chrisant996/clink

?:0: attempt to compare nil with number
C:\WINDOWS\system32>clink update
?:0: attempt to compare nil with number
The update attempt failed for an unknown reason.

C:\WINDOWS\system32>

@chrisant996
Copy link
Owner

I think the Powershell version check is failing when the UI language is not English.

That issue is tracked by #309.

@chrisant996
Copy link
Owner

chrisant996 commented Jun 30, 2022

@MagicAndre1981 for closure:

When I run this command from powershell I see .25, but not when I run clink update 🤔 🤷‍♂️

I finally figured out what was happening, and fixed it.

If there was a downloaded zip update file already, and the current Clink is already up to date with the latest release, then the "already up to date" message accidentally cited the downloaded zip update file version rather than the actual live version. The functionality was correct, but the "nothing to do" message cited the wrong version number. It's fixed in v1.3.32.

@MagicAndre1981
Copy link
Author

It's fixed in v1.3.32.

ok, update to .32 is somehow broken

@captainkirkoff
Copy link

Hi,
I'm still experiencing thiss issue with 1.3.31.
It happens with my work PC (Win 10.0.19044.1766) while not happening with my home PC (Window 11).
Italian UI in both cases.
The console message says "Failed to unzip the latest release", but that's not properly true because I find all files completely unzipped under AppData\Local\clink\updater\v1.3.33.
This is the log:

2368 start_logger              157 ---- 2022/07/01 11:52:28.344 -------------------------------------------------
2368 start_logger              163 Host process is 'cmd.exe' (pid 9064)
2368 start_logger              167 DLL path is 'C:\Program Files (x86)\clink'
2368 start_logger              181 Windows version 10.0.19044 (x64)
2368 start_logger              184 Clink version 1.3.31.f14c84 (x64)
2368 host_cmd::validate        304 Host is not interactive; cancelling inject.
3ee4 =?                          0 Clink updater: 2>&1 "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath \"C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33.zip\" -DestinationPath \"C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33\" ; echo $error.count
3ee4 =?                          0 Clink updater: output from command:
3ee4 =?                          0 Clink updater:     1
3ee4 =?                          0 Clink updater:     
3ee4 =?                          0 Clink updater: failed to unzip the latest release.

image

@chrisant996
Copy link
Owner

Hi,
I'm still experiencing thiss issue with 1.3.31.
It happens with my work PC (Win 10.0.19044.1766) while not happening with my home PC (Window 11).
Italian UI in both cases.
The console message says "Failed to unzip the latest release", but that's not properly true because I find all files completely unzipped under AppData\Local\clink\updater\v1.3.33.
This is the log:

...
3ee4 =?                          0 Clink updater: 2>&1 "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath \"C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33.zip\" -DestinationPath \"C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33\" ; echo $error.count
3ee4 =?                          0 Clink updater: output from command:
3ee4 =?                          0 Clink updater:     1
...

See the 1 output in the log?
That is the count of errors reported by PowerShell when it expands the zip file.

Try manually running the Powershell command that's listed in the log: what happens when you run it manually?

@captainkirkoff
Copy link

3ee4 =? 0 Clink updater: 2>&1 "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath "C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33.zip" -DestinationPath "C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33" ; echo $error.count
3ee4 =? 0 Clink updater: output from command:
3ee4 =? 0 Clink updater: 1
...

See the 1 output in the log? That is the count of errors reported by PowerShell when it expands the zip file.

Try manually running the Powershell command that's listed in the log: what happens when you run it manually?

If I run

"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath "C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33.zip" -DestinationPath "C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33"

it gaves no output in console and simply do the job (I find the files regularly unzipped in the destination path which I previously removed)

image
image

@chrisant996
Copy link
Owner

chrisant996 commented Jul 1, 2022

@captainkirkoff The $error contains all errors that have occurred in the current PowerShell session. Apparently an error occurred before Clink's use of Expand-Archive. Maybe there is a configuration problem with PowerShell on that computer, such that launching PowerShell encounters an internal error.

Can you run the following command? Please do not strip the $error parts -- they are an important part of the command, especially for troubleshooting purposes.

"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -Command $ProgressPreference='SilentlyContinue' ; Expand-Archive -Force -LiteralPath "C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33.zip" -DestinationPath "C:\Users\piero\AppData\Local\Temp\clink\updater\v1.3.33" ; echo $error.count ; echo $error

It will be useful to confirm what error has occurred, so that you can potentially fix the PowerShell configuration on that computer, and so that Clink can be more resilient to external errors that don't directly affect what Clink needs to accomplish.

@captainkirkoff
Copy link

Ok, here's the output (sorry, I'm totally ignorant about PowerShell):
image

@MagicAndre1981
Copy link
Author

remove this 3rd party module "Jump.Location" and try again

@chrisant996
Copy link
Owner

chrisant996 commented Jul 1, 2022

@captainkirkoff ah, excellent, thank you. Yes, there is indeed some configuration problem with PowerShell on that computer. Apparently an error occurs in a script that automatically runs during PowerShell startup.

I have a change coming in Clink that will make it resilient to that kind of problem.

(Unless the configuration problem affects only the Expand-Archive command, and not PowerShell startup.)

@captainkirkoff
Copy link

@captainkirkoff ah, excellent, thank you. Yes, there is indeed some configuration problem with PowerShell on that computer.

Yes! And as @MagicAndre1981 suggests, removing that module everything goes fine.
I don't even remember why I installed it, that's enough to say I don't need it. ;-)

By the way, thank you for this wonderful piece of software. :-)

@Welding-Torch
Copy link

Got this same problem right now in 2024. Quite odd considering that the last few Clink updates installed smoothly.

@chrisant996
Copy link
Owner

Check whether your anti virus tool is interfering. Some people have reported that some anti virus tools are getting false positives.

Also check the clink.log file to see if it lists any info about what failed.

@Welding-Torch
Copy link

Indeed you are right, Windows Defender's Protection History shows that it was removing the \clink\updater\v1.6.0.zip before it could be unzipped.

Overactive Antivirus smh. Thanks for the help, Chris.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants