From 2dbc71822508c877d1c39efc782907de1fce51e6 Mon Sep 17 00:00:00 2001 From: Damian Rickard Date: Wed, 10 Jun 2026 16:37:32 -0400 Subject: [PATCH] Honor --no-size-check when creating file containers via the CLI The text-mode volume creation path clamps the maximum allowed volume size to the available free disk space and never consults ArgDisableFileSizeCheck, so the documented --no-size-check switch has no effect when creating a file-hosted container with `--text --create`. The flag is honored by the GUI wizard (Forms/VolumeSizeWizardPage.cpp) but was missing from the text UI, making it impossible to create a (sparse) container larger than the current free space from the command line -- even though such a container is perfectly valid on filesystems with sparse-file support (e.g. APFS, ext4, NTFS) and is exactly what the flag exists to allow. Skip the free-space clamp when --no-size-check is set, mirroring the GUI behavior. Co-Authored-By: Claude Fable 5 --- src/Main/TextUserInterface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index f8e2b1b2..46ad8954 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -766,7 +766,10 @@ namespace VeraCrypt if (options->Type == VolumeType::Normal && wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace)) { AvailableDiskSpace = (uint64) diskSpace.GetValue (); - if (maxVolumeSize > AvailableDiskSpace) + // Honor --no-size-check so a (sparse) file container larger than the + // current free space can be created from the command line, mirroring + // the GUI wizard behavior (see VolumeSizeWizardPage.cpp). + if (maxVolumeSize > AvailableDiskSpace && !CmdLine->ArgDisableFileSizeCheck) maxVolumeSize = AvailableDiskSpace; } }