In an Electron-based app, I encountered an issue where one user was unable to update. The logs in ShipIt_stderr.log showed this message over and over:
Installation error: Error Domain=SQRLShipItRequestErrorDomain Code=2 "Could not read update request" UserInfo=0x7fe4cae09930 {NSLocalizedDescription=Could not read update request, NSUnderlyingError=0x7fe4cae07d50 "The file “ShipItState.plist” couldn’t be opened because there is no such file."}
However, ShipItState.plist did exist, but the two log files had different permissions than the plist file and the update directory:
drwxr-xr-x 7 foo staff 238B Sep 9 17:16 .
drwx------+ 41 foo staff 1.4K Sep 9 17:16 ..
-rw-r--r--@ 1 foo staff 6.0K Sep 9 17:24 .DS_Store
-rw-r--r-- 1 foo staff 262B Sep 9 17:16 ShipItState.plis
-rw-r--r-- 1 root staff 195K Sep 9 16:55 ShipIt_stderr.log
-rw-r--r-- 1 root staff 0B Sep 9 16:38 ShipIt_stdout.log
drwx------ 4 foo staff 136B Sep 9 17:24 update.c3etqCW
Doing a chown fixed the issue:
sudo chown foo:staff ShipIt_stderr.log ShipIt_stdout.log
It looks like others are hitting this same issue: atom/atom#2860 (comment)
It looks like SQRLUpdater.m has some logic around running as root/non-root, but if the log files are owned by root and being updated then I would assume it's running as root and should be able to read the ShipItState.plist file that's owned by a non-privileged user:
NSError *targetWritableError = nil;
BOOL gotWritable = [targetURL getResourceValue:&targetWritable forKey:NSURLIsWritableKey error:&targetWritableError];
// If we can't determine whether it can be written, assume nonprivileged and
// wait for another, more canonical error.
return [SQRLShipItLauncher launchPrivileged:(gotWritable && !targetWritable.boolValue)];
In an Electron-based app, I encountered an issue where one user was unable to update. The logs in
ShipIt_stderr.logshowed this message over and over:However,
ShipItState.plistdid exist, but the two log files had different permissions than theplistfile and the update directory:Doing a
chownfixed the issue:It looks like others are hitting this same issue: atom/atom#2860 (comment)
It looks like
SQRLUpdater.mhas some logic around running as root/non-root, but if the log files are owned by root and being updated then I would assume it's running as root and should be able to read theShipItState.plistfile that's owned by a non-privileged user: