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

pgrep -o not working properly #1385

Closed
jclulow opened this issue Nov 1, 2023 · 2 comments · Fixed by #1386
Closed

pgrep -o not working properly #1385

jclulow opened this issue Nov 1, 2023 · 2 comments · Fixed by #1386

Comments

@jclulow
Copy link

jclulow commented Nov 1, 2023

On an OmniOS r151046 system, the -o option does not seem to interact well with at least the -l and -f options. For example, given this process tree:

$ ptree 16800
780    /usr/sbin/sshd
  16797  /usr/sbin/sshd -R
    16799  /usr/sbin/sshd -R
      16800  -bash
        16823  sleep 10000
        16824  sleep 20000

It would seem that pgrep -o works correctly on its own:

$ pgrep -o sleep
16823

And that pgrep -fl and -l work on their own as well:

$ pgrep -l sleep
16823 sleep
16824 sleep
$ pgrep -fl sleep
16823 sleep 10000
16824 sleep 20000

Things get weird when you mix them together:

$ pgrep -flo sleep
16823 sleep 20000

Note that it is the correct pid for -o, but the arguments are for a different process. If you get more specific, it's even weirder:

$ pgrep -flo sleep.10000
16823 sleep 20000
$ pgrep -flo sleep.20000
16824 sleep 20000

And it seems to happen for any process:

$ pgrep -Fl bash
16816 -bash
16800 -bash
$ pgrep -o bash
16800
$ pgrep -Flo bash
16800 sleep 20000

This is running on LTS bits:

$ cat /etc/os-release
NAME="OmniOS"
PRETTY_NAME="OmniOS Community Edition v11 r151046q"
CPE_NAME="cpe:/o:omniosce:omnios:11:151046:17"
ID=omnios
VERSION=r151046q
VERSION_ID=r151046q
BUILD_ID=151046.17.2023.08.24
HOME_URL="https://omnios.org/"
SUPPORT_URL="https://omnios.org/"
BUG_REPORT_URL="https://github.com/omniosorg/omnios-build/issues/new"
@danmcd
Copy link
Member

danmcd commented Nov 1, 2023

pgrep was updated initially as part of the LX port. There were some additional pulls from SmartOS, and at least in pgrep.c a backout. Perhaps there's some suffering caused by that?

@citrus-it
Copy link
Member

pgrep was updated initially as part of the LX port. There were some additional pulls from SmartOS, and at least in pgrep.c a backout. Perhaps there's some suffering caused by that?

It is part of OS-3513 ptools should see more process arguments - SmartOS needs the linked fix too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants