[PATCH libgpg-error] Add support for IBM z/OS

Sachin T sachin.t at ibm.com
Tue Jun 17 17:41:58 CEST 2025


Thanks.  I’ll update the patch description to mention the $(LIBS) change as well.  I’ll also rename the struct field to env for clarity.

And yes, z/OS is POSIX-compliant in general, but sometimes we run into small quirks like this environ macro.

Regards
Sachin

From: Jacob Bachmeyer <jcb62281 at gmail.com>
Date: Tuesday, 17 June 2025 at 7:33 AM
To: Sachin T <sachin.t at ibm.com>, gnupg-devel at gnupg.org <gnupg-devel at gnupg.org>
Subject: [EXTERNAL] Re: [PATCH libgpg-error] Add support for IBM z/OS
On 6/16/25 03: 21, Sachin T via Gnupg-devel wrote: Hi,   Please review the updated patch with comments from Werner, Jacob and Todd fixed.   *Renamed environ variable to avoid conflict with environ defined in z/os stdlib header First, a nit: 

On 6/16/25 03:21, Sachin T via Gnupg-devel wrote:
Hi,

Please review the updated patch with comments from Werner, Jacob and Todd fixed.

*Renamed environ variable to avoid conflict with environ defined in z/os stdlib header

First, a nit:  the renamed environ is a structure field, not a variable.  (I would have used "env" instead of "environ_p" but that is just bikeshedding.)

Second, you are still adding $(LIBS) to the build rule for mkheader and you should mention that as you previously did.

Lastly, I am probably more impressed than I should be that this is all you actually need for a z/OS port.  (The other system that I know of where "environ" is a macro is not a POSIX system.)

Regards
Sachin

---

Signed-off-by: Sachin T sachin.t at ibm.com<mailto:sachin.t at ibm.com>
---
src/Makefile.am   | 2 +-
src/spawn-posix.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index e56bb23..7e874cf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -275,7 +275,7 @@ errnos-sym.h: Makefile mkstrtable.awk errnos.in

mkheader$(EXEEXT_FOR_BUILD): mkheader.c Makefile
               $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
-              $(CPPFLAGS_FOR_BUILD) -g -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
+             $(CPPFLAGS_FOR_BUILD) -g -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c $(LIBS)

parts_of_gpg_error_h =                               \
               gpg-error.h.in  \
diff --git a/src/spawn-posix.c b/src/spawn-posix.c
index ac19761..0ffc71e 100644
--- a/src/spawn-posix.c
+++ b/src/spawn-posix.c
@@ -63,7 +63,7 @@
struct gpgrt_spawn_actions {
   int fd[3];
   const int *except_fds;
-  char **environ;
+  char **environ_p;
   const char *const *envchange;
   void (*atfork) (void *);
   void *atfork_arg;
@@ -414,8 +414,8 @@ my_exec (const char *pgmname, const char *argv[], gpgrt_spawn_actions_t act)
   if (pgmname == NULL)
     return 0;

-  if (act->environ)
-    execve (pgmname, (char *const *)argv, act->environ);
+  if (act->environ_p)
+    execve (pgmname, (char *const *)argv, act->environ_p);
   else
     execv (pgmname, (char *const *)argv);

@@ -516,7 +516,7 @@ void
_gpgrt_spawn_actions_set_environ (gpgrt_spawn_actions_t act,
                                   char **environ_for_child)
{
-  act->environ = environ_for_child;
+  act->environ_p = environ_for_child;
}

void
--
2.39.5 (Apple Git-154)



-- Jacob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20250617/2b7149ac/attachment-0001.html>


More information about the Gnupg-devel mailing list