Skip to content
Snippets Groups Projects
Commit 51c4c84a authored by Tim D. Smith's avatar Tim D. Smith
Browse files

Don't follow symlinks when hunting for strings

When we're assessing whether a bottle is relocatable, we shouldn't have
to descend into symlink paths we encounter. This is supposed to be the
default behavior but it doesn't appear to be (perhaps because we pass a
symlink to the keg on the command line?).

All of the switches that control this behavior differ between BSD and
GNU grep, so sniff the grep flavor first.
parent 974b5e2f
No related branches found
No related tags found
No related merge requests found
......@@ -97,7 +97,12 @@ class Keg
end
def each_unique_file_matching(string)
Utils.popen_read("/usr/bin/fgrep", "-lr", string, to_s) do |io|
bsd = `/usr/bin/fgrep -V`.include?("BSD grep")
grep_args = "-lr"
# Don't recurse into symlinks; the man page says this is the default, but
# it's wrong.
grep_args += "O" if bsd
Utils.popen_read("/usr/bin/fgrep", grep_args, string, to_s) do |io|
hardlinks = Set.new
until io.eof?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment