[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #42447] Fix exporting symbols for recursive make on VMS.

From: h.becker
Subject: Re: [bug #42447] Fix exporting symbols for recursive make on VMS.
Date: Sun, 01 Jun 2014 22:22:39 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130519 Icedove/17.0.5

On 05/28/2014 07:00 AM, John Malmberg wrote:
> This patch fixes Make on VMS to export symbols so that recursive and nested
> make commands will work.
> This also exports a foreign command for the make image that was run.
> Some of the tests still fail because VMS currently does not do shell expansion
> of exported symbols.  I will be looking at adding that capability in the
> future as part of improving posix shell simulation.

Sorry, I don't understand what is menat with "VMS currently does not do
shell expansion of exported symbols." Any example?

On the other hand, wouldn't it be enough to ALWAYS generate a VMS
command procedure for an action and insert DCL symbol definitions at the
beginning of that file?

For a quick test I just changed vmsjobs.c and it seems to do the trick.
A patch/diff output based on my current sources is appended.

This would make the code change much simpler: 10-20 additional lines of
code (without checking how much code can be removed for the check
whether the action will be a one-liner or not).

This will define the DCL symbols in the sub-process and not in the
process in which make is running: no check for overwriting current
symbols, no saving of overwritten ones and no restoring of saved symbols.

As a wanted side effect, this will force DCL to read from the command
file, so DCL will do the forced symbol substitution.

Using command procedures for simple action lines is some overhead. So
procesing of "hello world" type of makefiles will take longer. But
decent projects with long action lines for compilation and linking will
not see any difference: GNU make for VMS IS made with using command

--- 8< ---

diff --git a/vmsjobs.c b/vmsjobs.c
index dadbcad..a6ce7a0 100644
--- a/vmsjobs.c
+++ b/vmsjobs.c
@@ -615,9 +615,16 @@ child_execute_job (char *argv, struct child *child)
      is desired. Forcing commands with newlines into DCLs allows to
      store search lists on user mode logicals.  */

+  /* Temporary force the creation of a command file by adding 'true' to
the 'if',
+     later, just remove the checks for one-liner code.
+     This way the symbols are only set in the sub-process and do not
affect the
+     current process; further, this way DCL reads the input stream and
+     does 'forced' symbol substitution, which it doesn't do for
one-liners */
   if (strlen (cmd) > MAXCMDLEN
       || (have_redirection != 0)
-      || (have_newline != 0))
+      || (have_newline != 0)
+      || 1)
       FILE *outfile;
       char c;
@@ -679,6 +686,21 @@ child_execute_job (char *argv, struct child *child)
             DB (DB_JOBS, (_("Redirected output to %s\n"), ofile));
             ofiledsc.dsc$w_length = 0;
+      /* Export the child environment into DCL symbols */
+      if (child->environment != 0)
+        {
+          char **ep = child->environment;
+          char *valstr;
+          while (*ep != 0)
+            {
+              valstr = strchr(*ep, '=');
+              if (valstr==NULL)
+                continue;
+              fprintf (outfile, "$ %.*s=\"%s\"\n", valstr-*ep, *ep,
+              ep++;
+            }
+        }
       fprintf (outfile, "$ %.*s_ = f$verify(%.*s_1)\n", tmpstrlen,
tmpstr, tmpstrlen, tmpstr);
       p = sep = q = cmd;
       for (c = '\n'; c; c = *q++)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]