This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 4d40b1daabf7485d58ecd0e9a8abbdfaafe3a232
Author: opencode <[email protected]>
AuthorDate: Thu Oct 8 16:48:53 2026 +0200

    Return an absolute home path from HomesUserDatabase when homeBase is 
relative.
    
    HomesUserDatabase.init() stored homeDir.toString(), which keeps the path
    relative when the configured homeBase is relative. That violates the
    UserDatabase.getHome() contract, which documents that it returns an absolute
    pathname, and it produced an inconsistent resolution in UserConfig.deploy():
    the user's web application directory existence check resolves a relative 
path
    against the JVM working directory, while the same value passed to
    Context.setDocBase() is later resolved against the host's appBase. The two
    bases differ, so per-user applications could silently fail to deploy or, 
worse,
    resolve to an unexpected existing directory.
    
    Store homeDir.getAbsolutePath() so the value always honours the interface
    contract and resolves to a single location. getAbsolutePath() is used rather
    than getCanonicalPath() so that symlinked home directories keep working and 
no
    IOException handling is introduced; there is no behavioural change when 
homeBase
    is already absolute.
---
 java/org/apache/catalina/startup/HomesUserDatabase.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/startup/HomesUserDatabase.java 
b/java/org/apache/catalina/startup/HomesUserDatabase.java
index e1c0b3a286..5f269c9e37 100644
--- a/java/org/apache/catalina/startup/HomesUserDatabase.java
+++ b/java/org/apache/catalina/startup/HomesUserDatabase.java
@@ -90,7 +90,7 @@ public final class HomesUserDatabase implements UserDatabase {
             if (!homeDir.isDirectory() || !homeDir.canRead()) {
                 continue;
             }
-            homes.put(homeBaseFile, homeDir.toString());
+            homes.put(homeBaseFile, homeDir.getAbsolutePath());
         }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to