Skip to content

Instantly share code, notes, and snippets.

@mvidner
Created May 9, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvidner/551d56d676e5700db6926c480276ee37 to your computer and use it in GitHub Desktop.
Save mvidner/551d56d676e5700db6926c480276ee37 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# https://bugzilla.suse.com/show_bug.cgi?id=1132650
# https://github.com/yast/yast-packager/pull/434
def file_properties(filename)
print "."
File.lstat(filename)
end
def interesting?(stat)
print "?"
stat.symlink?
end
filenames = Dir.glob("/usr/lib/*")
all_props = filenames.map { |fn| file_properties(fn) }
int_props = all_props.find_all { |p| interesting?(p) }.to_a
puts "NORMAL"
puts int_props.size
all_props_lazy = filenames.lazy.map { |fn| file_properties(fn) }
int_props_lazy = all_props_lazy.find_all { |p| interesting?(p) }.to_a
puts "LAZY"
puts int_props_lazy.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment