<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 6/12/25 09:22, Sachin T wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CO1PR15MB5003F7632DE22702C26C9F689774A@CO1PR15MB5003.namprd15.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator"
        content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US">Hi
            Jacob,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US">Thanks
            for the feedback. I’d like to clarify  the change.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US">On z/OS,
            environ is defined as a macro in <stdlib.h>:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US">#define
            environ (*(__EnvnA()))<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US">This
            causes any use of environ in user code — even inside structs
            or function parameters  to be macro-expanded in invalid
            ways. For example, the following line in spawn-posix.c:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US">char
            **environ gets rewritten by the preprocessor as: char
            **(*(__EnvnA()));<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US">act->environ
            gets rewritten by the preprocessor as:    
            act->(*(__EnvnA()));<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p>[...]</o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;mso-fareast-language:EN-US">To
            resolve this, we temporarily redefine environ around the
            inclusion of the header files that use it. This allows the
            code to compile without macro expansion issues.</span></p>
      </div>
    </blockquote>
    <p>That does not work like that in C.  The preprocessor does not
      process macro expansions prior to evaluating a #define.</p>
    <p>The only part from that part of your patch that actually has
      effect is:</p>
    <p>#if defined(__MVS__)<br>
      #undef environ<br>
      #endif</p>
    <p>If macro-expanding environ causes problems elsewhere in the code,
      I see two options:</p>
    <p>(1) Avoid using the token 'environ' except as the process global
      environment pointer.  (Perhaps we could rename the 'environ' field
      in whatever structure 'act' refers to to 'env'?)<br>
    </p>
    <p>(2) Add:</p>
    <p>#ifdef environ<br>
      #undef environ<br>
      #endif</p>
    <p>after including <stdlib.h>.  This would also handle other
      systems that define 'environ' as a macro, provided that no access
      to the process global environment is actually needed, since it
      would make environ inaccessible if a macro expansion is required.</p>
    <p><br>
    </p>
    <p>-- Jacob<br>
    </p>
  </body>
</html>