Skip to content

Commit

Permalink
Detect home directories outside of /home properly
Browse files Browse the repository at this point in the history
Fixes #3191
  • Loading branch information
DaanDeMeyer committed Nov 15, 2024
1 parent 184f009 commit 613f0c4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mkosi/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def current_home_dir() -> Optional[Path]:
if Path.cwd().is_relative_to("/root"):
return Path("/root")

if (home := os.getenv("HOME")) and Path.cwd().is_relative_to(home):
return Path(home)

if Path.cwd().is_relative_to("/home"):
# `Path.parents` only supports slices and negative indexing from Python 3.10 onwards.
# TODO: Remove list() when we depend on Python 3.10 or newer.
Expand Down

0 comments on commit 613f0c4

Please sign in to comment.