plakar
plakar copied to clipboard
Add package on windows fails with Access is denied
Describe the bug When adding a locally built package on Windows, it fails when renaming the temp directory.
To Reproduce
C:\Users\****\Downloads\plakar-1.0.5\plakar-1.0.5>plakar pkg build s3
info: fetching https://plugins.plakar.io/kloset/recipe/v1.0.0/s3.yaml
C:\Users\****\AppData\Local\Microsoft\WinGet\Packages\ezwinports.make_Microsoft.Winget.Source_8wekyb3d8bbwe\bin\make.exe -C C:\Users\****\AppData\Local\Temp\8\build-s3-v1.0.4-4231977398 EXT=.exe
931a5e00: OK ✓ /manifest.yaml
931a5e00: OK ✓ /s3Importer.exe
931a5e00: OK ✓ /s3Exporter.exe
931a5e00: OK ✓ /s3Storage.exe
931a5e00: OK ✓ /
Plugin created successfully: s3_v1.0.4_windows_amd64.ptar
C:\Users\****\Downloads\plakar-1.0.5\plakar-1.0.5>plakar pkg add ./s3_v1.0.4_windows_amd64.ptar
plakar: failed to install s3_v1.0.4_windows_amd64.ptar: failed to load plugin "s3": failed to rename: rename C:\Users\****\AppData\Local\plakar\plugins\v1.0.0\plugin-extract-1775811268 C:\Users\****\AppData\Local\plakar\plugins\v1.0.0\s3_v1.0.4_windows_amd64: Access is denied.
Tested on:
- Windows 11 Enterprise (no admin rights)
- Windows Server 2022 (no admin rights, with admin rights)
- plakar 1.0.4, 1.0.5 (release builds, or self compiled with go 1.25.2)
Additional context Didn't test with pre-built packages as target servers don't have access to an external network. Removing the MkdirTemp stuff in extractPlugin in plugin.go (creating the target directory instead of creating a temp one and renaming it after successfull extraction) works but it's a bit dirty.