rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.97k stars 281 forks source link

Snapshot creation fails with very long description #5843

Open mook-as opened 1 year ago

mook-as commented 1 year ago

Actual Behavior

When a snapshot is created with a very long description, the operation fails. When done from the UI, it fails to parse the returned error.

Steps to Reproduce

  1. Run perl -e 'print "a" x 32768' and put the result in the clipboard.
  2. Create a snapshot in the UI, using the copied (32KB) text as the description.

Result

snapshot error dialog

Expected Behavior

The snapshot should be successfully created.

Additional Information

I could not duplicate this issue on macOS.

Running this on Windows (PowerShell) shows:

> rdctl snapshot create snap2 --description "$("a" * 32768)" --json
Program 'rdctl.exe' failed to run: The filename or extension is too longAt line:1 char:1
+ rdctl snapshot create snap2 --description "$("a" * 32768)" --json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:46
+ rdctl snapshot create snap2 --description "$("a" * 32768)" --json
+                                              ~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

So it's possible this has to do with maximum command line length.

Rancher Desktop Version

1.10.0-566-g9034e36d (1.11 RC1)

Rancher Desktop K8s Version

N/A

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Windows

Operating System / Build Version

Windows 11 Pro 22H2 (Build 22621.2428)

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

None.

jandubois commented 1 year ago

So it's possible this has to do with maximum command line length.

Yes, this is a limitation of the CreateProcess API:

[in, out, optional] lpCommandLine

The command line to be executed.

The maximum length of this string is 32,767 characters, including the Unicode terminating null character.

I think we should add a --description-from-stdin option as an alternative to providing it via the commandline.

jandubois commented 12 months ago

I think we should add a --description-from-stdin option as an alternative to providing it via the commandline.

This will be done by #5881, so the app should make use of it once it becomes available.