Nexus-Mods / Vortex

Vortex Development
GNU General Public License v3.0
913 stars 134 forks source link

[Bug] In per-user mode, downloaded plugins may fail to initialize if a filesystem reparse point (e.g. symbolic link, junction) is in the plugin's file path #15010

Closed BinToss closed 10 months ago

BinToss commented 10 months ago

Describe the bug After performing a not-recommended rename of my Window user account and leaving a junction link with the new name in C:\Users\ (and updating ACLs and Registry key/values), plugins loading from the $env:USERPROFILE/AppData/Roaming/Vortex/plugins/ will fail to load NodeJS/Electron dependencies as was seen in https://github.com/Nexus-Mods/Vortex/issues/8065#issuecomment-738714657.

Booting to WinRE and swapping the junction link's and real directory's names allowed Vortex aftermarket plugins to load. Downloads still succeed because I have the download directory set to a different drive volume.

If the Vortex data directory itself is relocated with a symbolic link, the Vortex app will attempt to create a directory with the same name. image

If it's relocated with a Junction link, Vortex continues with warnings and fails to initialize downloaded plugins, but experiences no critical errors.

Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Add Game Wizard v1.1.2, err=Cannot find module 'react'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Archive binding fix v0.1.0, err=Cannot find module 'redux-act'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=game-baldursgate3, err=Cannot find module 'bluebird'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Basic INI Editor v0.2.1, err=Cannot find module 'react'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Builtin Mod Browser v1.0.4, err=document is not defined, stack=ReferenceError: document is not defined
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Doom (2016) Vortex Extension v0.1.3, err=Cannot find module 'string-template'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Download Game Assigner v1.0.0, err=Cannot find module 'redux-act'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Fallout 76 Support (Wastelanders) v2.2.1, err=Cannot find module 'bluebird'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - File Preview with WinMerge v1.0.1, err=Cannot find module 'react'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Import from Bethesda.net v1.1.11, err=Cannot find module 'react-i18next'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Import from Steam Workshop v1.0.7, err=Cannot find module 'react-i18next'
Wed, 13 Dec 2023 07:07:09 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Warhammer 40k Darktide Vortex Extension v1.2.0, err=Cannot read properties of undefined (reading 'on'), stack=TypeError: Cannot read properties of undefined (reading 'on')
Wed, 13 Dec 2023 07:07:10 GMT - warn: couldn't initialize extension name=Mount and Blade II Bannerlord support-90-0-1-1-1585574611, err=Cannot find module 'libxmljs'
Wed, 13 Dec 2023 07:07:10 GMT - warn: couldn't initialize extension name=script-extender-installer, err=window is not defined, stack=ReferenceError: window is not defined
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Add Game Wizard v1.1.2, err=Cannot find module 'react'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Archive binding fix v0.1.0, err=Cannot find module 'redux-act'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=game-baldursgate3, err=Cannot find module 'bluebird'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Basic INI Editor v0.2.1, err=Cannot find module 'react'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Builtin Mod Browser v1.0.4, err=Cannot find module 'react-bootstrap'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Doom (2016) Vortex Extension v0.1.3, err=Cannot find module 'string-template'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Download Game Assigner v1.0.0, err=Cannot find module 'redux-act'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Fallout 76 Support (Wastelanders) v2.2.1, err=Cannot find module 'bluebird'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - File Preview with WinMerge v1.0.1, err=Cannot find module 'react'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Import from Bethesda.net v1.1.11, err=Cannot find module 'react-i18next'
Wed, 13 Dec 2023 07:07:11 GMT - warn: couldn't initialize extension name=Vortex Extension Update - Import from Steam Workshop v1.0.7, err=Cannot find module 'react-i18next'
Wed, 13 Dec 2023 07:07:12 GMT - warn: extension not available ext={"name":"Stub: Devil May Cry 5","author":"Black Tree Gaming Ltd.","version":"0.1.6","description":"Support for Devil May Cry 5","path":"C:\\Program Files\\Black Tree Gaming Ltd\\Vortex\\resources\\app.asar.unpacked\\bundledPlugins\\game-dmc5","bundled":true}
Wed, 13 Dec 2023 07:07:12 GMT - warn: extension not available ext={"name":"Game: Dragon Age: Origins","author":"Black Tree Gaming Ltd.","version":"1.0.1","description":"Support for Dragon Age: Origins","path":"C:\\Program Files\\Black Tree Gaming Ltd\\Vortex\\resources\\app.asar.unpacked\\bundledPlugins\\game-dragonage","bundled":true}
Wed, 13 Dec 2023 07:07:12 GMT - warn: extension not available ext={"name":"Stub: Resident Evil 2 (2019)","author":"Black Tree Gaming Ltd.","version":"0.2.6","description":"Support for RE2 (2019)","path":"C:\\Program Files\\Black Tree Gaming Ltd\\Vortex\\resources\\app.asar.unpacked\\bundledPlugins\\game-re2remake","bundled":true}
Wed, 13 Dec 2023 07:07:12 GMT - warn: extension not available ext={"name":"Stub: Resident Evil 3 (2020)","author":"Black Tree Gaming Ltd.","version":"0.1.5","description":"Support for RE3 (2020)","path":"C:\\Program Files\\Black Tree Gaming Ltd\\Vortex\\resources\\app.asar.unpacked\\bundledPlugins\\game-re3remake","bundled":true}
Wed, 13 Dec 2023 07:07:12 GMT - warn: extension not available ext={"name":"Stub: Subnautica","author":"toebean, MrPurple6411, PrimeSonic & Pickysaurus","version":"2.0.0","description":"Please ignore this extension, it will disappear in a future version of Vortex","path":"C:\\Program Files\\Black Tree Gaming Ltd\\Vortex\\resources\\app.asar.unpacked\\bundledPlugins\\game-subnautica","bundled":true}
Wed, 13 Dec 2023 07:07:12 GMT - warn: extension not available ext={"name":"Stub: Subnautica Below Zero","author":"Chloe S. & AlexejheroYTB","version":"1.1.0","description":"Please ignore this extension, it will disappear in a future version of Vortex","path":"C:\\Program Files\\Black Tree Gaming Ltd\\Vortex\\resources\\app.asar.unpacked\\bundledPlugins\\game-subnauticabelowzero","bundled":true}
Wed, 13 Dec 2023 07:07:12 GMT - warn: extension not available ext={"name":"Gamebryo Archive Check","author":"Pickysaurus","version":"1.0.3","description":"Check BSA/BA2 archives are valid for the current game after updating your load order.","path":"C:\\Program Files\\Black Tree Gaming Ltd\\Vortex\\resources\\app.asar.unpacked\\bundledPlugins\\gamebryo-archive-check","bundled":true}

