macOS `ps` gives bundle identifier instead of path for some XPC services
My macOS app can launch a faceless helper application which is shipped in its Contents/Library/LoginItems
using Apple's Service Management Framework, as described in Apple documentation. Funny thing is, when I request the unix ps
program to give me the command/paths, for this helper process, it gives the bundle identifier instead. Example:
jk$ ps -x -o command
...
com.mycompany.MyAgent
...
It gives me the same answer with or without the -c
option on ps
.
Because my app comes in several flavors and versions which each contain different helpers, and because users may have multiple installations, and because of the sometimes strange behavior of Launch Services, for self-testing and diagnostic purposes, I would like to get the path to the running helper's package or executable.
Why does ps
give the bundle identifier instead? How can I get the path?
macos xpc launch-services
add a comment |
My macOS app can launch a faceless helper application which is shipped in its Contents/Library/LoginItems
using Apple's Service Management Framework, as described in Apple documentation. Funny thing is, when I request the unix ps
program to give me the command/paths, for this helper process, it gives the bundle identifier instead. Example:
jk$ ps -x -o command
...
com.mycompany.MyAgent
...
It gives me the same answer with or without the -c
option on ps
.
Because my app comes in several flavors and versions which each contain different helpers, and because users may have multiple installations, and because of the sometimes strange behavior of Launch Services, for self-testing and diagnostic purposes, I would like to get the path to the running helper's package or executable.
Why does ps
give the bundle identifier instead? How can I get the path?
macos xpc launch-services
add a comment |
My macOS app can launch a faceless helper application which is shipped in its Contents/Library/LoginItems
using Apple's Service Management Framework, as described in Apple documentation. Funny thing is, when I request the unix ps
program to give me the command/paths, for this helper process, it gives the bundle identifier instead. Example:
jk$ ps -x -o command
...
com.mycompany.MyAgent
...
It gives me the same answer with or without the -c
option on ps
.
Because my app comes in several flavors and versions which each contain different helpers, and because users may have multiple installations, and because of the sometimes strange behavior of Launch Services, for self-testing and diagnostic purposes, I would like to get the path to the running helper's package or executable.
Why does ps
give the bundle identifier instead? How can I get the path?
macos xpc launch-services
My macOS app can launch a faceless helper application which is shipped in its Contents/Library/LoginItems
using Apple's Service Management Framework, as described in Apple documentation. Funny thing is, when I request the unix ps
program to give me the command/paths, for this helper process, it gives the bundle identifier instead. Example:
jk$ ps -x -o command
...
com.mycompany.MyAgent
...
It gives me the same answer with or without the -c
option on ps
.
Because my app comes in several flavors and versions which each contain different helpers, and because users may have multiple installations, and because of the sometimes strange behavior of Launch Services, for self-testing and diagnostic purposes, I would like to get the path to the running helper's package or executable.
Why does ps
give the bundle identifier instead? How can I get the path?
macos xpc launch-services
macos xpc launch-services
edited Nov 14 '18 at 20:47
Jerry Krinock
asked Nov 14 '18 at 20:06
Jerry KrinockJerry Krinock
1,6171620
1,6171620
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
A program can a) rewrite the memory pointed to by argv
and the strings it points to, and/or b) call setprogname()
.
I seem to recall that setprogname()
does not affect the output of ps
, but rewriting argv
does. I could have that backwards, though. I know that Wine does both and affects the command that ps
sees.
Wow, that is wild, Ken. My helper app certainly does not touchargv
nor callsetprogname()
. However, this is interesting, because certainly such manipulations are somehow within the powers of Apple's launchd.
– Jerry Krinock
Nov 15 '18 at 1:07
Launchd might do it. So might XPC in the launched service, somehow.
– Ken Thomases
Nov 15 '18 at 4:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307987%2fmacos-ps-gives-bundle-identifier-instead-of-path-for-some-xpc-services%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A program can a) rewrite the memory pointed to by argv
and the strings it points to, and/or b) call setprogname()
.
I seem to recall that setprogname()
does not affect the output of ps
, but rewriting argv
does. I could have that backwards, though. I know that Wine does both and affects the command that ps
sees.
Wow, that is wild, Ken. My helper app certainly does not touchargv
nor callsetprogname()
. However, this is interesting, because certainly such manipulations are somehow within the powers of Apple's launchd.
– Jerry Krinock
Nov 15 '18 at 1:07
Launchd might do it. So might XPC in the launched service, somehow.
– Ken Thomases
Nov 15 '18 at 4:13
add a comment |
A program can a) rewrite the memory pointed to by argv
and the strings it points to, and/or b) call setprogname()
.
I seem to recall that setprogname()
does not affect the output of ps
, but rewriting argv
does. I could have that backwards, though. I know that Wine does both and affects the command that ps
sees.
Wow, that is wild, Ken. My helper app certainly does not touchargv
nor callsetprogname()
. However, this is interesting, because certainly such manipulations are somehow within the powers of Apple's launchd.
– Jerry Krinock
Nov 15 '18 at 1:07
Launchd might do it. So might XPC in the launched service, somehow.
– Ken Thomases
Nov 15 '18 at 4:13
add a comment |
A program can a) rewrite the memory pointed to by argv
and the strings it points to, and/or b) call setprogname()
.
I seem to recall that setprogname()
does not affect the output of ps
, but rewriting argv
does. I could have that backwards, though. I know that Wine does both and affects the command that ps
sees.
A program can a) rewrite the memory pointed to by argv
and the strings it points to, and/or b) call setprogname()
.
I seem to recall that setprogname()
does not affect the output of ps
, but rewriting argv
does. I could have that backwards, though. I know that Wine does both and affects the command that ps
sees.
answered Nov 15 '18 at 0:10
Ken ThomasesKen Thomases
70.3k670107
70.3k670107
Wow, that is wild, Ken. My helper app certainly does not touchargv
nor callsetprogname()
. However, this is interesting, because certainly such manipulations are somehow within the powers of Apple's launchd.
– Jerry Krinock
Nov 15 '18 at 1:07
Launchd might do it. So might XPC in the launched service, somehow.
– Ken Thomases
Nov 15 '18 at 4:13
add a comment |
Wow, that is wild, Ken. My helper app certainly does not touchargv
nor callsetprogname()
. However, this is interesting, because certainly such manipulations are somehow within the powers of Apple's launchd.
– Jerry Krinock
Nov 15 '18 at 1:07
Launchd might do it. So might XPC in the launched service, somehow.
– Ken Thomases
Nov 15 '18 at 4:13
Wow, that is wild, Ken. My helper app certainly does not touch
argv
nor call setprogname()
. However, this is interesting, because certainly such manipulations are somehow within the powers of Apple's launchd.– Jerry Krinock
Nov 15 '18 at 1:07
Wow, that is wild, Ken. My helper app certainly does not touch
argv
nor call setprogname()
. However, this is interesting, because certainly such manipulations are somehow within the powers of Apple's launchd.– Jerry Krinock
Nov 15 '18 at 1:07
Launchd might do it. So might XPC in the launched service, somehow.
– Ken Thomases
Nov 15 '18 at 4:13
Launchd might do it. So might XPC in the launched service, somehow.
– Ken Thomases
Nov 15 '18 at 4:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307987%2fmacos-ps-gives-bundle-identifier-instead-of-path-for-some-xpc-services%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown