BrettMayson / HEMTT

Build System for Arma 3
http://hemtt.dev/
GNU General Public License v2.0
113 stars 40 forks source link

`dev` link creation fails for network locations #494

Closed jonpas closed 1 year ago

jonpas commented 1 year ago

As expected, if you try to $ hemtt dev a mod on a network drive (UNC path), the link creation will fail, as creating symbolic links of any kind with source and target both being on a network drive, is not supported: The file or directory is not a reparse point.

Not sure how to solve or work-around this yet. One alternative which I have used so far for linking on network drives, is to just link on my host Linux system (where the drive is mapped from). This is obviously not ideal for switching branches, rebuilding etc.

If I run $ hemtt dev on Linux, it will create links and build successfully. If I then run the same command on Windows on that same network drive, it will just wipe the addons/ folder as it's a different type of a link and will delete the link source as well.

This might be very specific to me, but doing things on a network drive, eg. on your laptop with a shared network drive from your PC, is probably not that big of a use-case stretch.

This obviously wasn't the problem before with file-patching builds residing directly in root addons/ folder.

BrettMayson commented 1 year ago

I think this is a bit too niche, I think one solution would be allowing the specification of a custom directory for the temporary operations, rather than the system temp folder?

jonpas commented 1 year ago

No, symlinks to system temp folder work fine, as those go network drive => local drive.

TRACE junction link "%tmp%\\hemtt\\Arma 3_Mods_CBA_A3\\source\\x\\cba\\addons\\accessory" => "E:\\Arma 3\\Mods\\CBA_A3\\addons\\accessory"
TRACE directory symbolic link "%tmp%\\hemtt\\Arma 3_Mods_CBA_A3\\source\\x\\cba\\addons\\accessory" => "E:\\Arma 3\\Mods\\CBA_A3\\addons\\accessory"

E: is network-mounted, C: is local.

Only the final symlinking to .hemttout/dev is problematic.

TRACE junction link "E:\\Arma 3\\Mods\\CBA_A3\\.hemttout\\dev\\addons\\accessory" => "E:\\Arma 3\\Mods\\CBA_A3\\addons\\accessory"
TRACE junction link "E:\\Arma 3\\Mods\\CBA_A3\\.hemttout\\dev\\addons\\disposable" => "E:\\Arma 3\\Mods\\CBA_A3\\addons\\disposable"
...
TRACE directory symbolic link "E:\\Arma 3\\Mods\\CBA_A3\\.hemttout\\dev\\addons\\accessory" => "E:\\Arma 3\\Mods\\CBA_A3\\addons\\accessory"
TRACE directory symbolic link "E:\\Arma 3\\Mods\\CBA_A3\\.hemttout\\dev\\addons\\disposable" => "E:\\Arma 3\\Mods\\CBA_A3\\addons\\disposable"
...
ERROR Unable to create link: The file or directory is not a reparse point.

It correctly tries junction first, then symbolic, but it still won't work as those go network drive => network drive, which is just straight up unsupported.

Maybe ability to specify a different .hemttout/dev folder?

BrettMayson commented 1 year ago

Ah I see, that should be fairly straightforward to add, probably

jonpas commented 1 year ago

Relevant to this, issue with hemtt dev on Linux, it creates a link to a path with \ instead of /, so symlink is invalid.

# Invalid
❱ ln -s "<CBA_A3>/addons\network" .hemttout/dev/addons/network
❱ ll .hemttout/dev/addons/network
lrwxrwxrwx 1 jonpas jonpas 51 Nov  2 15:36 .hemttout/dev/addons/network -> '<CBA_A3>/addons\network'

# Valid
❱ ln -s "<CBA_A3>/addons/network" .hemttout/dev/addons/network
❱ ll .hemttout/dev/addons/network
lrwxrwxrwx 1 jonpas jonpas 51 Nov  2 15:36 .hemttout/dev/addons/network -> '<CBA_A3>/addons/network'/
jonpas commented 1 year ago

599 fixes above comment and also makes this issue irrelevant (for me) as I can now just hemtt dev on Linux (where those network drives are "physical") and get correct links (drive shared via SMB with wide links enabled).

However this is potentially still a problem for working off of actual network drives such as NAS shares or something.