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.

Tell a job file Peel can't read from one macOS can't load

Țugui Dragoșa521ffc6ee88
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index a7a43175..fef83899 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -114334,6 +114334,112 @@
}
}
},
+ "Peel can’t read its file" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nemůže přečíst její soubor"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel kann die Datei dieses Objekts nicht lesen"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no puede leer su archivo"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel ne peut pas lire son fichier"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non riesce a leggere il suo file"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはこの項目のファイルを読み取れません"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 파일을 읽을 수 없음"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel kan het bestand niet lezen"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nie może odczytać pliku tej rzeczy"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não consegue ler o arquivo dele"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu îi poate citi fișierul"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не может прочитать его файл"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel kan inte läsa filen"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bu öğenin dosyasını okuyamıyor"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не може прочитати його файл"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel无法读取它的文件"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel無法讀取它的檔案"
+ }
+ }
+ }
+ },
"Peel can’t read its list of app folders, so Orphaned Files lists nothing. Starting over keeps the old list beside a new one." : {
"localizations" : {
"cs" : {
@@ -225841,6 +225947,218 @@
}
}
},
+ "macOS lets only its owner read it, so Peel can’t tell what it runs." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Systém macOS ho dovoluje číst jen jeho vlastníkovi, takže Peel nemůže zjistit, co položka spouští."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS erlaubt nur dem Eigentümer der Datei, sie zu lesen, daher kann Peel nicht erkennen, was dieses Objekt ausführt."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS solo deja que lo lea su propietario, así que Peel no puede saber qué ejecuta."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS n’autorise que son propriétaire à lire ce fichier : Peel ne peut donc pas savoir ce que cet élément exécute."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS consente di leggerlo solo al suo proprietario, quindi Peel non può sapere cosa esegue."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOSでは所有者しかこのファイルを読み取れないため、Peelには何が実行されるのかわかりません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS가 소유자만 이 파일을 읽을 수 있게 하므로 Peel은 이 항목이 무엇을 실행하는지 알 수 없습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS laat alleen de eigenaar het bestand lezen, dus Peel kan niet zien wat dit onderdeel uitvoert."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS pozwala odczytać go tylko jego właścicielowi, więc Peel nie może ustalić, co ta rzecz uruchamia."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O macOS só deixa o proprietário do arquivo lê-lo, então o Peel não sabe dizer o que este item executa."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS îi permite doar proprietarului să îl citească, așa că Peel nu poate ști ce rulează."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS разрешает читать этот файл только его владельцу, поэтому Peel не может сказать, что запускает этот объект."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS låter bara ägaren läsa den, så Peel kan inte avgöra vad jobbet kör."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS bu dosyayı yalnızca sahibinin okumasına izin veriyor, bu yüzden Peel öğenin neyi çalıştırdığını bilemiyor."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS дозволяє читати цей файл лише його власникові, тож Peel не може визначити, що запускає цей елемент."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS只允许其所有者读取它,因此Peel无法判断它运行什么。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS只允許它的擁有者讀取它,因此Peel無法判斷它會執行什麼。"
+ }
+ }
+ }
+ },
+ "macOS lets only its owner read it, so what Peel shows here is what macOS says of the job it loaded from it." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Systém macOS ho dovoluje číst jen jeho vlastníkovi, takže Peel tu zobrazuje to, co systém macOS uvádí o úloze, kterou z něj načetl."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS erlaubt nur dem Eigentümer der Datei, sie zu lesen, daher zeigt Peel hier, was macOS über den daraus geladenen Job mitteilt."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS solo deja que lo lea su propietario, así que lo que Peel muestra aquí es lo que macOS dice de la tarea que cargó desde él."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS n’autorise que son propriétaire à lire ce fichier : ce que Peel affiche ici est donc ce que macOS indique de la tâche qu’il a chargée à partir de celui-ci."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS consente di leggerlo solo al suo proprietario, quindi ciò che Peel mostra qui è ciò che macOS dice dell’elemento che ha caricato da quel file."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOSでは所有者しかこのファイルを読み取れないため、ここでPeelが表示しているのは、macOSがこのファイルから読み込んだジョブについて報告している内容です。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS가 소유자만 이 파일을 읽을 수 있게 하므로, Peel이 여기에 표시하는 내용은 macOS가 이 파일에서 로드한 작업에 대해 알려 주는 내용입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS laat alleen de eigenaar het bestand lezen, dus wat Peel hier toont, is wat macOS meldt over de taak die het eruit heeft geladen."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS pozwala odczytać go tylko jego właścicielowi, więc Peel pokazuje tutaj to, co macOS podaje o zadaniu, które z niego wczytał."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O macOS só deixa o proprietário do arquivo lê-lo, então o que o Peel mostra aqui é o que o macOS diz da tarefa que carregou a partir dele."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS îi permite doar proprietarului să îl citească, așa că Peel afișează aici ce spune macOS despre sarcina pe care a încărcat‑o din el."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS разрешает читать этот файл только его владельцу, поэтому здесь Peel показывает то, что macOS сообщает о задании, которое она загрузила из этого файла."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS låter bara ägaren läsa den, så det som Peel visar här är det som macOS säger om jobbet som lästes in från den."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS bu dosyayı yalnızca sahibinin okumasına izin veriyor, bu yüzden Peel’in burada gösterdikleri, macOS’in bu dosyadan yüklediği iş hakkında söyledikleridir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS дозволяє читати цей файл лише його власникові, тож тут Peel показує те, що macOS повідомляє про завдання, яке вона з нього завантажила."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS只允许其所有者读取它,因此Peel在此处显示的是macOS对它从该文件载入的任务的描述。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS只允許它的擁有者讀取它,因此Peel在這裡顯示的內容,是macOS對它從此檔案載入的工作所提供的資訊。"
+ }
+ }
+ }
+ },
"macOS makes a snapshot before it updates, so the update can be undone. It goes away by itself." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift
index 7b0dd1d6..b99e1219 100644
--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift
+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift
@@ -26,7 +26,7 @@ public struct BackgroundItem: Sendable, Hashable, Identifiable {
public let label: String
public let kind: Kind
- public let source: Source
+ public internal(set) var source: Source
public let plistURL: URL?
public let program: String?
/// Whether launchd starts the job as it loads it, and again after it exits; nil when nothing Peel can read says.
@@ -43,9 +43,13 @@ public struct BackgroundItem: Sendable, Hashable, Identifiable {
public let isDisabled: Bool
/// False when only a name points to the owner (`BackgroundItemOwnership.Owner.isConfirmed`).
public var isOwnerConfirmed = true
- /// True for a file launchd can't load: not a property list, or one without a `Label`. It is named by its file,
- /// and nothing but moving it is offered.
+ /// True for a file launchd can't load: not a property list, or one without a `Label`.
public var isUnreadable = false
+ /// True for a file macOS lets only its owner read, as launchd does as root: what Peel knows of its job comes from
+ /// launchd, and until launchd says which job it loaded from the file, the row is named by the file.
+ public var isClosedToPeel = false
+ /// True for a row named by its file, since Peel couldn't read the label inside: nothing but moving it is offered.
+ public var isNamedByItsFile = false
/// What in the job's command is worth a second look, if anything.
public var unusualCommand: UnusualCommand?
/// True for an agent its file limits to the Background session, which launchd keeps in the user domain rather
diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift
index e92745e6..6843d27f 100644
--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift
+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift
@@ -77,7 +77,7 @@ public enum BackgroundItems {
return results
}
let undeclared = merged(found, loaded: loaded)
- items += undeclared.items
+ items = placing(undeclared.items, into: items)
items += disabledJobs(in: loaded, listed: items, ownership: ownership)
return Scan(
@@ -88,6 +88,27 @@ public enum BackgroundItems {
)
}
+ /// The rows, each job launchd loaded from a file Peel can't read in the place of that file's row, with the file's
+ /// folder as its source; then the other loaded jobs.
+ static func placing(_ loadedJobs: [BackgroundItem], into rows: [BackgroundItem]) -> [BackgroundItem] {
+ var rows = rows
+ var others: [BackgroundItem] = []
+ for job in loadedJobs {
+ let file = job.plistURL.map(PathPattern.comparablePath(of:))
+ guard let file, let index = rows.firstIndex(where: {
+ $0.isClosedToPeel && $0.isNamedByItsFile && $0.plistURL.map(PathPattern.comparablePath(of:)) == file
+ }) else {
+ others.append(job)
+ continue
+ }
+ var placed = job
+ placed.source = rows[index].source
+ placed.isClosedToPeel = true
+ rows[index] = placed
+ }
+ return rows + others
+ }
+
/// The items among what `launchctl` said of each undeclared job, and the kinds some of whose jobs may be missing:
/// those `loaded` could not read, and those of a job whose answer could not be read.
static func merged(
@@ -112,8 +133,9 @@ public enum BackgroundItems {
declared items: [BackgroundItem],
uid: uid_t
) -> [(label: String, kind: BackgroundItem.Kind, target: String)] {
- // By kind and label: an item's `id` also holds its file's path, which a loaded job does not report.
- let known = Set(items.map { "\($0.kind.rawValue)/\($0.label)" })
+ // By kind and label: an item's `id` also holds its file's path, which a loaded job does not report. A file
+ // Peel can't read names no label, so whatever job launchd loaded from it is asked about too.
+ let known = Set(items.filter { !$0.isClosedToPeel }.map { "\($0.kind.rawValue)/\($0.label)" })
let candidates: [(label: String, kind: BackgroundItem.Kind, target: String)] =
(loaded.user ?? [:]).keys.map { label in
(label, .agent, "\(loaded.isInTheUserDomain(label) ? "user" : "gui")/\(uid)/\(label)")
@@ -230,7 +252,11 @@ public enum BackgroundItems {
// A label of macOS's own is shown too, and marked (`usesALabelOfMacOS`): macOS keeps its jobs
// elsewhere, so a file here that borrows one is somebody else's, and a common way to hide a job.
guard let job = JobDefinition(contentsOf: plist) else {
- items.append(unreadable(plist, kind: kind, source: source, ownership: ownership))
+ items.append(
+ FileAccess.isClosedToReading(plist)
+ ? closed(plist, kind: kind, source: source, ownership: ownership, loaded: loaded)
+ : unreadable(plist, kind: kind, source: source, ownership: ownership)
+ )
continue
}
let owner = ownership.owner(label: job.label, associated: job.associated, program: job.program)
@@ -263,7 +289,7 @@ public enum BackgroundItems {
static func settlingSharedLabels(
_ items: [BackgroundItem], loadedFrom: (BackgroundItem) async -> String?
) async -> [BackgroundItem] {
- let declared = items.indices.filter { items[$0].plistURL != nil && !items[$0].isUnreadable }
+ let declared = items.indices.filter { items[$0].plistURL != nil && !items[$0].isNamedByItsFile }
let shared = Dictionary(grouping: declared) { "\(items[$0].kind.rawValue)/\(items[$0].label)" }
.values.filter { $0.count > 1 }
var settled = items
@@ -304,7 +330,40 @@ public enum BackgroundItems {
state: .notLoaded,
isDisabled: false,
isOwnerConfirmed: owner?.isConfirmed ?? false,
- isUnreadable: true
+ isUnreadable: true,
+ isNamedByItsFile: true
+ )
+ }
+
+ /// A job file macOS lets only its owner read, named by its file until launchd says which job it loaded from it.
+ /// What it runs is not known, so it is never called orphaned, and it is said not loaded only when no job runs
+ /// under its name.
+ private static func closed(
+ _ plist: URL,
+ kind: BackgroundItem.Kind,
+ source: BackgroundItem.Source,
+ ownership: BackgroundItemOwnership,
+ loaded: Loaded
+ ) -> BackgroundItem {
+ let name = plist.deletingPathExtension().lastPathComponent
+ let owner = ownership.owner(label: name, associated: [], program: nil)
+ return BackgroundItem(
+ label: name,
+ kind: kind,
+ source: source,
+ plistURL: plist,
+ program: nil,
+ runsAtLoad: nil,
+ keepsAlive: nil,
+ ownerBundleIdentifier: owner?.bundleIdentifier,
+ ownerName: owner?.name,
+ ownerURL: owner?.url,
+ isOrphan: false,
+ state: loaded.state(of: name, kind) == .notLoaded ? .notLoaded : .unknown,
+ isDisabled: loaded.override(of: name, kind) ?? false,
+ isOwnerConfirmed: owner?.isConfirmed ?? false,
+ isClosedToPeel: true,
+ isNamedByItsFile: true
)
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Support/FileAccess.swift b/Packages/PeelCore/Sources/PeelCore/Support/FileAccess.swift
index 49a5f6dc..69604263 100644
--- a/Packages/PeelCore/Sources/PeelCore/Support/FileAccess.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Support/FileAccess.swift
@@ -20,6 +20,11 @@ public enum FileAccess {
accessError == EPERM && !isLocked
}
+ /// Whether `url` is there and this process may not read it, as a file only its owner reads (`access(2)`).
+ static func isClosedToReading(_ url: URL) -> Bool {
+ access(url.path(percentEncoded: false), R_OK) != 0 && (errno == EACCES || errno == EPERM)
+ }
+
static func isARealFolder(_ url: URL) -> Bool {
var info = stat()
return lstat(url.path(percentEncoded: false), &info) == 0 && info.st_mode & S_IFMT == S_IFDIR
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
index 6d732233..e0516946 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
@@ -656,6 +656,68 @@ struct DeclaredBackgroundItemsTests {
#expect(items.filter { !$0.isUnreadable }.map(\.label) == ["org.example.agent"])
}
+ @Test(.permissionsHold) func namesAJobFilePeelCannotReadForWhatItIs() throws {
+ let directory = try TemporaryDirectory()
+ let closed = "home/Library/LaunchAgents/org.example.closed.plist"
+ try directory.file(closed, contents: job("org.example.agent", program: "/bin/sh"))
+ try directory.setPermissions(0, of: closed)
+ try directory.file("home/Library/LaunchAgents/org.example.broken.plist", contents: Data("<plist".utf8))
+
+ let items = BackgroundItems.declared(
+ in: environment(directory), ownership: BackgroundItemOwnership(installedApps: [])
+ )
+
+ let unread = try #require(items.first { $0.label == "org.example.closed" })
+ #expect(unread.isClosedToPeel && unread.isNamedByItsFile)
+ #expect(!unread.isUnreadable, "launchd reads it as root, so nothing says macOS can't load it")
+ #expect(!unread.isOrphan, "what it runs is not known")
+ #expect(unread.state == .notLoaded)
+ let broken = try #require(items.first { $0.label == "org.example.broken" })
+ #expect(broken.isUnreadable && !broken.isClosedToPeel)
+ }
+
+ @Test func asksLaunchdWhichJobAFilePeelCannotReadLoaded() {
+ var closed = BackgroundItem(
+ label: "org.example.closed", kind: .agent, source: .userLibrary,
+ plistURL: URL(filePath: "/org.example/LaunchAgents/org.example.closed.plist"), program: nil,
+ runsAtLoad: nil, keepsAlive: nil, ownerBundleIdentifier: nil, ownerName: nil, ownerURL: nil,
+ isOrphan: false, state: .unknown, isDisabled: false
+ )
+ closed.isClosedToPeel = true
+ closed.isNamedByItsFile = true
+ let loaded = BackgroundItems.Loaded(user: ["org.example.closed": 42])
+
+ #expect(BackgroundItems.undeclared(in: loaded, declared: [closed], uid: 501).map(\.label) == ["org.example.closed"])
+ }
+
+ @Test func aJobLoadedFromAFilePeelCannotReadTakesItsRow() {
+ func item(
+ _ label: String, _ source: BackgroundItem.Source, _ plist: String, program: String? = nil
+ ) -> BackgroundItem {
+ BackgroundItem(
+ label: label, kind: .daemon, source: source, plistURL: URL(filePath: plist), program: program,
+ runsAtLoad: nil, keepsAlive: nil, ownerBundleIdentifier: nil, ownerName: nil, ownerURL: nil,
+ isOrphan: false, state: .running(pid: 7), isDisabled: false
+ )
+ }
+ var closed = item("org.example.closed", .systemLibrary, "/Library/LaunchDaemons/org.example.closed.plist")
+ closed.state = .unknown
+ closed.isClosedToPeel = true
+ closed.isNamedByItsFile = true
+ let fromIt = item(
+ "org.example.daemon", .otherFile, "/Library/LaunchDaemons/org.example.closed.plist",
+ program: "/usr/local/bin/org.example.daemon"
+ )
+ let elsewhere = item("org.example.stray", .otherFile, "/org.example/org.example.stray.plist")
+
+ let rows = BackgroundItems.placing([fromIt, elsewhere], into: [closed])
+
+ #expect(rows.map(\.label) == ["org.example.daemon", "org.example.stray"])
+ #expect(rows.first?.source == .systemLibrary, "launchd loaded it from its own folder, not from elsewhere")
+ #expect(rows.first?.isClosedToPeel == true && rows.first?.isNamedByItsFile == false)
+ #expect(rows.last?.source == .otherFile && rows.last?.isClosedToPeel == false)
+ }
+
/// macOS keeps its own jobs under `/System/Library` and `/Library/Apple/System/Library`, so a file in these
/// folders that uses one of their labels, or any `com.apple.` label, is not macOS's. A label names a job only
/// in its own domain, so such a copy runs beside the real one: it is listed, marked, and never acted on.
diff --git a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
index 6a95a74c..4d9e421d 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
@@ -201,6 +201,16 @@ struct BackgroundItemDetailView: View {
kind: .note
) {}
}
+ } else if item.isClosedToPeel {
+ Section {
+ Notice(
+ title: Text("Peel can’t read its file"),
+ detail: item.isNamedByItsFile
+ ? Text("macOS lets only its owner read it, so Peel can’t tell what it runs.")
+ : Text("macOS lets only its owner read it, so what Peel shows here is what macOS says of the job it loaded from it."),
+ kind: .note
+ ) {}
+ }
} else if item.state == .unknown {
Section {
Notice(
@@ -365,10 +375,11 @@ struct BackgroundItemDetailView: View {
}
/// Start, Stop, Enable, and Disable, which a job Peel may not control, a job whose state Peel could not read, a
- /// file macOS can't load, and a file whose label launchd runs from another file don't have. A job loaded from a
- /// file elsewhere has only Stop. A job Peel may not disable has only Enable, while launchd keeps it disabled.
+ /// file named by itself since its label couldn't be read, and a file whose label launchd runs from another file
+ /// don't have. A job loaded from a file elsewhere has only Stop. A job Peel may not disable has only Enable, while
+ /// launchd keeps it disabled.
private var hasOwnControls: Bool {
- guard item.canBeControlled, item.state != .unknown, !item.isUnreadable, !item.anotherFileIsLoaded else {
+ guard item.canBeControlled, item.state != .unknown, !item.isNamedByItsFile, !item.anotherFileIsLoaded else {
return false
}
if item.canOnlyBeStopped { return true }
diff --git a/Peel/Views/BackgroundItems/BackgroundItemList.swift b/Peel/Views/BackgroundItems/BackgroundItemList.swift
index 10132edb..4cfd6305 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemList.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemList.swift
@@ -192,6 +192,11 @@ private struct BackgroundItemRow: View {
.font(.caption)
.foregroundStyle(.secondary)
.lineLimit(1)
+ } else if item.isClosedToPeel, item.isNamedByItsFile {
+ StatusLabel(title: Text("Peel can’t read its file"))
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .lineLimit(1)
} else if item.isFileGone {
StatusLabel(title: Text("Its file is gone"))
.font(.caption)