Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.75k stars 12.45k forks source link

pgrep not respecting the -P flag: reports every PID #54378

Closed mrflip closed 4 years ago

mrflip commented 4 years ago

I'm having the same issue as #14020; opening a new bug because that one's locked. (Un)fortunately I fixed this by reinstalling, but I assure you it was happening. If I can help you with more information let me know; if this is too esoteric to investigate please just close the bug.

On a brand-new macbook pro running catalina, with a nearly virgin account, I set up homebrew and installed the basics, including proctools. It installed a broken pgrep, same issue as #14020 -- ignoring the -P flag and lists all processes. Reinstalling from source fixed it, and when I re-reinstalled from the same bottle it still seems fixed.


HOMEBREW_VERSION: 2.2.15
ORIGIN: https://github.com/Homebrew/brew
HEAD: e1f3b0b971dccb72780b2ef33fafde158cb3909e
Last commit: 4 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 93a125322e2af6a55de0a0244c14e6bd54145c7d
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_EDITOR: nano
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 16
HOMEBREW_TEMP: /tmp
CPU: 16-core 64-bit kabylake
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
Clang: 11.0 build 1103
Git: 2.26.2 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 1.8.0_252
macOS: 10.15.4-x86_64
CLT: 11.4.1.0.1.1586360307
Xcode: 11.4.1
meriadoc /usr/local$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  emacs
  node

What you were trying to do (and why)

On a brand-new macbook pro running catalina, with a nearly virgin account, I set up homebrew and installed the basics, including proctools.

The proctools that installed was broken along the lines of #14020 -- pgrep -P 12345 listed every process, leading to expo/expo-cli#2080.

What happened (include command output)

Command output

$ /usr/local/bin/pgrep -P 67199
0
1
97
101
...
$ /usr/local/bin/pgrep -P 67199 | wc -l
     841

  

What you expected to happen

pgrep -P (number) should only show child processes.

Step-by-step reproduction instructions (by running brew install commands)

If there are logs or something I can harvest please let me know.

meriadoc ~/code/tooksome/samwise$ brew link pgrep
Linking /usr/local/Cellar/proctools/0.4pre1... 6 symlinks created
meriadoc ~/code/tooksome/samwise$ /usr/local/bin/pgrep -P 67199 | wc -l
     841
meriadoc /tmp/proctools/0.4pre1$ brew install -s proctools
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/cask-versions, homebrew/core and homebrew/cask).
==> New Formulae
ghc@8.8                                                                                                                                          uutils-coreutils
==> Updated Formulae
node ✔              chezmoi             dartsim             ghc                 grc                 httpflow            librdkafka          libtensorflow       mednafen            paket               pygobject3          skaffold            teleport            urdfdom
arangodb            console_bridge      dvc                 glade               gsoap               jrnl                libspectre          libwebsockets       osmosis             prometheus          pylint              tanka               tokei               zeek
==> Updated Casks
4k-video-downloader     banking-4               coderunner              insync                  lunar                   opera                   pycharm                 screen                  sqlpro-for-mysql        tableau-reader          utools                  zoomus
airy                    bdash                   fme-desktop             juicebar                microsoft-edge          oracle-jdk-javadoc      pycharm-ce              scrutiny                sqlpro-for-postgres     telegram                visual-studio           zulip
alt-tab                 birdfont                fsnotes                 jump                    moneywiz                piezo                   qownnotes               seamonkey               sqlpro-studio           terminus                visual-studio-code
amadeus-pro             brave-browser-beta      gearboy                 keep-it                 noxappplayer            plex-media-server       qsync-client            sirimote                tableau                 tor-browser-alpha       vivaldi
astropad-studio         chromedriver            gitify                  kite                    nteract                 pocket-casts            qutebrowser             smartgit                tableau-prep            trilium-notes           vv
aws-vault               clockify                gns3                    lifesize                opencore-configurator   pritunl                 rider                   sqlpro-for-mssql        tableau-public          trojan-qt5              yyets

Warning: proctools 0.4pre1 is already installed and up-to-date
To reinstall 0.4pre1, run `brew reinstall proctools`

meriadoc /tmp/proctools-0.4pre1$ pgrep -P 70195
70218
70219
70220
70221
70222
70223
70224
70225
70226
70227

