Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index aae38d5..163c00c 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -267,8 +267,8 @@
         except KeyError:
             return path
         userhome = pwent.pw_dir
-    userhome = userhome.rstrip('/') or userhome
-    return userhome + path[i:]
+    userhome = userhome.rstrip('/')
+    return (userhome + path[i:]) or '/'
 
 
 # Expand paths containing shell variable substitutions.