{"action":"created","issue":{"url":"https://api.github.com/repos/FabricAttachedMemory/Emulation/issues/4","labels_url":"https://api.github.com/repos/FabricAttachedMemory/Emulation/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/FabricAttachedMemory/Emulation/issues/4/comments","events_url":"https://api.github.com/repos/FabricAttachedMemory/Emulation/issues/4/events","html_url":"https://github.com/FabricAttachedMemory/Emulation/pull/4","id":120599193,"number":4,"title":"Fix executing vmdebootstrap command when not using sudo","user":{"login":"jfreax","id":566972,"avatar_url":"https://avatars.githubusercontent.com/u/566972?v=3","gravatar_id":"","url":"https://api.github.com/users/jfreax","html_url":"https://github.com/jfreax","followers_url":"https://api.github.com/users/jfreax/followers","following_url":"https://api.github.com/users/jfreax/following{/other_user}","gists_url":"https://api.github.com/users/jfreax/gists{/gist_id}","starred_url":"https://api.github.com/users/jfreax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfreax/subscriptions","organizations_url":"https://api.github.com/users/jfreax/orgs","repos_url":"https://api.github.com/users/jfreax/repos","events_url":"https://api.github.com/users/jfreax/events{/privacy}","received_events_url":"https://api.github.com/users/jfreax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-06T00:57:14Z","updated_at":"2015-12-07T06:49:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/FabricAttachedMemory/Emulation/pulls/4","html_url":"https://github.com/FabricAttachedMemory/Emulation/pull/4","diff_url":"https://github.com/FabricAttachedMemory/Emulation/pull/4.diff","patch_url":"https://github.com/FabricAttachedMemory/Emulation/pull/4.patch"},"body":"The vmdeboostrap command is build up in a string variable.\r\nIt normally would invoke the sudo command at first,\r\nbut when you run the script directly as root the $SUDO variable is empty.\r\nThen the command begins with a variable declaration. This will result in the following error:\r\n\r\n```bash\r\n  ./emulation_configure.bash: line 250: http_proxy=: command not found\r\n```\r\n\r\nPrefixed variable declaration will not work in bash in this case.\r\nYou have to use the builtin `eval`."},"comment":{"url":"https://api.github.com/repos/FabricAttachedMemory/Emulation/issues/comments/162428081","html_url":"https://github.com/FabricAttachedMemory/Emulation/pull/4#issuecomment-162428081","issue_url":"https://api.github.com/repos/FabricAttachedMemory/Emulation/issues/4","id":162428081,"user":{"login":"jfreax","id":566972,"avatar_url":"https://avatars.githubusercontent.com/u/566972?v=3","gravatar_id":"","url":"https://api.github.com/users/jfreax","html_url":"https://github.com/jfreax","followers_url":"https://api.github.com/users/jfreax/followers","following_url":"https://api.github.com/users/jfreax/following{/other_user}","gists_url":"https://api.github.com/users/jfreax/gists{/gist_id}","starred_url":"https://api.github.com/users/jfreax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfreax/subscriptions","organizations_url":"https://api.github.com/users/jfreax/orgs","repos_url":"https://api.github.com/users/jfreax/repos","events_url":"https://api.github.com/users/jfreax/events{/privacy}","received_events_url":"https://api.github.com/users/jfreax/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T06:49:50Z","updated_at":"2015-12-07T06:49:50Z","body":"> The first vmdebootstrap invocation (referenced in your request) doesn't actually need to be run as root, it's just probing the configuration dump.\r\n\r\nOkay, but when I start the whole script as root, then this command gets started obviously as root, too.\r\n\r\n> I can't reproduce the error you are seeing with your setup.\r\n\r\nMhhh. Strange. I tested bash versions 4.3_p42 and 4.3.30. An example... the following command will work for me:\r\n```bash\r\n$ foo=bar echo ok\r\nok\r\n```\r\n\r\nBut not this one:\r\n```bash\r\n$ var=\"foo=bar echo ok\"\r\n$ $var\r\n-bash: foo=bar: command not found\r\n```\r\n\r\nThe second case is what happens here in the script.\r\n\r\n> What is the output of env(1) \r\n\r\nNothing special:\r\n```bash\r\nHOSTNAME=6e4784316b55\r\nTERM=xterm\r\nOLDPWD=/root\r\nUSER=root\r\nPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\r\nPWD=/root/Emulation\r\nSHLVL=1\r\nHOME=/root\r\n_=/usr/bin/env\r\n```"}}