Bug 280134 - lang/php*: rename rc script to comply to the rc scripting recommendations
Summary: lang/php*: rename rc script to comply to the rc scripting recommendations
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-05 07:54 UTC by Alexander Leidinger
Modified: 2024-11-20 04:20 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (bofh)


Attachments
fbring rc script in-line with the rest of the ports collection (4.33 KB, patch)
2024-07-05 07:54 UTC, Alexander Leidinger
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Leidinger freebsd_committer freebsd_triage 2024-07-05 07:54:58 UTC
Created attachment 251877 [details]
fbring rc script in-line with the rest of the ports collection

Hi,

The attached patch fixes some issues with the rc script.

A generic discussion about the rc scripts in the ports collection which contains a lot more background information about the "why" of this patch is at 
    https://lists.freebsd.org/archives/freebsd-ports/2024-July/006342.html

Short:
 - the filename shall be the same as the content of the name variable inside the script
 - PROVIDE shall be the same as the content of the name variable inside the script
 - this fixes the use of the script with service jails
	
Additionally to what is discussed there and fixed in the patch, I made the following additional changes:
 - fix the variable names in the comments to comply to the reality inside the script
 - lang/php82: contains also the service jails options variable you have already committed to lang/php8[13] (simply because I have it in my poudriere tree I generated this patch from)
 - add an UPATING entry (date needs to be adapted)

You may want to run the following before applying the patch:
  git mv lang/php81/files/php-fpm.in lang/php81/files/php_fpm.in
  git mv lang/php82/files/php-fpm.in lang/php82/files/php_fpm.in
  git mv lang/php83/files/php-fpm.in lang/php83/files/php_fpm.in
  
This is tested with lang/php83 in multiple places with service jails.

Bye,
Alexander.
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-07-27 13:08:25 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0f438952da055c26e2b55288f2e406bc5b5e474a

commit 0f438952da055c26e2b55288f2e406bc5b5e474a
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-07-27 12:13:00 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-07-27 13:06:58 +0000

    lang/php81: Fix build with libxml 2.12 and newer

    - Rename rc script to comply to the rc scripting recommendations [1]

    PR: 280153, 280134 [1]
    Co-authored-by: Alexander Leidinger <netchild@FreeBSD.org>
    Co-authored-by: Daniel Engberg <diizzy@FreeBSD.org>

 UPDATING                                    | 15 +++++++++++++++
 lang/php81/Makefile                         |  8 ++++++--
 lang/php81/distinfo                         |  6 +++++-
 lang/php81/files/{php-fpm.in => php_fpm.in} |  6 +++---
 4 files changed, 29 insertions(+), 6 deletions(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-07-28 13:16:53 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=55272c38747e54876219ffcb73050514bfd21d0d

commit 55272c38747e54876219ffcb73050514bfd21d0d
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-07-28 00:19:11 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-07-28 13:15:15 +0000

    lang/php83: Update version 8.3.8=>8.3.9

    - Rename rc script to comply to the rc scripting recommendations [1]

    Changelog: https://www.php.net/ChangeLog-8.php#PHP_8_3

    PR: 280134 [1]
    Co-authored-by: Alexander Leidinger <netchild@FreeBSD.org>

 UPDATING                                    | 2 +-
 lang/php83/Makefile                         | 4 ++--
 lang/php83/distinfo                         | 6 +++---
 lang/php83/files/{php-fpm.in => php_fpm.in} | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)
Comment 3 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2024-07-28 13:17:59 UTC
On php82 this will be done sometimes next month when a new release is available.
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-08-30 08:26:59 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=442de7e4088a04a775d6948eac90d968775d748a

commit 442de7e4088a04a775d6948eac90d968775d748a
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-08-30 08:16:37 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-08-30 08:18:53 +0000

    lang/php82: Update version 8.2.22=>8.2.23

    - Rename rc script to comply to the rc scripting recommendations [1]

    Changelog: https://www.php.net/ChangeLog-8.php#8.2.23

    PR: 280134 [1]
    Co-authored-by: Alexander Leidinger <netchild@FreeBSD.org>

 UPDATING                                    | 2 +-
 lang/php82/Makefile                         | 4 ++--
 lang/php82/distinfo                         | 6 +++---
 lang/php82/files/{php-fpm.in => php_fpm.in} | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)
Comment 5 Bryan Drewery freebsd_committer freebsd_triage 2024-10-17 03:08:06 UTC
FYI this breaks a lot of automations that expect "service php-fpm" to work. Perhaps some kind of compatibility is needed for changes like this.
Comment 6 Bryan Drewery freebsd_committer freebsd_triage 2024-10-17 04:02:29 UTC
(In reply to Bryan Drewery from comment #5)

I put this on my systems and moved on https://people.freebsd.org/~bdrewery/patches/usr.sbin-service-hyphen-compat.patch
Comment 7 Alexander Leidinger freebsd_committer freebsd_triage 2024-10-17 12:06:41 UTC
(In reply to Bryan Drewery from comment #5)
It was a bug in the first place to have it with a hyphen. The language in the corresponding docs didn't spell it out directly (fixed recently), but having the filename different from rc variable name was not intended. So this is basically fixing a bug. So far I have added UPDATING entries every time I committed a fix myself, and suggested to do so at every PR.
Comment 8 Alexander Leidinger freebsd_committer freebsd_triage 2024-10-17 12:09:04 UTC
(In reply to Bryan Drewery from comment #6)

I understand your interest in this patch, it surely is an easy way forward (depending on how much places have this, is surely is even the least work intensive).

On the other hand I'm not sure if it is a good idea to have something like your patch in the base system.

The number of ports violating the naming scheme is small compared to the total number of rc scripts in the ports collection.
Comment 9 Yasuhito FUTATSUKI 2024-11-20 04:20:02 UTC
The commits on Jul-Aug 2024 breaks rc script for profile support.

diff --git a/lang/php81/files/php_fpm.in b/lang/php81/files/php_fpm.in
index 12253b537b2e..a43173247844 100644
--- a/lang/php81/files/php_fpm.in
+++ b/lang/php81/files/php_fpm.in
@@ -53,7 +53,7 @@ else
         if [ "x${php_fpm_profiles}" != "x" -a "x$1" != "x" ]; then
                 for profile in ${php_fpm_profiles}; do
                         echo "===> php_fpm profile: ${profile}"
-                        /usr/local/etc/rc.d/php-fpm $1 ${profile}
+                        /usr/local/etc/rc.d/php_fpm $1 ${profile}
                         retcode="$?"
                         if [ "0${retcode}" -ne 0 ]; then
                                 failed="${profile} (${retcode}) ${failed:-}"