{"action":"created","issue":{"url":"https://api.github.com/repos/rcaloras/bash-preexec/issues/19","labels_url":"https://api.github.com/repos/rcaloras/bash-preexec/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/rcaloras/bash-preexec/issues/19/comments","events_url":"https://api.github.com/repos/rcaloras/bash-preexec/issues/19/events","html_url":"https://github.com/rcaloras/bash-preexec/issues/19","id":120102880,"number":19,"title":"preexec breaks passed-in environment variables when used with command builtin","user":{"login":"gnachman","id":427546,"avatar_url":"https://avatars.githubusercontent.com/u/427546?v=3","gravatar_id":"","url":"https://api.github.com/users/gnachman","html_url":"https://github.com/gnachman","followers_url":"https://api.github.com/users/gnachman/followers","following_url":"https://api.github.com/users/gnachman/following{/other_user}","gists_url":"https://api.github.com/users/gnachman/gists{/gist_id}","starred_url":"https://api.github.com/users/gnachman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnachman/subscriptions","organizations_url":"https://api.github.com/users/gnachman/orgs","repos_url":"https://api.github.com/users/gnachman/repos","events_url":"https://api.github.com/users/gnachman/events{/privacy}","received_events_url":"https://api.github.com/users/gnachman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"rcaloras","id":149818,"avatar_url":"https://avatars.githubusercontent.com/u/149818?v=3","gravatar_id":"","url":"https://api.github.com/users/rcaloras","html_url":"https://github.com/rcaloras","followers_url":"https://api.github.com/users/rcaloras/followers","following_url":"https://api.github.com/users/rcaloras/following{/other_user}","gists_url":"https://api.github.com/users/rcaloras/gists{/gist_id}","starred_url":"https://api.github.com/users/rcaloras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcaloras/subscriptions","organizations_url":"https://api.github.com/users/rcaloras/orgs","repos_url":"https://api.github.com/users/rcaloras/repos","events_url":"https://api.github.com/users/rcaloras/events{/privacy}","received_events_url":"https://api.github.com/users/rcaloras/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-12-03T06:23:37Z","updated_at":"2015-12-03T08:01:10Z","closed_at":null,"body":"I received this bug report for my script which uses the same trickery as bash-preexec:\r\n\r\nhttps://gitlab.com/gnachman/iterm2/issues/3644\r\n\r\nIt seems that setting a DEBUG trap breaks this use case:\r\n````\r\nFOO=BAR command something_that_uses_foo.sh\r\n````\r\n\r\nTo reproduce with bash-preexec:\r\n\r\n````\r\necho 'echo $BUILD_SYSTEM' > p\r\nchmod +x p\r\n\r\n# Note that this prints \"build/core\"\r\nBUILD_SYSTEM=build/core command ./p\r\n\r\n# Now set up preexec and notice that it breaks\r\nsource ~/.bash-preexec.sh\r\nfunction preexec() {\r\ntrue\r\n}\r\n\r\n# This produces no output\r\nBUILD_SYSTEM=build/core command ./p\r\n````\r\n\r\nThis is a problem because it means preexec is incompatible with building Android, and who knows what else. Seems like a bug in bash, but I'm not much of a bash expert myself.\r\n"},"comment":{"url":"https://api.github.com/repos/rcaloras/bash-preexec/issues/comments/161545229","html_url":"https://github.com/rcaloras/bash-preexec/issues/19#issuecomment-161545229","issue_url":"https://api.github.com/repos/rcaloras/bash-preexec/issues/19","id":161545229,"user":{"login":"rcaloras","id":149818,"avatar_url":"https://avatars.githubusercontent.com/u/149818?v=3","gravatar_id":"","url":"https://api.github.com/users/rcaloras","html_url":"https://github.com/rcaloras","followers_url":"https://api.github.com/users/rcaloras/followers","following_url":"https://api.github.com/users/rcaloras/following{/other_user}","gists_url":"https://api.github.com/users/rcaloras/gists{/gist_id}","starred_url":"https://api.github.com/users/rcaloras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcaloras/subscriptions","organizations_url":"https://api.github.com/users/rcaloras/orgs","repos_url":"https://api.github.com/users/rcaloras/repos","events_url":"https://api.github.com/users/rcaloras/events{/privacy}","received_events_url":"https://api.github.com/users/rcaloras/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T08:01:10Z","updated_at":"2015-12-03T08:01:10Z","body":"@gnachman Thanks for reporting! I'll give this a look over the weekend and see if I can find a workaround. "}}