matthewjberger / scoop-nerd-fonts

A scoop bucket for installing nerd fonts
The Unlicense
353 stars 34 forks source link

Updating font fails on Windows 10 (21H2) #271

Closed Skylark13 closed 7 months ago

Skylark13 commented 7 months ago

Hello,

I saw this closed issue #198 Also this merged PR #200

However, I am on Windows 10 21H2 and I am getting the following when I try to update CascadiaCode-NF:

PS C:\WINDOWS\system32> scoop update -f CascadiaCode-NF
CascadiaCode-NF: 3.1.0 -> 3.1.0
Updating one outdated app:
Updating 'CascadiaCode-NF' (3.1.0 -> 3.1.0)
Downloading new version
Loading CascadiaCode.zip from cache
Checking hash of CascadiaCode.zip ... ok.
Running pre_uninstall script...
Uninstalling 'CascadiaCode-NF' (3.1.0)
Running uninstaller script...
Unlinking ~\scoop\apps\CascadiaCode-NF\current
Installing 'CascadiaCode-NF' (3.1.0) [64bit] from nerd-fonts bucket
Loading CascadiaCode.zip from cache
Extracting CascadiaCode.zip ... done.
Running installer script...
Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-Bold.ttf' because it is being used by
another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-BoldItalic.ttf' because it is being used
by another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-ExtraLight.ttf' because it is being used
by another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-ExtraLightItalic.ttf' because it is being
used by another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-Italic.ttf' because it is being used by
another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-Light.ttf' because it is being used by
another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-LightItalic.ttf' because it is being used
by another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-Regular.ttf' because it is being used by
another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-SemiBold.ttf' because it is being used by
another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-SemiBoldItalic.ttf' because it is being
used by another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-SemiLight.ttf' because it is being used by
another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Copy-Item : The process cannot access the file
'C:\Users\guayj\AppData\Local\Microsoft\Windows\Fonts\CaskaydiaCoveNerdFont-SemiLightItalic.ttf' because it is being
used by another process.
At line:34 char:5
+     Copy-Item $_.FullName -Destination $fontInstallDir
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

Linking ~\scoop\apps\CascadiaCode-NF\current => ~\scoop\apps\CascadiaCode-NF\3.1.0
'CascadiaCode-NF' (3.1.0) was installed successfully!

So it seems even on my version of Windows, we cannot update fonts installed at user level. I am thinking the same fix that was done for Windows 11 22H2 should be done for all versions of Windows, as it seems the same problem applies (according to this Stack Overflow answer stating "This behaviour was introduced with a security update released in August 2014")

https://stackoverflow.com/a/27681134

I cannot explain why no one else has reported this before. Perhaps everyone knew to install fonts with the -g flag, except me 😕

For now I will uninstall the font, reboot, and reinstall it with the -g flag to install it for all users. That should fix my problem. But I wanted to report the problem.

Thanks!

serifold commented 7 months ago

Windows 10 22H2, same problems. Thanks for your sharing!

jonz94 commented 7 months ago

Thanks for reporting the issue, but I cannot reproduce this bug on my end (Windows 10 23H2) at the moment.

image

Additionally, installing/updating fonts without the -g flag should work because we reverted the changes in PR #200 with PR #227. (Details for the implementation can be found at https://github.com/matthewjberger/scoop-nerd-fonts/issues/198#issuecomment-1488996737)

I will try to set up a Windows 10 21H2 VM this weekend to see if there are any issues.


Edit:

Feel free to share more information if you encounter this bug, as additional details will assist in addressing and resolving the issue more effectively.

Thanks!

Skylark13 commented 7 months ago

I am not on 23H2 yet (I just updated to 22H2 yesterday), maybe something is different there. But as far as I know, I have PR #227 and it was giving me the errors above yesterday.

Perhaps to repro it, you need to reboot between installing the font and trying to update it? I don't know.

Hmmm, actually, I uninstalled the font through scoop and rebooted yesterday, and today I tried to install it (without -g, as an additional test) and it still failed with the same issue. I wonder if it's a local problem, perhaps because (a long time ago) I had installed those fonts manually before I ever installed them through scoop? I'll attempt to delete them manually, and then retry and report back.

Sorry for the noise!

Skylark13 commented 7 months ago

OK, I think this was indeed a local problem. What I did:

I could not delete the font files manually from C:\Users\username\AppData\Local\Microsoft\Windows\Fonts, they were in use by "System". I had to delete references to them in the registry (which were under HKEY_USERS\S-1-5-21-2876648415-106451411-856188508-1001\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts), then reboot, then I could delete them.

Then I could install the font using scoop without running into those error messages.

Note that updating the font from a console which uses the font still failed with the same error. I think this is expected. I just had to start a cmd.exe or another shell not using that font, and then the update went through without error. Similar to when updating pwsh or WindowsTerminal, I'll have to keep an eye out using scoop status when there is an update to the font, and update it in another shell instead of the one I use normally which uses the font.

Thanks for the quick support and hope this helps someone else even though it wasn't an issue with scoop in the end.