aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-08-19 12:32:58 -0500
committerJack Nagel2013-08-19 12:32:58 -0500
commit938c7f7df40abf2a21bc89731a5f3ef3e177162f (patch)
tree5198dfc6a83d6f30fe002612aa3e98ef10db4d48 /Library
parentfcec094f60fa43b83123913b7e85b56bc8bec899 (diff)
downloadhomebrew-938c7f7df40abf2a21bc89731a5f3ef3e177162f.tar.bz2
Fix superenv ENV[] hack
We override ENV[] to always return strings under superenv, because legacy formulae assume that CFLAGS, etc. are non-nil. However, the current implementation has a bug. If I simply concatenate ENV['CFLAGS'] with another string, it mutates ENV['CFLAGS']: irb> ENV['CFLAGS'] => "" irb> ENV['CFLAGS'] + 'a' => "a" irb> ENV['CFLAGS'] => "a" Instead, let's simply return an empty string if the key doesn't exist. This is sufficient because the following are equivalent: 1. ENV['CFLAGS'] += "string" 2. ENV['CFLAGS'] = ENV['CFLAGS'] + "string"
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/superenv.rb10
1 files changed, 1 insertions, 9 deletions
diff --git a/Library/Homebrew/superenv.rb b/Library/Homebrew/superenv.rb
index 58a801ca5..b3a14fdd3 100644
--- a/Library/Homebrew/superenv.rb
+++ b/Library/Homebrew/superenv.rb
@@ -29,15 +29,7 @@ module Superenv
if has_key? key
fetch(key)
elsif %w{CPPFLAGS CFLAGS LDFLAGS}.include? key
- class << (a = "")
- attr_accessor :key
- def + value
- ENV[key] = value
- end
- alias_method '<<', '+'
- end
- a.key = key
- a
+ self[key] = ""
end
end
end