From 18d9fbee9804f0862ed42ddd89b00e3999470c9e Mon Sep 17 00:00:00 2001 From: Max Howell Date: Thu, 3 Sep 2009 20:58:33 +0100 Subject: [PATCH] Closes Homebrew/homebrew#27 (permissions to strict) I went with 0555 as the permissions changing only occurs to bin, sbin and lib, so there shouldn't be any files in there for editing in general anyway. Formulae can specify not to "clean" any particular file by reimplementing the skip_clean? function, in case some config file or what not ends up in there. Also committing cosmetic fix to pretty_duration function. --- Library/Homebrew/brew.h.rb | 16 ++++++++-------- Library/Homebrew/utils.rb | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index f771a32456..8b3939968d 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -260,7 +260,7 @@ private `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 + # is this expected behaviour? patch does it too… still, this fixes it tmp=`mktemp -t #{path.basename}`.strip `strip #{args} -o #{tmp} #{path}` `cat #{tmp} > #{path}` @@ -271,13 +271,13 @@ private def clean_file path perms=0444 case `file -h #{path}` - when /Mach-O dynamically linked shared library/ - strip path, '-SxX' - when /Mach-O [^ ]* ?executable/ - strip path - perms=0544 - when /script text executable/ - perms=0544 + when /Mach-O dynamically linked shared library/ + strip path, '-SxX' + when /Mach-O [^ ]* ?executable/ + strip path + perms=0555 + when /script text executable/ + perms=0555 end path.chmod perms end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 2bd05e15df..67a69dec23 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -42,9 +42,9 @@ def onoe error end def pretty_duration s - return "#{(s*1000).to_i} milliseconds" if s < 3 - return "#{s.to_i} seconds" if s < 10*60 - return "#{(s/60).to_i} minutes" + return "2 seconds" if s < 3 # avoids the plural problem ;) + return "#{s.to_i} seconds" if s < 120 + return "%.1f minutes" % (s/60) end def interactive_shell