File 2941-erts-by-default-cwd-should-be-last-in-the-path.patch of Package erlang

From bf8ddaee5fa7ba24f1cf6201f233cd79750fe217 Mon Sep 17 00:00:00 2001
From: Fredrik Frantzen <frazze@erlang.org>
Date: Thu, 6 Nov 2025 10:40:40 +0100
Subject: [PATCH] erts: by default cwd should be last in the path

---
 erts/preloaded/src/init.erl                           | 2 +-
 lib/kernel/src/code_server.erl                        | 2 +-
 system/doc/general_info/upcoming_incompatibilities.md | 5 +++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/erts/preloaded/src/init.erl b/erts/preloaded/src/init.erl
index 60a159839d..1580c70055 100644
--- a/erts/preloaded/src/init.erl
+++ b/erts/preloaded/src/init.erl
@@ -1160,7 +1160,7 @@ sleep(T) -> receive after T -> ok end.
 
 start_prim_loader(Init, Path0, {Pa,Pz}) ->
     Path = case Path0 of
-	       false -> Pa ++ ["."|Pz];
+	       false -> Pa ++ Pz ++ ["."];
 	       _ -> Path0
 	   end,
     case erl_prim_loader:start() of
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index ebd78dc970..e3be6e671c 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -107,7 +107,7 @@ init(Ref, Parent, [Root,Mode]) ->
 		{ok,Dirs} = erl_prim_loader:list_dir(LibDir),
 		Paths = make_path(LibDir, Dirs),
 		UserLibPaths = get_user_lib_dirs(),
-		["."] ++ UserLibPaths ++ Paths;
+		UserLibPaths ++ Paths ++ ["."];
 	    _ ->
 		[]
 	end,
diff --git a/system/doc/general_info/upcoming_incompatibilities.xml b/system/doc/general_info/upcoming_incompatibilities.xml
index a8336735cd..ee277b7943 100644
--- a/system/doc/general_info/upcoming_incompatibilities.xml
+++ b/system/doc/general_info/upcoming_incompatibilities.xml
@@ -347,6 +347,14 @@ String Content
 	in OTP 27.
       </p>
     </section>
+
+    <section>
+      <title>CWD or '.' is now placed last in code path</title>
+      <p>
+	As of OTP 29, the CWD is added last instead of first in code path.
+	It can be added first with -pa '.' if needed.
+      </p>
+    </section>
   </section>
 
 </chapter>
-- 
2.51.0

openSUSE Build Service is sponsored by