diff options
| author | Max Howell | 2009-07-22 20:28:42 +0100 |
|---|---|---|
| committer | Max Howell | 2009-07-22 20:28:42 +0100 |
| commit | 12de180b85a154515466ae425c1998c09e76e8f9 (patch) | |
| tree | b8421729b6b10fdc434769124a18fa7855ebde4e /Library | |
| parent | cc611b142458cd45cfa6ef291a196ccaf29122f1 (diff) | |
| download | homebrew-12de180b85a154515466ae425c1998c09e76e8f9.tar.bz2 | |
Fix hard link dissociation bug
strip unlinks the file first, breaking hard links, so we detect instances where we are about to strip a file with many linkages and prevent it.
This fixes the libexec non executable bug in the git package.
Took me a long time to figure out what was wrong! :P
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/git.rb | 16 | ||||
| -rw-r--r-- | Library/Homebrew/brewkit.rb | 20 |
2 files changed, 27 insertions, 9 deletions
diff --git a/Library/Formula/git.rb b/Library/Formula/git.rb index cdecafd1d..50098ce57 100644 --- a/Library/Formula/git.rb +++ b/Library/Formula/git.rb @@ -1,13 +1,13 @@ require 'brewkit' class GitManuals <UnidentifiedFormula - @url='http://kernel.org/pub/software/scm/git/git-manpages-1.6.3.1.tar.bz2' - @md5='971d573e8f261feb83290a59728c2b33' + @url='http://www.kernel.org/pub/software/scm/git/git-manpages-1.6.3.3.tar.bz2' + @md5='36be16310d1e24f23c966c8e17a499d7' end class Git <Formula - @url='http://kernel.org/pub/software/scm/git/git-1.6.3.1.tar.bz2' - @md5='c1f4aab741359c29f0fbf28563ac7387' + @url='http://www.kernel.org/pub/software/scm/git/git-1.6.3.3.tar.bz2' + @md5='91ae46ac01dadab1962beb064abd5b60' @homepage='http://git-scm.com' def install @@ -17,5 +17,13 @@ class Git <Formula system "./configure --prefix='#{prefix}' --disable-debug" system "make install" + + # these files are exact copies of the git binary, so like the contents + # of libexec/git-core lets hard link them + # I am assuming this is an overisght by the git devs + %w[git-receive-pack git-upload-archive].each do |fn| + (bin+fn).unlink + (bin+fn).make_link bin+'git' + end end end
\ No newline at end of file diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb index 9a82f8f4f..472999f0e 100644 --- a/Library/Homebrew/brewkit.rb +++ b/Library/Homebrew/brewkit.rb @@ -239,6 +239,7 @@ public end def clean + #TODO strip libexec too [bin,lib].each {|path| path.find do |path| if not path.file? next @@ -248,21 +249,30 @@ public else fo=`file -h #{path}` args=nil - chmod=0444 + perms=0444 if fo =~ /Mach-O dynamically linked shared library/ args='-SxX' elsif fo =~ /Mach-O executable/ # defaults strip everything args='' # still do the strip - chmod=0544 + perms=0544 elsif fo =~ /script text executable/ - chmod=0544 + perms=0544 end if args puts "Stripping: #{path}" if ARGV.include? '--verbose' path.chmod 0644 # so we can strip - `strip #{args} #{path}` + unless path.stat.nlink > 1 + `strip #{args} #{path}` + else + # strip unlinks the file and recreates it, thus breaking hard links! + # is this expected behaviour? patch does it too… still,mktm this fixes it + tmp=`mktemp -t #{path.basename}`.strip + `strip -o #{tmp} #{path}` + `cat #{tmp} > #{path}` + File.unlink tmp + end end - path.chmod chmod + path.chmod perms end end} |
