Bug 247098

Summary: x11/slim: Make slim service stoppable again
Product: Ports & Packages Reporter: Samy Mahmoudi <samy.mahmoudi>
Component: Individual Port(s)Assignee: Jesper Schmitz Mouridsen <jsm>
Status: Closed FIXED    
Severity: Affects Many People CC: henry.hu.sh, jsm
Priority: --- Keywords: needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (henry.hu.sh)
koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch file generated with svn diff
none
Patch file generated with svn diff none

Description Samy Mahmoudi 2020-06-08 22:03:06 UTC
- Make slim service stoppable again, since X changed to Xorg
- Remove a useless grep call, as using brackets in a grep pattern and piping into "grep -v grep" is redundant
- Remove an extra leading tab
Comment 1 Samy Mahmoudi 2020-06-08 22:04:54 UTC
Created attachment 215379 [details]
Patch file generated with svn diff
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2020-06-09 03:33:48 UTC
@Reporter/maintainer: Is quarterly also affected?
Comment 3 Samy Mahmoudi 2020-06-09 11:50:17 UTC
(In reply to Kubilay Kocak from comment #2)
Yes, I think so. Besides, we would obviously require a PORTREVISION bump.
Comment 4 Samy Mahmoudi 2020-06-09 12:05:42 UTC
(In reply to Kubilay Kocak from comment #2)
From now I will always capitalize the first word of the summary ;-)
Did you remove the [patch] prefix to increase readability?
Comment 5 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2020-06-19 21:10:33 UTC
(In reply to Samy Mahmoudi from comment #4)
Acutally I do not think the grep -v grep is redundant since ps also catches the grep command it self.
could you test with 
pgrep Xorg | xargs ps -p | grep 'auth /var/run/slim.auth' instead?
Comment 6 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2020-06-19 22:18:00 UTC
(In reply to Jesper Schmitz Mouridsen from comment #5)
pgrep -f "Xorg.*-auth /var/run/slim.auth" might be better
Comment 7 Samy Mahmoudi 2020-06-20 06:49:44 UTC
(In reply to Jesper Schmitz Mouridsen from comment #5)

> Actually I do not think the grep -v grep is redundant
> since ps also catches the grep command itself.
ps does catch and output the grep command, but the following is still redundant: grep '/bin/[X]org .* -auth /var/run/slim.auth' | grep -v grep

I think you missed out on the brackets in my point. I did not say the second grep command is useless just because we use grep before. I am saying the second grep command is useless because the first one already filters out the grep command from the output of ps:

The shell does not expand quoted strings, so that grep '/bin/[X]org .* -auth /var/run/slim.auth' will become grep /bin/[X]org .* -auth /var/run/slim.auth in the output of ps (no more quote, but brackets still there!). Since the basic regular expression [X] matches the single character X but not the sequence of three characters [X], the first grep will possibly match a line containing /bin/Xorg .* -auth /var/run/slim.auth but certainly not the line containing /bin/[X]org .* -auth /var/run/slim.auth that corresponds to itself. Therefore the subsequent command grep -v grep is useless.

> pgrep -f "Xorg.*-auth /var/run/slim.auth" might be better
pgrep -f "Xorg.*-auth /var/run/slim.auth" is definitely better than using such a tricky bracket expression ;-)
Comment 8 Samy Mahmoudi 2020-06-20 06:58:14 UTC
Created attachment 215803 [details]
Patch file generated with svn diff
Comment 9 Samy Mahmoudi 2020-06-20 07:20:03 UTC
(In reply to Kubilay Kocak from comment #2)
What I meant by 'Yes, I think so' is that I know for sure x11/slim has not recently changed in that regard and that I think x11-servers/xorg-server has neither done so recently. This X-to-Xorg change seems old enough to me to make quarterly affected by this problem as well.
Comment 10 commit-hook freebsd_committer freebsd_triage 2020-06-28 14:58:56 UTC
A commit references this bug:

Author: jsm
Date: Sun Jun 28 14:58:44 UTC 2020
New revision: 540725
URL: https://svnweb.freebsd.org/changeset/ports/540725

Log:
  x11/slim: Correct getting xpid

  Makes slim service stoppable again

  PR:	247098
  Submitted by: Samy Mahmoudi <samy.mahmoudi@gmail.com>

Changes:
  head/x11/slim/Makefile
  head/x11/slim/files/slim.in
Comment 11 Samy Mahmoudi 2020-06-28 15:11:19 UTC
(In reply to commit-hook from comment #10)
Thanks ;-)