meriadoc /tmp/proctools/0.4pre1$ brew reinstall -s proctools
==> Reinstalling proctools 
==> Installing dependencies for proctools: bsdmake
==> Installing proctools dependency: bsdmake
==> Downloading https://homebrew.bintray.com/bottles/bsdmake-24.catalina.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring bsdmake-24.catalina.bottle.1.tar.gz
🍺  /usr/local/Cellar/bsdmake/24: 32 files, 248.7KB
meriadoc /usr/local$ ls -l   ~/Library/Caches/Homebrew/proctools-*
lrwxr-xr-x  1 flip  staff  116 May  7 23:22 /Users/flip/Library/Caches/Homebrew/proctools--0.4pre1.catalina.bottle.tar.gz@ -> downloads/16a1844d654e6ed83c44c868817a4dc9460542ca1f8e8cf0214d1b9f7be6ba14--proctools-0.4pre1.catalina.bottle.tar.gz
lrwxr-xr-x  1 flip  staff  100 May  7 23:10 /Users/flip/Library/Caches/Homebrew/proctools--0.4pre1.tar.gz@ -> downloads/fb535f0160802e09a91d9de49d39835b3a4c64586a8ba71ec79a2a14aecc638c--proctools-0.4pre1.tar.gz
lrwxr-xr-x  1 flip  staff  102 May  7 23:10 /Users/flip/Library/Caches/Homebrew/proctools--patch--1a95516de3b6573a96f4ec4be933137e152631ad495f1364c1dd5ce3a9c79bc8.diff@ -> downloads/0d64e9cbd0e6c33fdc673fa42d791b8bfce995122ac2491728d0f70a0472f017--patch-proctools-fmt.c.diff
lrwxr-xr-x  1 flip  staff  108 May  7 23:10 /Users/flip/Library/Caches/Homebrew/proctools--patch--1d08e570cc32ff08f8073308da187e918a89a783837b1ea20735ea25ae18bfdb.diff@ -> downloads/70cb461d44bd244b5b7985439efcb513014e8f16598f25b47c509bbdc4676615--patch-proctools-proctools.c.diff
lrwxr-xr-x  1 flip  staff  108 May  7 23:10 /Users/flip/Library/Caches/Homebrew/proctools--patch--7c2ee6ac3dc7b26fb6738496fbabb1d1d065302a39207ae3fbacb1bc3a64371a.diff@ -> downloads/48c202c7012595b13b2e03de19b99b990dbca26232781d8baecc751ddf5b8d2a--patch-proctools-proctools.h.diff
lrwxr-xr-x  1 flip  staff  100 May  7 23:10 /Users/flip/Library/Caches/Homebrew/proctools--patch--88f1bc60e3cf269ad012799dc6ddce27c2470eeafb7745bc5d14b78a2bdfbe96.diff@ -> downloads/41d02ca5c95f98b1bc071fb8a612fd37209dd5b73f35abe1bbf61f5bd6fcdc85--patch-pfind-pfind.c.diff
lrwxr-xr-x  1 flip  staff  101 May  7 23:10 /Users/flip/Library/Caches/Homebrew/proctools--patch--bac12837958bc214234d47abe204ee6ad0da2d69440cf38b1e39ab986cc39d29.diff@ -> downloads/e02eb8f3ef10527346f8c167c647f6cc2fce47cdc4b8fbacad386d1135000c4d--patch-pkill-Makefile.diff
lrwxr-xr-x  1 flip  staff  101 May  7 23:10 /Users/flip/Library/Caches/Homebrew/proctools--patch--d3ee204bbc708ee650b7310f58e45681c5ca0b3c3c5aa82fa4b402f7f5868b11.diff@ -> downloads/ff17317e538e93298a2cf4ad3c400b3bf56997c9060b84ff4bf5ad359cef24a5--patch-pfind-Makefile.diff
lrwxr-xr-x  1 flip  staff  101 May  7 23:10 /Users/flip/Library/Caches/Homebrew/proctools--patch--f7f2bc21cab6ef02a89ee9e9f975d6a533d012b23720c3c22e66b746beb493fb.diff@ -> downloads/487f09dfe0cdb33e289b21f8255e8a61cab5d0a7e87da7c1a8b5796271b7c4b3--patch-pgrep-Makefile.diff
meriadoc /usr/local$ ls -l   ~/Library/Caches/Homebrew/downloads/*proc*
-rw-r--r--  1 flip  staff    527 May  7 23:10 /Users/flip/Library/Caches/Homebrew/downloads/0d64e9cbd0e6c33fdc673fa42d791b8bfce995122ac2491728d0f70a0472f017--patch-proctools-fmt.c.diff
-rw-r--r--  1 flip  staff  41596 Oct 17  2019 /Users/flip/Library/Caches/Homebrew/downloads/16a1844d654e6ed83c44c868817a4dc9460542ca1f8e8cf0214d1b9f7be6ba14--proctools-0.4pre1.catalina.bottle.tar.gz
-rw-r--r--  1 flip  staff    347 May  7 23:10 /Users/flip/Library/Caches/Homebrew/downloads/48c202c7012595b13b2e03de19b99b990dbca26232781d8baecc751ddf5b8d2a--patch-proctools-proctools.h.diff
-rw-r--r--  1 flip  staff   1265 May  7 23:10 /Users/flip/Library/Caches/Homebrew/downloads/70cb461d44bd244b5b7985439efcb513014e8f16598f25b47c509bbdc4676615--patch-proctools-proctools.c.diff
-rw-r--r--  1 flip  staff  29052 Dec  6  2003 /Users/flip/Library/Caches/Homebrew/downloads/fb535f0160802e09a91d9de49d39835b3a4c64586a8ba71ec79a2a14aecc638c--proctools-0.4pre1.tar.gz

meriadoc /usr/local$ brew install proctools
==> Downloading https://homebrew.bintray.com/bottles/proctools-0.4pre1.catalina.bottle.tar.gz
Already downloaded: /Users/flip/Library/Caches/Homebrew/downloads/16a1844d654e6ed83c44c868817a4dc9460542ca1f8e8cf0214d1b9f7be6ba14--proctools-0.4pre1.catalina.bottle.tar.gz
==> Pouring proctools-0.4pre1.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/proctools/0.4pre1: 10 files, 136.9KB
meriadoc /usr/local$ which pgrep
/usr/local/bin/pgrep
meriadoc /usr/local$ pgrep -P 70195
(correct output)
mrflip commented 4 years ago

Somehow the bug has returned, and on reinstall from scratch I can reproduce the error.

SMillerDev commented 4 years ago

This seems like an upstream issue then. If it worked some time.

mrflip commented 4 years ago

Project seems so stable it's moribund, hasn't updated since 2013ish. I'm wondering if it's a MacOS conflict — like a sandboxing thing?

Can we leave it open for a bit to see if anyone else hits this?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.