aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/bash.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2013-11-14 18:43:37 -0800
committerAdam Vandenberg2013-11-14 18:46:44 -0800
commit5120c11eafff4da5e1bf4de54c88d438ad94a1ec (patch)
treefe58907640d1014d5f864dd7365f965bfda321ae /Library/Formula/bash.rb
parent9bf0b2582bde788fa270fe8643c282797f3ccdba (diff)
downloadhomebrew-5120c11eafff4da5e1bf4de54c88d438ad94a1ec.tar.bz2
bash: apply patch for bad strcpy in decode_prompt_string
Closes #23470.
Diffstat (limited to 'Library/Formula/bash.rb')
-rw-r--r--Library/Formula/bash.rb29
1 files changed, 27 insertions, 2 deletions
diff --git a/Library/Formula/bash.rb b/Library/Formula/bash.rb
index 0ed6e68d2..34cffee04 100644
--- a/Library/Formula/bash.rb
+++ b/Library/Formula/bash.rb
@@ -15,8 +15,13 @@ class Bash < Formula
# and the more patches there are, the more unreliable they get. Upstream
# patches can be found in: http://ftpmirror.gnu.org/bash/bash-4.2-patches
def patches
- { :p0 => "https://gist.github.com/jacknagel/4008180/raw/1509a257060aa94e5349250306cce9eb884c837d/bash-4.2-001-045.patch" }
- end unless build.head?
+ # http://article.gmane.org/gmane.comp.shells.bash.bugs/20242
+ p = { :p1 => DATA }
+ if build.stable?
+ p[:p0] = "https://gist.github.com/jacknagel/4008180/raw/1509a257060aa94e5349250306cce9eb884c837d/bash-4.2-001-045.patch"
+ end
+ p
+ end
def install
# When built with SSH_SOURCE_BASHRC, bash will source ~/.bashrc when
@@ -37,3 +42,23 @@ class Bash < Formula
EOS
end
end
+
+__END__
+diff --git a/parse.y b/parse.y
+index b5c94e7..0cda47c 100644
+--- a/parse.y
++++ b/parse.y
+@@ -5262,7 +5262,12 @@ decode_prompt_string (string)
+ else
+ /* polite_directory_format is guaranteed to return a string
+ no longer than PATH_MAX - 1 characters. */
+- strcpy (t_string, polite_directory_format (t_string));
++ /* polite_directory_format might simply return the pointer to t_string
++ strcpy(3) tells dst and src may not overlap, OS X 10.9 asserts this and
++ triggers an abort trap if that's the case */
++ temp = polite_directory_format (t_string);
++ if (temp != t_string)
++ strcpy (t_string, temp);
+
+ temp = trim_pathname (t_string, PATH_MAX - 1);
+ /* If we're going to be expanding the prompt string later,