Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unset the CDPATH env variable before shelling-out. #1694 #1943

Merged
merged 3 commits into from Mar 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,15 @@

To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides/installing_cocoapods.html).

## Master
[CocoaPods](https://github.com/jverkoey/CocoaPods/compare/0.30.0...master)

###### Enhancements

* Unset the `CDPATH` env variable before shelling-out on `prepare_command`
[Marc Boquet](https://github.com/apalancat)
[#1943](https://github.com/CocoaPods/CocoaPods/pull/1943)

## 0.30.0
[CocoaPods](https://github.com/jverkoey/CocoaPods/compare/0.29.0...0.30.0)

Expand Down
5 changes: 5 additions & 0 deletions lib/cocoapods/installer/pod_source_installer.rb
Expand Up @@ -114,12 +114,17 @@ def download_source

# Runs the prepare command bash script of the spec.
#
# @note Unsets the `CDPATH` env variable before running the
# shell script to avoid issues with relative paths
# (issue #1694).
#
# @return [void]
#
def run_prepare_command
return unless root_spec.prepare_command
UI.section(" > Running prepare command", '', 1) do
Dir.chdir(root) do
ENV.delete('CDPATH')
prepare_command = root_spec.prepare_command.strip_heredoc.chomp
full_command = "\nset -e\n" + prepare_command
bash!(full_command)
Expand Down
7 changes: 7 additions & 0 deletions spec/unit/installer/pod_source_installer_spec.rb
Expand Up @@ -83,6 +83,13 @@ module Pod
@installer.install!
end.message.should.match /command not found/
end

it "unsets $CDPATH environment variable" do
ENV['CDPATH'] = "BogusPath"
@spec.prepare_command = "cd Classes;ls Banana.h"
lambda { @installer.install! }.should.not.raise
end

end

#--------------------------------------#
Expand Down