Skip to content

Commit

Permalink
mkosi: take a BSD lock on the workspace directory while running
Browse files Browse the repository at this point in the history
This matches this new PR:

systemd/systemd#11482

Fixes: systemd#252
  • Loading branch information
poettering committed Jan 18, 2019
1 parent 6997dc7 commit ddad048
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mkosi
Original file line number Diff line number Diff line change
Expand Up @@ -4243,6 +4243,11 @@ def build_stuff(args: CommandLineArguments) -> None:
setup_package_cache(args)
workspace = setup_workspace(args)

# Make sure tmpfiles' aging doesn't interfere with our workspace
# while we are working on it.
dir_fd = os.open(workspace.name, os.O_RDONLY|os.O_DIRECTORY|os.O_CLOEXEC)
fcntl.flock(dir_fd, fcntl.LOCK_EX)

# If caching is requested, then make sure we have cache images around we can make use of
if need_cache_images(args):

Expand Down Expand Up @@ -4307,6 +4312,7 @@ def build_stuff(args: CommandLineArguments) -> None:
if root_hash is not None:
print_step(f'Root hash is {root_hash}.')

del dir_fd

def check_root() -> None:
if os.getuid() != 0:
Expand Down

0 comments on commit ddad048

Please sign in to comment.