Skip to content

Commit

Permalink
bind_mount: pre-create dest directory before mounting file
Browse files Browse the repository at this point in the history
Previously, the bind_mount plugin relied on pre-existing directory tree,
typically created by the chroot directory tree by the _PackageManager
installation.  So it was quite easy to mount stuff like
`/var/run/socket` because `/var/run` always existed.  Problem happened
with files like `/var/run/subdirectory/socket`.

Relates: #1091
  • Loading branch information
praiskup authored and xsuchy committed Jun 1, 2023
1 parent 6c7cb9f commit b373dac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mock/py/mockbuild/plugins/bind_mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ def _bindMountCreateDirs(self):
file_util.mkdirIfAbsent(srcdir)
file_util.mkdirIfAbsent(self.buildroot.make_chroot_path(destdir))
else:
file_util.touch(self.buildroot.make_chroot_path(destdir))
dest_file = self.buildroot.make_chroot_path(destdir)
file_util.mkdirIfAbsent(os.path.dirname(dest_file))
file_util.touch(dest_file)

0 comments on commit b373dac

Please sign in to comment.