aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorØyvind Ingebrigtsen Øvergaard2015-12-20 23:13:58 +0100
committerMike McQuaid2015-12-21 07:54:30 +0000
commitcf2bf08ec97847069ce22745476b4b2987b035e5 (patch)
tree615faab218e207717a11e2172249fa69354e7842 /Library/Homebrew/test
parent28776ee1c342c4be755a597812d47d547238a08b (diff)
downloadbrew-cf2bf08ec97847069ce22745476b4b2987b035e5.tar.bz2
bottle: don't read mtime from nonexistant files
If the source contains a broken symlink, `brew bottle` would fail for no good reason when trying to determine the most recently modified file. To avoid this, we ignore any files for which stat(2) fails. Closes Homebrew/homebrew#47111. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/test')
l---------Library/Homebrew/test/resources/source-with-broken-symlink/broken-link1
-rw-r--r--Library/Homebrew/test/test_bottle.rb8
2 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/test/resources/source-with-broken-symlink/broken-link b/Library/Homebrew/test/resources/source-with-broken-symlink/broken-link
new file mode 120000
index 000000000..cfa0a4651
--- /dev/null
+++ b/Library/Homebrew/test/resources/source-with-broken-symlink/broken-link
@@ -0,0 +1 @@
+does-not-exist \ No newline at end of file
diff --git a/Library/Homebrew/test/test_bottle.rb b/Library/Homebrew/test/test_bottle.rb
new file mode 100644
index 000000000..f4398cc1d
--- /dev/null
+++ b/Library/Homebrew/test/test_bottle.rb
@@ -0,0 +1,8 @@
+require "testing_env"
+require "cmd/bottle"
+
+class BottleTests < Homebrew::TestCase
+ def test_most_recent_mtime_with_broken_symlink()
+ refute_nil Homebrew.most_recent_mtime(Pathname(File.join(TEST_DIRECTORY, 'resources/source-with-broken-symlink')))
+ end
+end