Closed isker closed 3 years ago
Had a coworker test this out, didn't work because watchman still wants that /usr/local/var/run/watchman
to exist. Worked on my machine because I had already created it. Let me figure out what to do with this...
Maybe this problem is related to the answer to my question at https://github.com/facebook/watchman/issues/851#issuecomment-681084864 ? 😄
Just having the formula make the dir. Surprisingly I did not have to chmod it to 777, as the installation instructions say:
λ tree -p /usr/local/var/run/
/usr/local/var/run/
└── [drwxr-xr-x] watchman
└── [drwx--S---] ikerins-state
├── [-rw-------] log
├── [-rw-r--r--] pid
└── [srw-------] sock
Everything seems to work fine like that.
@wez PTAL. Thanks!
@wez ping!
Hey there! Found this while trying to see why watchman-make
didn't work anymore after an upgrade. I installed from this tap but didn't found any watchman-make
in the bin directory. Any hints?
@gonzaloserrano you tapped my branch? watchman-make
simply isn't in the released zip files, so that's a problem for upstream. You can see for yourself here https://github.com/facebook/watchman/releases/download/v2020.08.17.00/watchman-v2020.08.17.00-macos.zip
Just having the formula make the dir. Surprisingly I did not have to chmod it to 777, as the installation instructions say:
λ tree -p /usr/local/var/run/ /usr/local/var/run/ └── [drwxr-xr-x] watchman └── [drwx--S---] ikerins-state ├── [-rw-------] log ├── [-rw-r--r--] pid └── [srw-------] sock
Everything seems to work fine like that.
If you add another unix account to your system and try to use watchman, then you'll trigger the case where you need it to be 2777
Thanks for doing this @isker!
I can't directly test this at the moment; would you mind sharing the tree -p
output for the bin and lib dirs? That's largely what I'm curious about!
If you add another unix account to your system and try to use watchman, then you'll trigger the case where you need it to be 2777
Got it, I added a chmod.
would you mind sharing the tree -p output for the bin and lib dirs?
You mean those in Cellar?
~/homebrew-fb:watchman λ tree -p /usr/local/var/run/
/usr/local/var/run/
├── [drwxrwxrwx] watchman
└── [drwx--S---] ikerins-state
├── [-rw-------] log
├── [-rw-r--r--] pid
├── [srw-------] sock
└── [-rw-------] state
~/homebrew-fb:watchman λ tree -p /usr/local/Cellar/watchman/2020.08.17.00/
/usr/local/Cellar/watchman/2020.08.17.00/
├── [-rw-r--r--] INSTALL_RECEIPT.json
├── [drwxr-xr-x] bin
│ └── [-r-xr-xr-x] watchman
└── [drwxr-xr-x] lib
├── [-r--r--r--] libcrypto.1.1.dylib
├── [-r--r--r--] libgflags.2.2.dylib
├── [-r--r--r--] libglog.0.dylib
├── [-r--r--r--] libsodium.23.dylib
└── [-r--r--r--] libssl.1.1.dylib
2 directories, 7 files
If you add another unix account to your system and try to use watchman, then you'll trigger the case where you need it to be 2777
Got it, I added a chmod.
would you mind sharing the tree -p output for the bin and lib dirs?
You mean those in Cellar?
~/homebrew-fb:watchman λ tree -p /usr/local/var/run/ /usr/local/var/run/ ├── [drwxrwxrwx] watchman
I was hoping to see S in here for the group mode; was this captured prior to adding in the chmod?
└── [drwx--S---] ikerins-state ├── [-rw-------] log ├── [-rw-r--r--] pid ├── [srw-------] sock └── [-rw-------] state ~/homebrew-fb:watchman λ tree -p /usr/local/Cellar/watchman/2020.08.17.00/ /usr/local/Cellar/watchman/2020.08.17.00/ ├── [-rw-r--r--] INSTALL_RECEIPT.json ├── [drwxr-xr-x] bin │ └── [-r-xr-xr-x] watchman └── [drwxr-xr-x] lib ├── [-r--r--r--] libcrypto.1.1.dylib ├── [-r--r--r--] libgflags.2.2.dylib ├── [-r--r--r--] libglog.0.dylib ├── [-r--r--r--] libsodium.23.dylib └── [-r--r--r--] libssl.1.1.dylib 2 directories, 7 files
was this captured prior to adding in the chmod?
No. I just reran everything end to end, here's the result:
~/homebrew-fb:watchman λ watchman shutdown-server && rm -rf /usr/local/var/run/watchman && brew remove watchman && brew install watchman.rb && tree -p /usr/local/var/run /usr/local/Cellar/watchman/2020.08.17.00/
{
"version": "20200816.222424.0",
"shutdown-server": true
}
Uninstalling /usr/local/Cellar/watchman/2020.08.17.00... (8 files, 7.4MB)
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from 2dbaaf35a to 793ab30bb.
Updated 1 tap (homebrew/cask-versions).
==> Updated Casks
brave-browser-beta opera-beta
==> Downloading https://github.com/facebook/watchman/releases/download/v2020.08.17.00/watchman-v2020.08.17.00-macos.zip
Already downloaded: /Users/ikerins/Library/Caches/Homebrew/downloads/05e628c0f4811a1fa63b96efca2813e8b4d9c88caf931176768afeb1618f6226--watchman-v2020.08.17.00-macos.zip
🍺 /usr/local/Cellar/watchman/2020.08.17.00: 8 files, 7.4MB, built in 3 seconds
/usr/local/var/run
├── [drwxr-xr-x] nginx
│ ├── [drwx------] client_body_temp
│ ├── [drwx------] fastcgi_temp
│ ├── [drwx------] proxy_temp
│ ├── [drwx------] scgi_temp
│ └── [drwx------] uwsgi_temp
└── [drwxrwxrwx] watchman
/usr/local/Cellar/watchman/2020.08.17.00/
├── [-rw-r--r--] INSTALL_RECEIPT.json
├── [drwxr-xr-x] bin
│ └── [-r-xr-xr-x] watchman
└── [drwxr-xr-x] lib
├── [-r--r--r--] libcrypto.1.1.dylib
├── [-r--r--r--] libgflags.2.2.dylib
├── [-r--r--r--] libglog.0.dylib
├── [-r--r--r--] libsodium.23.dylib
└── [-r--r--r--] libssl.1.1.dylib
9 directories, 7 files
But after starting watchman ikerins-state
does have S
in the group:
λ tree -p /usr/local/var/run
/usr/local/var/run
├── [drwxr-xr-x] nginx
│ ├── [drwx------] client_body_temp
│ ├── [drwx------] fastcgi_temp
│ ├── [drwx------] proxy_temp
│ ├── [drwx------] scgi_temp
│ └── [drwx------] uwsgi_temp
└── [drwxrwxrwx] watchman
└── [drwx--S---] ikerins-state
├── [-rw-------] log
├── [-rw-r--r--] pid
├── [srw-------] sock
└── [-rw-------] state
8 directories, 4 files
/bin/chmod 2777 /usr/local/var/run/watchman
does get the desired result.
~/homebrew-fb:watchman λ chmod 2777 /usr/local/var/run/watchman
~/homebrew-fb:watchman λ ls -lh /usr/local/var/run/
total 1.0k
drwxr-xr-x 7 ikerins staff 224 2020-07-22 00:06 nginx
drwxrwsrwx 3 ikerins staff 96 2020-09-03 15:15 watchman
So what is ruby chmod doing? 😕
So, nothing I do inside of the formula works. Even system "chmod", "2777", "/usr/local/var/run/watchman"
. However, lower bits work just fine: chmod 0o444, "/usr/local/var/run/watchman
has the expected effect.
However, when I fire up irb
and simply do FileUtils.chmod 0o2777, "/usr/local/var/run/watchman"
, which is the same thing the current version of the formula in my branch is doing, it works.
I'm not very familiar with setuid/setgid. Is there something about the homebrew process itself that could be preventing the mode from being fully set?
Aha! Homebrew's sandbox-exec profile does not allow setting setuid/setgid!
https://github.com/Homebrew/brew/issues/6019
MacPorts once had a similar issue: https://trac.macports.org/ticket/54963. Apparently file-write-setugid needs to be explicitly allowed in addition to file-write*.
The maintainers shot the proposal to allow them down.
So, I think the best we can do is print a caveat for this. What do you think @wez ?
@wez how's this look?
@wez could you take another look?
lgtm, feel free to send PR for newer version.
The formula in homebrew-core is moribund, and as per https://github.com/facebook/watchman/issues/851#issuecomment-680272404, continuing to build watchman from source with brewed dependencies is untenable. So we add one that just distributes the released binaries here.
Eventually the url and sha will be updated automatically by the watchman release process.
You can test this formula out by running: