changeset 27833:c0ff4cb335a0

pkg: Fix order in which packages and their dependencies are loaded (bug #57403). * pkg/private/load_packages_and_dependencies.m: Replace single call of addpath by for loop.
author Philip Nienhuis <prnienhuis@users.sf.net>
date Sat, 14 Dec 2019 22:33:34 +0100
parents 8fd7d1d2a4ca
children ef6378f8e420
files scripts/pkg/private/load_packages_and_dependencies.m
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/pkg/private/load_packages_and_dependencies.m	Wed Mar 06 14:54:38 2019 -0800
+++ b/scripts/pkg/private/load_packages_and_dependencies.m	Sat Dec 14 22:33:34 2019 +0100
@@ -43,10 +43,12 @@
     endif
   endfor
 
-  ## Load the packages.
-  if (length (dirs) > 0)
-    addpath (dirs{:});
-  endif
+  ## Dependencies are sorted before their dependers in "dirs". Add them
+  ## consecutively in a for loop to the path to make sure dependencies are
+  ## added before their dependers (bug #57403).
+  for ii = 1:numel (dirs)
+    addpath (dirs{ii});
+  endfor
 
   ## Add the binaries to exec_path.
   if (! strcmp (EXEC_PATH, execpath))