To Reproduce Steps to reproduce the behavior: Symbolic Link

Set-Location $env:USERPROFILE/AppData/Roaming
Rename-Item -Path "Vortex" -NewName "Vortox" -Force
New-Item -Type SymbolicLink "Vortex" -Target "Vortox" # these links are "reparse points" and not files or directories.
Write-Host "Link resolves to: $(Resolve-Path "vortex\.updaterId")"
Write-Output "start Vortex to investigate Symbolic Link resolution. Press Enter to revert changes."
Read-Host > $null
# clean up
Remove-Item "Vortex" -Force
Rename-Item "Vortox" "Vortex"

Junction Link

Set-Location $env:USERPROFILE/AppData/Roaming
Rename-Item -Path "Vortex" -NewName "Vortox" -Force
New-Item -Type Junction "Vortex" -Target "Vortox" # these links are "reparse points" and not files or directories.
Write-Host "Link resolves to: $(Resolve-Path "vortex\.updaterId")"
Write-Output "start Vortex to investigate Junction Link resolution. Press Enter to revert changes."
Read-Host > $null
# clean up
Remove-Item "Vortex" -Force
Rename-Item "Vortox" "Vortex"

On previous PCs, I'd tried to use symbolic/junction links to relocate Vortex's data directory to a different drive volume. It failed back then and I didn't look into it further.

Expected behavior Any file/directory path reparse points such as symbolic links or junctions. These paths must resolved to "real" paths before R/W are possible on paths they point to. See https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew and https://learn.microsoft.com/en-us/windows/win32/fileio/reparse-points-and-file-operations for Win32 API usage Symbolic links are available on almost any OS kernel and file system. Junctions are an NTFS feature and not restricted to Windows OSs.

Platform (please complete the following information):

IDCs commented 10 months ago

Hi there!

First of all, thank you for your report.

You may have been notified that Vortex is being phased out in favor of the Nexus.App mod manager - Your report is such a niche case which would barely affect 1% of our users, and even then I'd expect them to know how to resolve the use case you described given that they knowingly broke their environment in the first place!

Your bug report will be forwarded to the Nexus.App developers for the sake of visibility, but as far as Vortex is concerned this will not be looked at.

DerekZiemba commented 10 months ago

Sounds like the Junction is possibly to another drive? Consider using a Volume MountPoint instead.

Ideally, you would have wanted to set this up from the start, otherwise you gotta make sure you get an actual 1:1 copy which is not trivial (permissions, alt-data stream, & your hardlinks might get automatically re-adjusted or the data they point to might instead get copied). For example, if you were freshly installing windows:

BinToss commented 10 months ago

Sounds like the Junction is possibly to another drive? Consider using a Volume MountPoint instead.

Ideally, you would have wanted to set this up from the start, otherwise you gotta make sure you get an actual 1:1 copy which is not trivial (permissions, alt-data stream, & your hardlinks might get automatically re-adjusted or the data they point to might instead get copied). For example, if you were freshly installing windows:

  • Create an Admin user account which will only be used to setup the actual account you want.
  • Go to C:\Users\ and create a new folder with the name for the actual account you want
  • Go into Disk Management, rightclick the volume you want to be your profile, and select Change Drive Letter and Paths....
  • In the popup, instead of assigning a drive letter, select Mount in the following empty NTFS folder and select the folder you created earlier.
  • Now actually create the account/user profile, set it to primary or whatever, and login and use that

I may have confused you with the note about an attempt from a few years ago involving a "C:/ProgramData/Vortex"➡️"D:/Vortex/" symbolic link.

I updated the issue description with same-drive, same-volume reproduction steps. One set of steps creates a symbolic link. The other set, a junction. I haven't tried linking to another volume, but I know only Symbolic links can be used for that. Junction and Hard links are same-volume only.

Ideally, Windows would let me choose the name I want instead of quietly creating one using the first n alphanumerics of my email address. There is a "proper" procedure for changing the username–which I followed–but it doesn't update Task Scheduler tasks, some Registry keys/values, or strings or binary data stored in files. ACLs (filesystem permissions) seem to have updated properly.