mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-07-06 04:58:01 -05:00
macOS: honor the CheckFilesystem repair flag (#1791)
CoreMacOSX::CheckFilesystem() ignored both its mountedVolume and repair arguments and always just launched Disk Utility.app, so the "Check Filesystem" and "Repair Filesystem" menu items behaved identically and neither acted on the mounted volume. On Linux/BSD the same operation runs fsck and honors the flag (passing -n only when repair is false). Run diskutil on the VeraCrypt virtual device, choosing verifyVolume or repairVolume per the flag (diskutil unmounts the inner filesystem itself as needed). The Core layer has no GUI, so the result is shown in a Terminal window via a temporary .command script; it falls back to launching Disk Utility.app when no virtual device is available. Run the macOS check in the unprivileged application process. VeraCrypt does not need to create or launch the helper script from the elevated core service: diskutil operates on the mounted virtual device and macOS handles any device authorization requirements. Once a device-hosted mount has started the elevated core service, every later service request is routed to that root process. There it would create the helper script as root (0700) and open a Terminal in the GUI session that the user could neither read nor execute. CoreServiceProxy::CheckFilesystem now invokes the core implementation directly on macOS instead of sending a service request, so the script is always owned by the GUI user. The device path is strictly validated as /dev/[r]diskN[sM] before being single-quoted into the command. The helper script is created securely in the per-user temp directory via mkstemps() (atomic O_EXCL/0600, fchmod 0700 by descriptor, close() checked for deferred write errors, unlinked on any failure) rather than at a predictable, enumerable path in the world-writable /tmp, guarding against a symlink/race on the executed script. A trap removes the script on exit even if the window is closed early, and it is also unlinked if launching Terminal fails. The script captures $? so diskutil's result, including failures, is shown before the script exits. Replace the macOS pre-check message (which still told the user Disk Utility would open and to pick Verify/Repair manually) with check- and repair-specific text describing the new automatic diskutil flow. Seed the two new strings into all translation files with the English text so the XML key-completeness check passes; localization can follow. Co-authored-by: Damian Rickard <damian@rickard.us>
This commit is contained in:
@@ -1498,6 +1498,8 @@
|
||||
<entry lang="ca" key="LINUX_REMOUNT_BECAUSEOF_SETTING">Tingueu en compte que els volums muntats actualment s'han de tornar a muntar abans que puguin utilitzar aquesta configuració.</entry>
|
||||
<entry lang="ca" key="LINUX_UNKNOWN_EXC_OCCURRED">S'ha produït una excepció desconeguda.</entry>
|
||||
<entry lang="ca" key="LINUX_FIRST_AID">"La Utilitat de disc s'iniciarà després de prémer "D'acord".\n\nSeleccioneu el vostre volum a la finestra Utilitat de disc i premeu el botó "Verifica el disc" o "Repara el disc" a la pàgina "Primers auxilis".</entry>
|
||||
<entry lang="en" key="MACOSX_CHECK_FILESYS">A Terminal window will open after you press 'OK' and check the file system on the selected VeraCrypt volume using 'diskutil'. The result will be shown in that window.\n\nIf the check cannot be started, Disk Utility will be launched instead.</entry>
|
||||
<entry lang="en" key="MACOSX_REPAIR_FILESYS">A Terminal window will open after you press 'OK' and attempt to repair the file system on the selected VeraCrypt volume using 'diskutil'. The result will be shown in that window.\n\nIf the repair cannot be started, Disk Utility will be launched instead.</entry>
|
||||
<entry lang="ca" key="LINUX_MOUNT_ALL_DEV">Munta tots els dispositius</entry>
|
||||
<entry lang="ca" key="LINUX_ERROR_LOADING_CONFIG">S'ha produït un error en carregar els fitxers de configuració que es troben a </entry>
|
||||
<entry lang="ca" key="LINUX_SELECT_FREE_SLOT">Seleccioneu una ranura d'unitat lliure de la llista.</entry>
|
||||
|
||||
Reference in New Issue
Block a user