Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Name in Intel Software the job files Peel couldn't read

Țugui Dragoșd182f8b302f8
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
index 1025b3f3..4be331c3 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
@@ -199,7 +199,13 @@ public enum IntelInspector {
// A job or a command that runs what is listed already, or something inside it, is that code's, and a job is
// named on its row.
var listed = findings.map { PathPattern.comparablePath(of: $0.url) }
+ unreadable += backgroundItems.unreadableFolders
for item in backgroundItems.items where !Task.isCancelled {
+ // Peel can't tell what a job file it can't read runs, which may be Intel only.
+ if item.isClosedToPeel, item.program == nil, let plist = item.plistURL {
+ unreadable.append(plist)
+ continue
+ }
guard let program = item.program.map({ URL(filePath: $0) }), !exclusions.excludes(program) else { continue }
let path = PathPattern.comparablePath(of: program)
if let index = listed.firstIndex(where: { PathComponents.isPath(path, atOrInside: $0) }) {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
index d1465895..364cb17c 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
@@ -605,4 +605,35 @@ struct IntelInspectorTests {
#expect(!scan.needsFullDiskAccess)
#expect(scan.unansweredJobs == [.daemon])
}
+
+ @Test func namesTheJobFilesItCouldNotRead() async throws {
+ let directory = try TemporaryDirectory()
+ let daemons = directory.url.appending(path: "root/Library/LaunchDaemons", directoryHint: .isDirectory)
+ let agents = directory.url.appending(path: "home/Library/LaunchAgents", directoryHint: .isDirectory)
+ func job(_ label: String) -> BackgroundItem {
+ BackgroundItem(
+ label: label, kind: .daemon, source: .systemLibrary, plistURL: daemons.appending(path: "\(label).plist"),
+ program: nil, runsAtLoad: nil, keepsAlive: nil, ownerBundleIdentifier: nil, ownerName: nil,
+ ownerURL: nil, isOrphan: false, state: .notLoaded, isDisabled: false
+ )
+ }
+ var closed = job("org.example.closed")
+ closed.isClosedToPeel = true
+ closed.isNamedByItsFile = true
+ var broken = job("org.example.broken")
+ broken.isUnreadable = true
+ broken.isNamedByItsFile = true
+
+ let scan = await IntelInspector.scan(
+ installedApps: [],
+ backgroundItems: BackgroundItems.Scan(items: [closed, broken], unreadableFolders: [agents]),
+ exclusions: .none,
+ environment: environment(in: directory),
+ measure: { _ in 1 }
+ )
+
+ let named = scan.unreadable.map(PathPattern.comparablePath(of:)).sorted()
+ let expected = [daemons.appending(path: "org.example.closed.plist"), agents]
+ #expect(named == expected.map(PathPattern.comparablePath(of:)).sorted(), "what launchd can't load runs nothing")
+ }
}