{"action":"closed","issue":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/6242","labels_url":"https://api.github.com/repos/mitchellh/vagrant/issues/6242/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/vagrant/issues/6242/comments","events_url":"https://api.github.com/repos/mitchellh/vagrant/issues/6242/events","html_url":"https://github.com/mitchellh/vagrant/issues/6242","id":105211277,"number":6242,"title":"Vagrant 1.7.3 subprocess jail breaks execution of external ruby commands","user":{"login":"neovatar","id":550533,"avatar_url":"https://avatars.githubusercontent.com/u/550533?v=3","gravatar_id":"","url":"https://api.github.com/users/neovatar","html_url":"https://github.com/neovatar","followers_url":"https://api.github.com/users/neovatar/followers","following_url":"https://api.github.com/users/neovatar/following{/other_user}","gists_url":"https://api.github.com/users/neovatar/gists{/gist_id}","starred_url":"https://api.github.com/users/neovatar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovatar/subscriptions","organizations_url":"https://api.github.com/users/neovatar/orgs","repos_url":"https://api.github.com/users/neovatar/repos","events_url":"https://api.github.com/users/neovatar/events{/privacy}","received_events_url":"https://api.github.com/users/neovatar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-07T12:57:05Z","updated_at":"2015-09-08T07:54:10Z","closed_at":"2015-09-08T07:54:10Z","body":"I just noticed, that starting with Vagrant 1.7.3 the execution of ruby commands via the vagrant-triggers plugin (and possibly all exeution of external ruby commands) is broken.\r\n\r\nWhen calling a command via vagrant-triggers `run`, vagrant-triggers takes care to delete `GEM_HOME`, `GEM_PATH` and `GEMRC` from the environment (in https://github.com/emyl/vagrant-triggers/blob/master/lib/vagrant-triggers/dsl.rb#L87), so we can execute ruby commands, that depend on a non vagrant ruby environment.\r\n\r\nBut vagrant introduced a new \"magic\" to check if it is executed via bundler, and restores the vagrant environment for the subprocess. So if you call a ruby process, vagrant enforces the old environment and `GEM_HOME`, `GEM_PATH` and `GEMRC` point to the vagrant specific gem locations and things break because gems are not found.\r\n\r\nWe can set `VAGRANT_SKIP_SUBPROCESS_JAILBREAK` environment variable to disable the magic, but we need to set it before calling vagrant. Setting it in the Vagrantfile does not seem to work.\r\n\r\nhttps://docs.vagrantup.com/v2/other/environmental-variables.html\r\n\r\n> VAGRANT_SKIP_SUBPROCESS_JAILBREAK\r\n\r\n> As of Vagrant 1.7.3, Vagrant tries to intelligently detect if it is running in the installer or running via Bundler. Although not officially supported, Vagrant tries its best to work when executed via Bundler.  When Vagrant detects that you have spawned a subprocess that lives outside of Vagrant's installer, Vagrant will do its best to reset the preserved environment dring the subprocess execution.\r\n\r\n> If Vagrant detects it is running outside of the officially installer, the original environment will always be restored. You can disable this automatic jailbreak by setting the VAGRANT_SKIP_SUBPROCES_JAILBREAK.\r\n\r\nI am not sure, how to work around this or how to switch off this behaviour from within the Vagrantfile. It was introduced in Vagrant 1.7.3 (a minor release) and breaks stuff that worked with 1.7.2.\r\n\r\n@mitchellh Is there anything I can do to disable the jailbreak magic from within a Vagrantfile? I can change all projects Vagrantfiles, but I cannot tell all developers to call vagrant via `VAGRANT_SKIP_SUBPROCES_JAILBREAK=1 vagrant ...`. If there is no such control setting within the Vagrantfile, there really should be one."}}