{"thread":{"id":"61993","subject":"[PATCH] exec_cmd: RUNTIME_PREFIX on z/OS systems","startedAt":"2024-08-22T13:52:16Z","lastAt":"2024-08-27T06:18:07Z","messageCount":4,"participants":["Haritha via GitGitGadget","Junio C Hamano","Haritha D"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"501536","messageId":"pull.1769.git.git.1724334732249.gitgitgadget@gmail.com","threadId":"61993","inReplyTo":null,"subject":"[PATCH] exec_cmd: RUNTIME_PREFIX on z/OS systems","fromName":"Haritha via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-08-22T13:52:12Z","receivedAt":"2024-08-22T13:52:16Z","isPatch":true,"sender":{"key":"name:Haritha","avatar":null},"body":"From: D Harithamma <harithamma.d@ibm.com>\n\nEnable Git to resolve its own binary location using __getprogramdir\nand getprogname.\n\nSince /proc is not a mandatory filesystem on z/OS, we cannot rely on the\ngit_get_exec_path_procfs method to determine Git's executable path. To\naddress this, we have implemented git_get_exec_path_zos, which resolves\nthe executable path by extracting it from the current program's\ndirectory and filename.\n\nSigned-off-by: D Harithamma <harithamma.d@ibm.com>\n---\n    exec_cmd: RUNTIME_PREFIX on z/OS systems\n    \n    Enable Git to resolve its own binary location using __getprogramdir and\n    getprogname.\n    \n    Since /proc is not a mandatory filesystem on z/OS, we cannot rely on the\n    git_get_exec_path_procfs method to determine Git's executable path. To\n    address this, we have implemented git_get_exec_path_zos, which resolves\n    the executable path by extracting it from the current program's\n    directory and filename.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1769%2FHarithaIBM%2FexecmdFix-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1769/HarithaIBM/execmdFix-v1\nPull-Request: https://github.com/git/git/pull/1769\n\n Makefile         |  8 ++++++++\n config.mak.uname |  1 +\n exec-cmd.c       | 23 +++++++++++++++++++++++\n 3 files changed, 32 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex a87e18b317d..bdc68234823 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -385,6 +385,10 @@ include shared.mak\n # supports calling _NSGetExecutablePath to retrieve the path of the running\n # executable.\n #\n+# When using RUNTIME_PREFIX, define HAVE_ZOS_GET_EXECUTABLE_PATH if your platform\n+# supports calling __getprogramdir and getprogname to retrieve the path of the\n+# running executable.\n+#\n # When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers\n # the global variable _wpgmptr containing the absolute path of the current\n # executable (this is the case on Windows).\n@@ -2155,6 +2159,10 @@ ifdef HAVE_NS_GET_EXECUTABLE_PATH\n \tBASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH\n endif\n \n+ifdef HAVE_ZOS_GET_EXECUTABLE_PATH\n+        BASIC_CFLAGS += -DHAVE_ZOS_GET_EXECUTABLE_PATH\n+endif\n+\n ifdef HAVE_WPGMPTR\n \tBASIC_CFLAGS += -DHAVE_WPGMPTR\n endif\ndiff --git a/config.mak.uname b/config.mak.uname\nindex aa0fd26bd53..904bcf35987 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -648,6 +648,7 @@ ifeq ($(uname_S),OS/390)\n \tNO_GECOS_IN_PWENT = YesPlease\n \tHAVE_STRINGS_H = YesPlease\n \tNEEDS_MODE_TRANSLATION = YesPlease\n+\tHAVE_ZOS_GET_EXECUTABLE_PATH = YesPlease\n endif\n ifeq ($(uname_S),MINGW)\n         ifeq ($(shell expr \"$(uname_R)\" : '1\\.'),2)\ndiff --git a/exec-cmd.c b/exec-cmd.c\nindex 909777f61f4..507e67d528b 100644\n--- a/exec-cmd.c\n+++ b/exec-cmd.c\n@@ -150,6 +150,25 @@ static int git_get_exec_path_darwin(struct strbuf *buf)\n }\n #endif /* HAVE_NS_GET_EXECUTABLE_PATH */\n \n+#ifdef HAVE_ZOS_GET_EXECUTABLE_PATH\n+/*\n+ * Resolves the executable path from current program's directory and name.\n+ *\n+ * Returns 0 on success, -1 on failure.\n+ */\n+static int git_get_exec_path_zos(struct strbuf *buf)\n+{\n+\tchar *dir = __getprogramdir();\n+\tchar *exe = getprogname();\n+\tif (dir && exe) {\n+\t\tstrbuf_addf(buf, \"%s/%s\", dir, exe);\n+\t\treturn 0;\n+\t}\n+\treturn -1;\n+}\n+\n+#endif /* HAVE_ZOS_GET_EXECUTABLE_PATH */\n+\n #ifdef HAVE_WPGMPTR\n /*\n  * Resolves the executable path by using the global variable _wpgmptr.\n@@ -206,6 +225,10 @@ static int git_get_exec_path(struct strbuf *buf, const char *argv0)\n \t\tgit_get_exec_path_wpgmptr(buf) &&\n #endif /* HAVE_WPGMPTR */\n \n+#ifdef HAVE_ZOS_GET_EXECUTABLE_PATH\n+\t\tgit_get_exec_path_zos(buf) &&\n+#endif /*HAVE_ZOS_GET_EXECUTABLE_PATH */\n+\n \t\tgit_get_exec_path_from_argv0(buf, argv0)) {\n \t\treturn -1;\n \t}\n\nbase-commit: 3a7362eb9fad0c4838f5cfaa95ed3c51a4c18d93\n-- \ngitgitgadget\n"},{"id":"501542","messageId":"xmqqplq0tur4.fsf@gitster.g","threadId":"61993","inReplyTo":"pull.1769.git.git.1724334732249.gitgitgadget@gmail.com","subject":"Re: [PATCH] exec_cmd: RUNTIME_PREFIX on z/OS systems","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-08-22T15:58:07Z","receivedAt":"2024-08-22T15:58:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Haritha  via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n>  Makefile         |  8 ++++++++\n>  config.mak.uname |  1 +\n>  exec-cmd.c       | 23 +++++++++++++++++++++++\n>  3 files changed, 32 insertions(+)\n>\n> diff --git a/Makefile b/Makefile\n> index a87e18b317d..bdc68234823 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -385,6 +385,10 @@ include shared.mak\n>  # supports calling _NSGetExecutablePath to retrieve the path of the running\n>  # executable.\n>  #\n> +# When using RUNTIME_PREFIX, define HAVE_ZOS_GET_EXECUTABLE_PATH if your platform\n> +# supports calling __getprogramdir and getprogname to retrieve the path of the\n> +# running executable.\n> +#\n>  # When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers\n>  # the global variable _wpgmptr containing the absolute path of the current\n>  # executable (this is the case on Windows).\n\nIt is a bit puzzling why this new thing is not added after the last\nexisting one in the same family of \"When using RUNTIME_PREFIX\".  Our\nusual convention to order things that have no inherent logical order\namong them is either to add the new one at the end or order them\nalphabetically.  This comment applies to the other additions to an\nexisting list (e.g. cascade of git_get_exec_$SYSTEM() calls in\ngit_get_exec_path() function).\n\nIn any case, we should reorganize this section a bit to make it more\nobvious that the options from HAVE_BSD_KERN_PROC_SYSCTL to\nHAVE_WPGMPTR are the ones that affect how RUNTIME_PREFIX finds the\nprogram location, but that is outside the scope of this topic.\n\nThe remainder of the patch looked perfectly in line with the\nexisting practice (except for where the new thing is added, which I\nalready mentioned); I do not do zos so I'll have to take your word\nfor the implementation of git_get_exec_path_zos(), though ;-)\n\nThe following shows how I would fix what I found annoying while\nstudying the existing code to prepare this review.  None of it\nshould be part of this topic (even though it could become a\npreliminary clean-up step if we wanted to), but since I wrote it\nalready, I'll record it here on the list as #leftoverbits.\n\nThanks.\n\n Makefile   | 26 ++++++++++++++------------\n exec-cmd.c | 20 +++++++++-----------\n 2 files changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git c/Makefile w/Makefile\nindex 41dfa0bad2..910aec0973 100644\n--- c/Makefile\n+++ w/Makefile\n@@ -373,21 +373,23 @@ include shared.mak\n # Perl scripts to use a modified entry point header allowing them to resolve\n # support files at runtime.\n #\n-# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform\n-# supports the KERN_PROC BSD sysctl function.\n+# When using RUNTIME_PREFIX:\n #\n-# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform\n-# mounts a \"procfs\" filesystem capable of resolving the path of the current\n-# executable. If defined, this must be the canonical path for the \"procfs\"\n-# current executable path.\n+# - define HAVE_BSD_KERN_PROC_SYSCTL if your platform supports the\n+#   KERN_PROC BSD sysctl function.\n #\n-# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform\n-# supports calling _NSGetExecutablePath to retrieve the path of the running\n-# executable.\n+# - define PROCFS_EXECUTABLE_PATH if your platform mounts a \"procfs\"\n+#   filesystem capable of resolving the path of the current\n+#   executable. If defined, this must be the canonical path for the\n+#   \"procfs\" current executable path.\n #\n-# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers\n-# the global variable _wpgmptr containing the absolute path of the current\n-# executable (this is the case on Windows).\n+# - define HAVE_NS_GET_EXECUTABLE_PATH if your platform supports\n+#   calling _NSGetExecutablePath to retrieve the path of the running\n+#   executable.\n+#\n+# - define HAVE_WPGMPTR if your platform offers the global variable\n+#   _wpgmptr containing the absolute path of the current executable\n+#   (this is the case on Windows).\n #\n # INSTALL_STRIP can be set to \"-s\" to strip binaries during installation,\n # if your $(INSTALL) command supports the option.\ndiff --git c/exec-cmd.c w/exec-cmd.c\nindex 909777f61f..54bc7ed304 100644\n--- c/exec-cmd.c\n+++ w/exec-cmd.c\n@@ -100,6 +100,8 @@ static int git_get_exec_path_procfs(struct strbuf *buf)\n \t}\n \treturn -1;\n }\n+#else\n+# define git_get_exec_path_procfs(ignore) 1\n #endif /* PROCFS_EXECUTABLE_PATH */\n \n #ifdef HAVE_BSD_KERN_PROC_SYSCTL\n@@ -127,6 +129,8 @@ static int git_get_exec_path_bsd_sysctl(struct strbuf *buf)\n \t}\n \treturn -1;\n }\n+#else\n+# define git_get_exec_path_bsd_sysctl(ignore) 1\n #endif /* HAVE_BSD_KERN_PROC_SYSCTL */\n \n #ifdef HAVE_NS_GET_EXECUTABLE_PATH\n@@ -148,6 +152,8 @@ static int git_get_exec_path_darwin(struct strbuf *buf)\n \t}\n \treturn -1;\n }\n+#else\n+# define git_get_exec_path_darwin(ignore) 1\n #endif /* HAVE_NS_GET_EXECUTABLE_PATH */\n \n #ifdef HAVE_WPGMPTR\n@@ -166,6 +172,8 @@ static int git_get_exec_path_wpgmptr(struct strbuf *buf)\n \tbuf->len += len;\n \treturn 0;\n }\n+#else\n+# define git_get_exec_path_wpgmptr(ignore) 1\n #endif /* HAVE_WPGMPTR */\n \n /*\n@@ -190,22 +198,12 @@ static int git_get_exec_path(struct strbuf *buf, const char *argv0)\n \t * after the first successful method.\n \t */\n \tif (\n-#ifdef HAVE_BSD_KERN_PROC_SYSCTL\n \t\tgit_get_exec_path_bsd_sysctl(buf) &&\n-#endif /* HAVE_BSD_KERN_PROC_SYSCTL */\n-\n-#ifdef HAVE_NS_GET_EXECUTABLE_PATH\n \t\tgit_get_exec_path_darwin(buf) &&\n-#endif /* HAVE_NS_GET_EXECUTABLE_PATH */\n-\n-#ifdef PROCFS_EXECUTABLE_PATH\n \t\tgit_get_exec_path_procfs(buf) &&\n-#endif /* PROCFS_EXECUTABLE_PATH */\n-\n-#ifdef HAVE_WPGMPTR\n \t\tgit_get_exec_path_wpgmptr(buf) &&\n-#endif /* HAVE_WPGMPTR */\n \n+\t\t/* fallback -- must be at the end */\n \t\tgit_get_exec_path_from_argv0(buf, argv0)) {\n \t\treturn -1;\n \t}\n"},{"id":"501609","messageId":"xmqqa5h3p46t.fsf@gitster.g","threadId":"61993","inReplyTo":"xmqqplq0tur4.fsf@gitster.g","subject":"Re: [PATCH] exec_cmd: RUNTIME_PREFIX on z/OS systems","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-08-23T16:57:46Z","receivedAt":"2024-08-23T16:57:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> The following shows how I would fix what I found annoying while\n> studying the existing code to prepare this review.  None of it\n> should be part of this topic (even though it could become a\n> preliminary clean-up step if we wanted to), but since I wrote it\n> already, I'll record it here on the list as #leftoverbits.\n>\n> Thanks.\n\nI'll take your patch as-is and merge it down to 'next'.\n\nOnce the dust settles from this topic, I'll see if we want to do\nfurther clean-ups (the \"how-about\" patch below, possibly also\nreorder them alphabetically) so for now, I'd leave #leftoverbits\nmark here.\n\n\n>  Makefile   | 26 ++++++++++++++------------\n>  exec-cmd.c | 20 +++++++++-----------\n>  2 files changed, 23 insertions(+), 23 deletions(-)\n>\n> diff --git c/Makefile w/Makefile\n> index 41dfa0bad2..910aec0973 100644\n> --- c/Makefile\n> +++ w/Makefile\n> @@ -373,21 +373,23 @@ include shared.mak\n>  # Perl scripts to use a modified entry point header allowing them to resolve\n>  # support files at runtime.\n>  #\n> -# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform\n> -# supports the KERN_PROC BSD sysctl function.\n> +# When using RUNTIME_PREFIX:\n>  #\n> -# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform\n> -# mounts a \"procfs\" filesystem capable of resolving the path of the current\n> -# executable. If defined, this must be the canonical path for the \"procfs\"\n> -# current executable path.\n> +# - define HAVE_BSD_KERN_PROC_SYSCTL if your platform supports the\n> +#   KERN_PROC BSD sysctl function.\n>  #\n> -# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform\n> -# supports calling _NSGetExecutablePath to retrieve the path of the running\n> -# executable.\n> +# - define PROCFS_EXECUTABLE_PATH if your platform mounts a \"procfs\"\n> +#   filesystem capable of resolving the path of the current\n> +#   executable. If defined, this must be the canonical path for the\n> +#   \"procfs\" current executable path.\n>  #\n> -# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers\n> -# the global variable _wpgmptr containing the absolute path of the current\n> -# executable (this is the case on Windows).\n> +# - define HAVE_NS_GET_EXECUTABLE_PATH if your platform supports\n> +#   calling _NSGetExecutablePath to retrieve the path of the running\n> +#   executable.\n> +#\n> +# - define HAVE_WPGMPTR if your platform offers the global variable\n> +#   _wpgmptr containing the absolute path of the current executable\n> +#   (this is the case on Windows).\n>  #\n>  # INSTALL_STRIP can be set to \"-s\" to strip binaries during installation,\n>  # if your $(INSTALL) command supports the option.\n> diff --git c/exec-cmd.c w/exec-cmd.c\n> index 909777f61f..54bc7ed304 100644\n> --- c/exec-cmd.c\n> +++ w/exec-cmd.c\n> @@ -100,6 +100,8 @@ static int git_get_exec_path_procfs(struct strbuf *buf)\n>  \t}\n>  \treturn -1;\n>  }\n> +#else\n> +# define git_get_exec_path_procfs(ignore) 1\n>  #endif /* PROCFS_EXECUTABLE_PATH */\n>  \n>  #ifdef HAVE_BSD_KERN_PROC_SYSCTL\n> @@ -127,6 +129,8 @@ static int git_get_exec_path_bsd_sysctl(struct strbuf *buf)\n>  \t}\n>  \treturn -1;\n>  }\n> +#else\n> +# define git_get_exec_path_bsd_sysctl(ignore) 1\n>  #endif /* HAVE_BSD_KERN_PROC_SYSCTL */\n>  \n>  #ifdef HAVE_NS_GET_EXECUTABLE_PATH\n> @@ -148,6 +152,8 @@ static int git_get_exec_path_darwin(struct strbuf *buf)\n>  \t}\n>  \treturn -1;\n>  }\n> +#else\n> +# define git_get_exec_path_darwin(ignore) 1\n>  #endif /* HAVE_NS_GET_EXECUTABLE_PATH */\n>  \n>  #ifdef HAVE_WPGMPTR\n> @@ -166,6 +172,8 @@ static int git_get_exec_path_wpgmptr(struct strbuf *buf)\n>  \tbuf->len += len;\n>  \treturn 0;\n>  }\n> +#else\n> +# define git_get_exec_path_wpgmptr(ignore) 1\n>  #endif /* HAVE_WPGMPTR */\n>  \n>  /*\n> @@ -190,22 +198,12 @@ static int git_get_exec_path(struct strbuf *buf, const char *argv0)\n>  \t * after the first successful method.\n>  \t */\n>  \tif (\n> -#ifdef HAVE_BSD_KERN_PROC_SYSCTL\n>  \t\tgit_get_exec_path_bsd_sysctl(buf) &&\n> -#endif /* HAVE_BSD_KERN_PROC_SYSCTL */\n> -\n> -#ifdef HAVE_NS_GET_EXECUTABLE_PATH\n>  \t\tgit_get_exec_path_darwin(buf) &&\n> -#endif /* HAVE_NS_GET_EXECUTABLE_PATH */\n> -\n> -#ifdef PROCFS_EXECUTABLE_PATH\n>  \t\tgit_get_exec_path_procfs(buf) &&\n> -#endif /* PROCFS_EXECUTABLE_PATH */\n> -\n> -#ifdef HAVE_WPGMPTR\n>  \t\tgit_get_exec_path_wpgmptr(buf) &&\n> -#endif /* HAVE_WPGMPTR */\n>  \n> +\t\t/* fallback -- must be at the end */\n>  \t\tgit_get_exec_path_from_argv0(buf, argv0)) {\n>  \t\treturn -1;\n>  \t}\n"},{"id":"501714","messageId":"EF383555-7AB3-4253-9136-FDC798568B0F@ibm.com","threadId":"61993","inReplyTo":"xmqqa5h3p46t.fsf@gitster.g","subject":"RE: [PATCH] exec_cmd: RUNTIME_PREFIX on z/OS systems","fromName":"Haritha D","fromEmail":"harithamma.d@ibm.com","sentAt":"2024-08-27T06:18:03Z","receivedAt":"2024-08-27T06:18:07Z","isPatch":true,"sender":{"key":"harithamma.d@ibm.com","avatar":"https://avatars.githubusercontent.com/u/112700353?v=4"},"body":"Hi Junio,\n\nI was away for a few days and, therefore, couldn’t respond sooner. Thank you for reviewing and accepting the changes.\n\nBest regards,\nHaritha\n\n﻿On 23/08/24, 10:28 PM, \"Junio C Hamano\" <gitster@pobox.com <mailto:gitster@pobox.com>> wrote:\n\n\nJunio C Hamano <gitster@pobox.com <mailto:gitster@pobox.com>> writes:\n\n\n> The following shows how I would fix what I found annoying while\n> studying the existing code to prepare this review. None of it\n> should be part of this topic (even though it could become a\n> preliminary clean-up step if we wanted to), but since I wrote it\n> already, I'll record it here on the list as #leftoverbits.\n>\n> Thanks.\n\n\nI'll take your patch as-is and merge it down to 'next'.\n\n\nOnce the dust settles from this topic, I'll see if we want to do\nfurther clean-ups (the \"how-about\" patch below, possibly also\nreorder them alphabetically) so for now, I'd leave #leftoverbits\nmark here.\n\n\n\n\n> Makefile | 26 ++++++++++++++------------\n> exec-cmd.c | 20 +++++++++-----------\n> 2 files changed, 23 insertions(+), 23 deletions(-)\n>\n> diff --git c/Makefile w/Makefile\n> index 41dfa0bad2..910aec0973 100644\n> --- c/Makefile\n> +++ w/Makefile\n> @@ -373,21 +373,23 @@ include shared.mak\n> # Perl scripts to use a modified entry point header allowing them to resolve\n> # support files at runtime.\n> #\n> -# When using RUNTIME_PREFIX, define HAVE_BSD_KERN_PROC_SYSCTL if your platform\n> -# supports the KERN_PROC BSD sysctl function.\n> +# When using RUNTIME_PREFIX:\n> #\n> -# When using RUNTIME_PREFIX, define PROCFS_EXECUTABLE_PATH if your platform\n> -# mounts a \"procfs\" filesystem capable of resolving the path of the current\n> -# executable. If defined, this must be the canonical path for the \"procfs\"\n> -# current executable path.\n> +# - define HAVE_BSD_KERN_PROC_SYSCTL if your platform supports the\n> +# KERN_PROC BSD sysctl function.\n> #\n> -# When using RUNTIME_PREFIX, define HAVE_NS_GET_EXECUTABLE_PATH if your platform\n> -# supports calling _NSGetExecutablePath to retrieve the path of the running\n> -# executable.\n> +# - define PROCFS_EXECUTABLE_PATH if your platform mounts a \"procfs\"\n> +# filesystem capable of resolving the path of the current\n> +# executable. If defined, this must be the canonical path for the\n> +# \"procfs\" current executable path.\n> #\n> -# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers\n> -# the global variable _wpgmptr containing the absolute path of the current\n> -# executable (this is the case on Windows).\n> +# - define HAVE_NS_GET_EXECUTABLE_PATH if your platform supports\n> +# calling _NSGetExecutablePath to retrieve the path of the running\n> +# executable.\n> +#\n> +# - define HAVE_WPGMPTR if your platform offers the global variable\n> +# _wpgmptr containing the absolute path of the current executable\n> +# (this is the case on Windows).\n> #\n> # INSTALL_STRIP can be set to \"-s\" to strip binaries during installation,\n> # if your $(INSTALL) command supports the option.\n> diff --git c/exec-cmd.c w/exec-cmd.c\n> index 909777f61f..54bc7ed304 100644\n> --- c/exec-cmd.c\n> +++ w/exec-cmd.c\n> @@ -100,6 +100,8 @@ static int git_get_exec_path_procfs(struct strbuf *buf)\n> }\n> return -1;\n> }\n> +#else\n> +# define git_get_exec_path_procfs(ignore) 1\n> #endif /* PROCFS_EXECUTABLE_PATH */\n> \n> #ifdef HAVE_BSD_KERN_PROC_SYSCTL\n> @@ -127,6 +129,8 @@ static int git_get_exec_path_bsd_sysctl(struct strbuf *buf)\n> }\n> return -1;\n> }\n> +#else\n> +# define git_get_exec_path_bsd_sysctl(ignore) 1\n> #endif /* HAVE_BSD_KERN_PROC_SYSCTL */\n> \n> #ifdef HAVE_NS_GET_EXECUTABLE_PATH\n> @@ -148,6 +152,8 @@ static int git_get_exec_path_darwin(struct strbuf *buf)\n> }\n> return -1;\n> }\n> +#else\n> +# define git_get_exec_path_darwin(ignore) 1\n> #endif /* HAVE_NS_GET_EXECUTABLE_PATH */\n> \n> #ifdef HAVE_WPGMPTR\n> @@ -166,6 +172,8 @@ static int git_get_exec_path_wpgmptr(struct strbuf *buf)\n> buf->len += len;\n> return 0;\n> }\n> +#else\n> +# define git_get_exec_path_wpgmptr(ignore) 1\n> #endif /* HAVE_WPGMPTR */\n> \n> /*\n> @@ -190,22 +198,12 @@ static int git_get_exec_path(struct strbuf *buf, const char *argv0)\n> * after the first successful method.\n> */\n> if (\n> -#ifdef HAVE_BSD_KERN_PROC_SYSCTL\n> git_get_exec_path_bsd_sysctl(buf) &&\n> -#endif /* HAVE_BSD_KERN_PROC_SYSCTL */\n> -\n> -#ifdef HAVE_NS_GET_EXECUTABLE_PATH\n> git_get_exec_path_darwin(buf) &&\n> -#endif /* HAVE_NS_GET_EXECUTABLE_PATH */\n> -\n> -#ifdef PROCFS_EXECUTABLE_PATH\n> git_get_exec_path_procfs(buf) &&\n> -#endif /* PROCFS_EXECUTABLE_PATH */\n> -\n> -#ifdef HAVE_WPGMPTR\n> git_get_exec_path_wpgmptr(buf) &&\n> -#endif /* HAVE_WPGMPTR */\n> \n> + /* fallback -- must be at the end */\n> git_get_exec_path_from_argv0(buf, argv0)) {\n> return -1;\n> }\n\n\n\n"}]}