-
-
Notifications
You must be signed in to change notification settings - Fork 104
Description
OS
NixOS 25.05
Programming Language
C++
VPK Version
Velopack CLI 0.0.1369-g1d5c984 (prerelease)
Library Version
vpk = pkgs.buildDotnetGlobalTool { pname = "vpk"; version = "0.0.1369-g1d5c984"; nugetSha256 = "sha256-8XR8AmaDVjmF+/7XtdJiar/xpzrjk+h/7sOavsf0ozQ="; # dotnet-sdk = pkgs.dotnetCorePackages.dotnet_8.sdk; dotnet-runtime = pkgs.dotnetCorePackages.runtime_8_0; };
What happened?
vpk fails to create AppImage, as it does not have write permissions under a temporary directory structure it creates.
vpk writes to TempUtil.GetTempDirectory under the System temp directory (and it does not respect TMPDIR).
In AppImageTool.CreateLinuxAppImage (AppImageTool.cs) it does:
logger.Info($"Creating AppImage with {Path.GetFileName(runtime)} runtime");
File.Copy(runtime, outputFile, true);
using var outputfs = File.Open(outputFile, FileMode.Append);however if the bundled runtime file is read-only (common for vendored artifacts and necessary under NixOS /nix/store), File.Copy preserves the mode and File.Open(...Append) immediately fails with EACCES.
vpk chmod's at the end, not before append.
Suggested fix right after File.Copy
// ensure owner-writable before appending squashfs
try { System.IO.File.SetUnixFileMode(outputFile, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute | UnixFileMode.GroupRead | UnixFileMode.GroupExecute | UnixFileMode.OtherRead | UnixFileMode.OtherExecute); } catch {}Additionally, while debugging I noticed seems TempUtil likely ignores TMPDIR env parameter i.e VPK_LOG=trace TMPDIR="$HOME/.tmp/velopack" env -u SOURCE_DATE_EPOCH vpk ...
Relevant log output
[13:58:18 INF] Velopack CLI 0.0.1369-g1d5c984 (prerelease), for distributing applications.
[13:58:18 INF] Beginning to package Velopack release 0.0.1.
[13:58:18 INF] Releases Directory: /home/j/experiments/test-velopack/Releases
[13:58:18 INF] Starting: Pre-process steps
[13:58:18 INF] Pack directory ends with .AppDir, will skip building new one.
[13:58:18 INF] Complete: Pre-process steps
[13:58:18 INF] Starting: Building portable package
[13:58:18 INF] Compressing AppDir into squashfs filesystem
[13:58:19 INF] Creating AppImage with appimagekit-runtime-x86_64 runtime
[13:58:19 FTL] Access to the path '/tmp/velopack/temp.2/com.test.app.AppImage' is denied.
System.UnauthorizedAccessException: Access to the path '/tmp/velopack/temp.2/com.test.app.AppImage' is denied.
---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.File.Open(String path, FileMode mode)
at Velopack.Packaging.Unix.AppImageTool.CreateLinuxAppImage(String appDir, String outputFile, RuntimeCpu machine, ILogger logger, String compression) in ./vpk/Velopack.Packaging.Unix/AppImageTool.cs:line 90
at Velopack.Packaging.Unix.Commands.LinuxPackCommandRunner.CreatePortablePackage(Action`1 progress, String packDir, String outputPath) in ./vpk/Velopack.Packaging.Unix/Commands/LinuxPackCommandRunner.cs:line 111
at Velopack.Packaging.PackageBuilder`1.<>c__DisplayClass26_0.<<Run>b__3>d.MoveNext() in ./vpk/Velopack.Packaging/PackageBuilder.cs:line 134
--- End of stack trace from previous location ---
at Velopack.Vpk.Logging.BasicConsole.Progress.RunTask(String name, Func`2 fn) in ./vpk/Velopack.Vpk/Logging/BasicConsole.cs:line 60
at Velopack.Packaging.PackageBuilder`1.<>c__DisplayClass26_0.<<Run>b__0>d.MoveNext() in ./vpk/Velopack.Packaging/PackageBuilder.cs:line 139
--- End of stack trace from previous location ---
at Velopack.Vpk.Logging.BasicConsole.ExecuteProgressAsync(Func`2 action) in ./vpk/Velopack.Vpk/Logging/BasicConsole.cs:line 26
at Velopack.Packaging.PackageBuilder`1.Run(T options) in ./vpk/Velopack.Packaging/PackageBuilder.cs:line 109
at Velopack.Vpk.ProgramCommandExtensions.<>c__DisplayClass3_0`2.<<Add>b__0>d.MoveNext() in ./vpk/Velopack.Vpk/Program.cs:line 272