{"action":"created","issue":{"url":"https://api.github.com/repos/pkgcore/pkgcore/issues/104","labels_url":"https://api.github.com/repos/pkgcore/pkgcore/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/pkgcore/pkgcore/issues/104/comments","events_url":"https://api.github.com/repos/pkgcore/pkgcore/issues/104/events","html_url":"https://github.com/pkgcore/pkgcore/issues/104","id":98626112,"number":104,"title":"bash code is full of 'type -P' calls without error handling","user":{"login":"mgorny","id":110765,"avatar_url":"https://avatars.githubusercontent.com/u/110765?v=3","gravatar_id":"","url":"https://api.github.com/users/mgorny","html_url":"https://github.com/mgorny","followers_url":"https://api.github.com/users/mgorny/followers","following_url":"https://api.github.com/users/mgorny/following{/other_user}","gists_url":"https://api.github.com/users/mgorny/gists{/gist_id}","starred_url":"https://api.github.com/users/mgorny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgorny/subscriptions","organizations_url":"https://api.github.com/users/mgorny/orgs","repos_url":"https://api.github.com/users/mgorny/repos","events_url":"https://api.github.com/users/mgorny/events{/privacy}","received_events_url":"https://api.github.com/users/mgorny/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-02T18:17:04Z","updated_at":"2015-08-03T06:19:07Z","closed_at":"2015-08-02T19:46:10Z","body":"Specific case I've seen:\r\n\r\n```\r\n__filter_env() {\r\n    local opts\r\n    [[ ${PKGCORE_DEBUG} -ge 1 ]] && opts=\"--debug\"\r\n    PYTHONPATH=\"${PKGCORE_PYTHONPATH}\" \"${PKGCORE_PYTHON_BINARY}\" \\\r\n        $(type -P filter-env) ${opts} \"$@\" || die \"filter-env invocation failed\"\r\n}\r\n```\r\n\r\nHere if bash can't find `filter-env`, it spawns `python -f ...`. But if you look through the file, you'll see a lot of `type -P` calls assuming no possibility of failure."},"comment":{"url":"https://api.github.com/repos/pkgcore/pkgcore/issues/comments/127135202","html_url":"https://github.com/pkgcore/pkgcore/issues/104#issuecomment-127135202","issue_url":"https://api.github.com/repos/pkgcore/pkgcore/issues/104","id":127135202,"user":{"login":"radhermit","id":69519,"avatar_url":"https://avatars.githubusercontent.com/u/69519?v=3","gravatar_id":"","url":"https://api.github.com/users/radhermit","html_url":"https://github.com/radhermit","followers_url":"https://api.github.com/users/radhermit/followers","following_url":"https://api.github.com/users/radhermit/following{/other_user}","gists_url":"https://api.github.com/users/radhermit/gists{/gist_id}","starred_url":"https://api.github.com/users/radhermit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radhermit/subscriptions","organizations_url":"https://api.github.com/users/radhermit/orgs","repos_url":"https://api.github.com/users/radhermit/repos","events_url":"https://api.github.com/users/radhermit/events{/privacy}","received_events_url":"https://api.github.com/users/radhermit/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T06:19:07Z","updated_at":"2015-08-03T06:19:07Z","body":"On 2015-08-03 01:47, ferringb wrote:\n> ...Offhand, those type -P invocations that lack error checking are\n> using pkgcore internals.  If they're missing, a fuck ton of other\n> things will be breaking long before getting to this specific failure.\n\nYep, basically what I alluded to on irc. :)\n\n> @Radhermit: I'd suggest just adding a function that does the\n> appropriate lookup || die, rather than introducing local assignments\n> (which may or may not get dumped out via env saving if invoked in the\n> wrong spots).\n\nHmm, true about the env saving. I was considering doing that (and had the\ntrivial function done) until I noticed it was only 3 spots ... not \"a\nlot\" imo. :)\n\nI'll revert to that solution since subshell dying works for us now too\nso there shouldn't be any issues.\n\nThanks,\nTim\n"}}