You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Web browser and operating system: N/A (affects macOS hosts)
💥 Actual behavior
macOS Fleet-maintained app install scripts don't check the exit code of the command that installs the app, so a failed install still exits 0 and Fleet reports it as installed successfully.
🛠️ Expected behavior
If installer -pkg or cp -R fail in the install script it should return with a failure exit code
🧑💻 Steps to reproduce
These steps:
Have been confirmed to consistently lead to reproduction in multiple Fleet instances.
Describe the workflow that led to the error, but have not yet been reproduced in multiple Fleet instances.
Add the Microsoft Excel FMA (microsoft-excel/darwin) to a fleet.
Make the install command fail while leaving the rest of the script intact — edit the installer's install script so the sudo installer -pkg line points at a filename that isn't the downloaded package (e.g. change Microsoft_Excel_16.111.26071325_Installer.pkg to Microsoft_Excel_0.0.0_Installer.pkg), keeping the trailing relaunch_application 'com.microsoft.Excel' line.
Install Excel on the host.
Check the install activity: it reports "Fleet installed Microsoft Excel" with install_script_exit_code 0, and the script output contains installer: Error - the package path specified was invalid below Fleet's "Success" line.
For the cp -R variant, do the same with Firefox (firefox/darwin), pointing the final sudo cp -R at a source path that doesn't exist.
Also reproducible via the steps in #49811 before the fix for that is merged.
🕯️ More info (optional)
Both install mechanisms the script generator emits are affected — 963 of the ~966 macOS FMA scripts. The only exceptions are 1password, logitune, and slack, which propagate the exit code by accident because the install command happens to be their last line.
hdiutil attach is guarded with || exit 1, so a mount failure is caught — but the cp -R that performs the install is not.
If the copy fails (no space, unwritable /Applications, missing source), the app isn't installed or is left partially copied.
The existing app was already moved aside to .app.bkp and is never restored, so a failed copy can leave the host with no working app.
relaunch_application follows and returns 0, so the script exits 0 and Fleet reports success.
867 of 867 cp -R scripts.
Other notes:
Both patterns come from one generator, ee/maintained-apps/ingesters/homebrew/scripts.go (installScriptForApp, InstallPkg), so the fix is per-pattern rather than per-app, plus regenerating ee/maintained-apps/outputs/*/darwin.json.
Any failure mode of the install command is hidden this way (bad path, insufficient space, corrupt package, refused signature, unwritable target). FMAs trying to install wrong version of app #49811 is one way to make the command fail; this issue is why the failure is reported as success.
Windows FMA scripts are not affected: they run the installer through Start-Process ... -Wait and Exit $installProcess.ExitCode.
Fleet versions
Web browser and operating system: N/A (affects macOS hosts)
💥 Actual behavior
macOS Fleet-maintained app install scripts don't check the exit code of the command that installs the app, so a failed install still exits 0 and Fleet reports it as installed successfully.
🛠️ Expected behavior
If
installer -pkgorcp -Rfail in the install script it should return with a failure exit code🧑💻 Steps to reproduce
These steps:
microsoft-excel/darwin) to a fleet.sudo installer -pkgline points at a filename that isn't the downloaded package (e.g. changeMicrosoft_Excel_16.111.26071325_Installer.pkgtoMicrosoft_Excel_0.0.0_Installer.pkg), keeping the trailingrelaunch_application 'com.microsoft.Excel'line.install_script_exit_code0, and the script output containsinstaller: Error - the package path specified was invalidbelow Fleet's "Success" line.For the
cp -Rvariant, do the same with Firefox (firefox/darwin), pointing the finalsudo cp -Rat a source path that doesn't exist.Also reproducible via the steps in #49811 before the fix for that is merged.
🕯️ More info (optional)
Both install mechanisms the script generator emits are affected — 963 of the ~966 macOS FMA scripts. The only exceptions are
1password,logitune, andslack, which propagate the exit code by accident because the install command happens to be their last line.Scripts that use
installer -pkg:installerexits non-zero and prints its error, but the exit code is never captured or checked.relaunch_applicationruns next and returns 0 (it returns early when the app wasn't running).installer -pkgscripts.Scripts that use
cp -R:hdiutil attachis guarded with|| exit 1, so a mount failure is caught — but thecp -Rthat performs the install is not./Applications, missing source), the app isn't installed or is left partially copied..app.bkpand is never restored, so a failed copy can leave the host with no working app.relaunch_applicationfollows and returns 0, so the script exits 0 and Fleet reports success.cp -Rscripts.Other notes:
ee/maintained-apps/ingesters/homebrew/scripts.go(installScriptForApp,InstallPkg), so the fix is per-pattern rather than per-app, plus regeneratingee/maintained-apps/outputs/*/darwin.json.Start-Process ... -WaitandExit $installProcess.ExitCode.