Skip to content

$PATH is changed during patch execution #38

@kenjis

Description

@kenjis

This may be an issue on macOS, $PATH is changed in src/patch.
So it may change the php binary version, and may install unexpected versions of the packages.

In my case, I have both /usr/local/opt/php@8.2/bin/php (8.2) and /usr/local/bin/php (8.3).
I expect that PHP 8.2 is used, but patch uses PHP 8.3.

  • OS: macOS 12.7.2
  • Shell: bash
$ vendor/bin/patch
bin/patch
/usr/local/opt/mysql@5.6/bin:/usr/local/opt/curl/bin:/usr/local/opt/openldap/sbin:/usr/local/opt/openldap/bin:/usr/local/opt/openssl@1.1/bin:/usr/local/opt/php@8.2/sbin:/usr/local/opt/php@8.2/bin:./vendor/bin:/Users/kenji/.composer/vendor/bin:/Users/kenji/.nodebrew/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/kenji/bin

src/patch
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/opt/mysql@5.6/bin:/usr/local/opt/curl/bin:/usr/local/opt/openldap/sbin:/usr/local/opt/openldap/bin:/usr/local/opt/openssl@1.1/bin:/usr/local/opt/php@8.2/sbin:/usr/local/opt/php@8.2/bin:./vendor/bin:/Users/kenji/.composer/vendor/bin:/Users/kenji/.nodebrew/current/bin:/Users/kenji/bin
--- vendor/bin/patch.bk	2023-09-29 13:02:52.000000000 +0900
+++ vendor/bin/patch	2024-01-21 13:37:11.000000000 +0900
@@ -1,5 +1,9 @@
 #!/usr/bin/env sh
 
+echo "bin/patch"
+echo $PATH
+echo
+
 # Support bash to support `source` with fallback on $0 if this does not run with bash
 # https://stackoverflow.com/a/35006505/6512
 selfArg="$BASH_SOURCE"
--- vendor/tatter/patches/src/patch.bk	2023-09-26 21:23:22.000000000 +0900
+++ vendor/tatter/patches/src/patch	2024-01-21 13:37:04.000000000 +0900
@@ -1,5 +1,9 @@
 #!/bin/sh -l
 
+echo "src/patch"
+echo $PATH
+exit
+
 ##
 # Tatter\Patches
 # https://github.com/tattersoftware/codeigniter4-patches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions