Squirrel / Squirrel/Squirrel.Mac
The file "ShipItState.plist" couldn’t be opened because there is no such file
Nobody has claimed this yet.
- Dominant language
- Objective-C
- Stars
- 1.7k
- Forks
- 140
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 2
Description
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: https://github.com/atom/atom/issues/2860#issuecomment-121111312
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)];
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in SQRLUpdater.m, then inspect the ShipIt_stderr.log and ShipItState.plist permission and ownership behavior described in the report. Trace the privileged versus nonprivileged launch decision and verify that updates can read the state file and complete without manually chowning the log files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, objective-c
- Domain
- desktop, release
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100