{"action":"created","issue":{"url":"https://api.github.com/repos/sarugaku/shellingham/issues/14","repository_url":"https://api.github.com/repos/sarugaku/shellingham","labels_url":"https://api.github.com/repos/sarugaku/shellingham/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/sarugaku/shellingham/issues/14/comments","events_url":"https://api.github.com/repos/sarugaku/shellingham/issues/14/events","html_url":"https://github.com/sarugaku/shellingham/issues/14","id":368984618,"node_id":"MDU6SXNzdWUzNjg5ODQ2MTg=","number":14,"title":"Investigate command line parsing logic of `ps` output","user":{"login":"uranusjr","id":605277,"node_id":"MDQ6VXNlcjYwNTI3Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/605277?v=4","gravatar_id":"","url":"https://api.github.com/users/uranusjr","html_url":"https://github.com/uranusjr","followers_url":"https://api.github.com/users/uranusjr/followers","following_url":"https://api.github.com/users/uranusjr/following{/other_user}","gists_url":"https://api.github.com/users/uranusjr/gists{/gist_id}","starred_url":"https://api.github.com/users/uranusjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uranusjr/subscriptions","organizations_url":"https://api.github.com/users/uranusjr/orgs","repos_url":"https://api.github.com/users/uranusjr/repos","events_url":"https://api.github.com/users/uranusjr/events{/privacy}","received_events_url":"https://api.github.com/users/uranusjr/received_events","type":"User","site_admin":false},"labels":[{"id":965132136,"node_id":"MDU6TGFiZWw5NjUxMzIxMzY=","url":"https://api.github.com/repos/sarugaku/shellingham/labels/help%20wanted","name":"help wanted","color":"008672","default":true},{"id":965132139,"node_id":"MDU6TGFiZWw5NjUxMzIxMzk=","url":"https://api.github.com/repos/sarugaku/shellingham/labels/question","name":"question","color":"d876e3","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-11T07:20:02Z","updated_at":"2018-11-05T09:49:19Z","closed_at":null,"author_association":"MEMBER","body":"From #12. Is there a specification on how `ps` formats the command line if it contains special characters (spaces in argument, quotes, etc.)? It seems that it is not using the “normal” shell escaping syntax, which makes the it unsuitable to parse with `shlex.split()`."},"comment":{"url":"https://api.github.com/repos/sarugaku/shellingham/issues/comments/435814937","html_url":"https://github.com/sarugaku/shellingham/issues/14#issuecomment-435814937","issue_url":"https://api.github.com/repos/sarugaku/shellingham/issues/14","id":435814937,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTgxNDkzNw==","user":{"login":"uranusjr","id":605277,"node_id":"MDQ6VXNlcjYwNTI3Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/605277?v=4","gravatar_id":"","url":"https://api.github.com/users/uranusjr","html_url":"https://github.com/uranusjr","followers_url":"https://api.github.com/users/uranusjr/followers","following_url":"https://api.github.com/users/uranusjr/following{/other_user}","gists_url":"https://api.github.com/users/uranusjr/gists{/gist_id}","starred_url":"https://api.github.com/users/uranusjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uranusjr/subscriptions","organizations_url":"https://api.github.com/users/uranusjr/orgs","repos_url":"https://api.github.com/users/uranusjr/repos","events_url":"https://api.github.com/users/uranusjr/events{/privacy}","received_events_url":"https://api.github.com/users/uranusjr/received_events","type":"User","site_admin":false},"created_at":"2018-11-05T09:49:19Z","updated_at":"2018-11-05T09:49:19Z","author_association":"MEMBER","body":"https://github.com/freebsd/freebsd/blob/d843b0f4abd4782caf9abffd5f7628b51d65d541/bin/ps/fmt.c#L83-L93\r\n\r\nHeh that’s interesting. If I’m reading it right, `ps` only escapes newlines and unprintable characters, *but separate arguments with spaces*. So a command line like this `cmd foo 'bar baz'` would be reported as `cmd foo bar baz`, and there’s no way to unambigiously tell what is what.\r\n\r\nI guess all we can do is to split with space, and hope for the best. Or maybe we forgo `ps` altogether and tap into POSIX C API directly. We already do that for Windows anyway."}}
{"actor":{"display_login":"uranusjr"}}