! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
replace ugly pidof | wc -l by pgrep
Status:
RESOLVED: MOVED
Product:
Xfce4-screensaver
Component:
General

Comments

Description Landry Breuil editbugs 2020-03-23 09:59:55 CET
seen this on OpenBSD while running in foreground:

[error_watch] gs-window-x11.c:892 (09:16:55.935):        Command output: sh: pidof: not found           

coming from https://git.xfce.org/apps/xfce4-screensaver/tree/src/gs-lock-plug.c#n174

pgrep does the same as pidof, and is present everywhere, while iirc pidof is linux only.

[23/03 09:52] landry@ansible.dmz:~/infra $pidof ssh-agent
27409 24228 23463 23415 22800 21497 19770 19760 19755 19628 19609 19273 17903 15395 7843 7833 2425 356
[23/03 09:53] landry@ansible.dmz:~/infra $pgrep ssh-agent
356
2425
7833
7843
15395
17903
19273
19609
19628
19755
19760
19770
21497
22800
23415
23463
24228
27409

and given that we merely try to detect if mdm, gdm, gdm3 or gdm-binary are running, we could avoid the uuuugly |wc -l and just check the return code of pgrep:

(on linux)

EXIT STATUS
       0      One or more processes matched the criteria. For pkill the process must also have been successfully signalled.
       1      No processes matched or none of them could be signalled.
       2      Syntax error in the command line.
       3      Fatal error: out of memory etc.

(on openbsd)

EXIT STATUS
     The pgrep and pkill utilities exit with one of the following values:

           0       One or more processes were matched.
           1       No processes were matched.
           2       Invalid options were specified on the command line.
           3       An internal error occurred.
Comment 1 Landry Breuil editbugs 2020-03-23 10:09:22 CET
see https://mywiki.wooledge.org/BadUtils#pidof for a reasoning - even if pgrep is not standardized in options (nor in POSIX), at least it's present everywhere.
Comment 2 Git Bot editbugs 2020-05-25 22:29:19 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/apps/xfce4-screensaver/-/issues/38.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #16591

Reported by:
Landry Breuil
Reported on: 2020-03-23
Last modified on: 2020-05-25

People

Assignee:
Sean Davis
CC List:
0 users

Version

Version:
unspecified

Attachments

Additional information