From 12de180b85a154515466ae425c1998c09e76e8f9 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 22 Jul 2009 20:28:42 +0100 Subject: 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 --- Library/Formula/git.rb | 16 ++++++++++++---- Library/Homebrew/brewkit.rb | 20 +++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) (limited to 'Library') 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 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} -- cgit v1.2.3