Fix bug in brew list --pinned

Pinned formulae which were pinned at a previous version but then upgraded
would not be listed by `brew list --pinned`. This is due to the good old
"File.exist? thinks broken symlinks don't exist" gotcha, so the test in
the select block in list_pinned has been changed to check if the pin file
exists _or_ is a symlink.

Closes Homebrew/homebrew#20423.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Simon Sigurdhsson 2013-06-11 22:13:39 +02:00 committed by Jack Nagel
parent 7f9e4e11a3
commit 776c08490f

View File

@ -58,7 +58,8 @@ module Homebrew extend self
else else
ARGV.named.map{ |n| HOMEBREW_CELLAR+n }.select{ |pn| pn.exist? } ARGV.named.map{ |n| HOMEBREW_CELLAR+n }.select{ |pn| pn.exist? }
end.select do |d| end.select do |d|
(HOMEBREW_LIBRARY/"PinnedKegs"/d.basename.to_s).exist? keg_pin = (HOMEBREW_LIBRARY/"PinnedKegs"/d.basename.to_s)
keg_pin.exist? or keg_pin.symlink?
end.each do |d| end.each do |d|
puts d.basename puts d.basename
end end