Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watchman: don't make state directory world-writeable #174554

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions Formula/w/watchman.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Watchman < Formula

Check warning on line 1 in Formula/w/watchman.rb

View workflow job for this annotation

GitHub Actions / macOS 13-x86_64

`brew linkage --cached --test --strict watchman` failed on macOS Ventura (13)!

Indirect dependencies with linkage: double-conversion fizz libsodium lz4 mvfst snappy wangle xz zstd

Check warning on line 1 in Formula/w/watchman.rb

View workflow job for this annotation

GitHub Actions / macOS 13-arm64

`brew linkage --cached --test --strict watchman` failed on macOS Ventura (13) on Apple Silicon!

Indirect dependencies with linkage: double-conversion fizz libsodium lz4 mvfst snappy wangle xz zstd
desc "Watch files and take action when they change"
homepage "https://github.com/facebook/watchman"
url "https://github.com/facebook/watchman/archive/refs/tags/v2024.06.10.00.tar.gz"
Expand Down Expand Up @@ -34,8 +34,6 @@
depends_on "gflags"
depends_on "glog"
depends_on "libevent"
depends_on "libsodium"
depends_on "mvfst"
depends_on "openssl@3"
depends_on "pcre2"
depends_on "python@3.12"
Expand All @@ -52,18 +50,22 @@
/gtest_discover_tests\((.*)\)/,
"gtest_discover_tests(\\1 DISCOVERY_TIMEOUT 60)"

args = %W[
-DENABLE_EDEN_SUPPORT=ON
-DPython3_EXECUTABLE=#{which("python3.12")}
-DWATCHMAN_VERSION_OVERRIDE=#{version}
-DWATCHMAN_BUILDINFO_OVERRIDE=#{tap&.user || "Homebrew"}
-DWATCHMAN_STATE_DIR=#{var}/run/watchman
]
# Avoid overlinking with libsodium and mvfst
args << "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-dead_strip_dylibs" if OS.mac?

# NOTE: Setting `BUILD_SHARED_LIBS=ON` will generate DSOs for Eden libraries.
# These libraries are not part of any install targets and have the wrong
# RPATHs configured, so will need to be installed and relocated manually
# if they are built as shared libraries. They're not used by any other
# formulae, so let's link them statically instead. This is done by default.
system "cmake", "-S", ".", "-B", "build",
"-DENABLE_EDEN_SUPPORT=ON",
"-DPython3_EXECUTABLE=#{which("python3.12")}",
"-DWATCHMAN_VERSION_OVERRIDE=#{version}",
"-DWATCHMAN_BUILDINFO_OVERRIDE=#{tap.user}",
"-DWATCHMAN_STATE_DIR=#{var}/run/watchman",
*std_cmake_args
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"

Expand All @@ -75,7 +77,8 @@

def post_install
(var/"run/watchman").mkpath
chmod 042777, var/"run/watchman"
# Don't make me world-writeable! This admits symlink attacks that makes upstream dislike usage of `/tmp`.
chmod 03775, var/"run/watchman"
end

test do
Expand Down
Loading