Index: trunk/psModules/src/config/pmConfig.c
===================================================================
--- trunk/psModules/src/config/pmConfig.c	(revision 7754)
+++ trunk/psModules/src/config/pmConfig.c	(revision 7791)
@@ -3,6 +3,6 @@
  *  @author PAP, IfA
  *
- *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-06-29 20:39:56 $
+ *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-03 21:18:30 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -666,4 +666,24 @@
     config->recipesRead |= sourceType;
 
+    // Having read that, we now need to check to see if any symbolic links need to be resolved
+    recipesIter = psMetadataIteratorAlloc(config->recipesSource, PS_LIST_HEAD, NULL);
+    psMetadataItem *sourceItem = NULL;  // Item containing source, from iteration
+    while ((sourceItem = psMetadataGetAndIncrement(recipesIter))) {
+        assert(sourceItem->type == PS_TYPE_S32); // It should be this type: we put it in ourselves
+        if (sourceItem->data.S32 == P_PM_RECIPE_SOURCE_SYMBOLIC) {
+            const char *linkName = sourceItem->comment; // The name of the link
+            psMetadata *linkSource = psMetadataLookupMD(&mdok, config->recipes, linkName); // The source
+            if (!mdok || !linkSource) {
+                psLogMsg(__func__, PS_LOG_WARN, "Unable to resolve symbolic link for recipe %s to %s "
+                         "--- ignored.\n", sourceItem->name, linkName);
+                continue;
+            }
+            psMetadataItem *target = psMetadataLookup(config->recipes, sourceItem->name); // The target item
+            assert(target);             // It had better be here: it's in the "sourcesRead" metadata
+            psFree(target->data.V); // Free old copy
+            target->data.V = psMetadataCopy(NULL, linkSource);
+        }
+    }
+    psFree(recipesIter);
     return true;
 }
@@ -709,6 +729,4 @@
 
             // Command-line has the highest priority, so we don't have to check to see if it's already there
-            psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
-                             "Recipe added from command line", P_PM_RECIPE_SOURCE_CL);
 
             // Is the source a symbolic reference?
@@ -720,4 +738,8 @@
                               comment, extant);
                 psFree(comment);
+                // Put the source in the comment, so we can retrieve it again if we need it
+                psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
+                                 recipeSource, P_PM_RECIPE_SOURCE_SYMBOLIC);
+
             } else {
                 // Otherwise, treat the source as a filename
@@ -730,4 +752,6 @@
                     psFree(comment);
                     psFree(recipe);                 // Drop reference
+                    psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
+                                     "Recipe added from command line", P_PM_RECIPE_SOURCE_CL);
                 }
             }
