debian-forge/osbuild
Michael Vogt 158acaac78 osbuild: ensure loop.Loop() has the required device node
When loop.Loop() is called and a new loop device must be allocated
there is no gurantee that the correct device node is available on
the system. In containers /dev is often just a tmpfs with static
device nodes. So when /dev/loopN is not available when the
container is created the device node will be missing even if
`get_unbound()` create a new loop device for us.

This commit ensures that the device node is available. It creates
it unconditionally and ignores any EEXIST errors to ensure there
is no TOCTOU issue.

Note that the test could have passed a `Loop(dir_fd=open(tmpdir))`
instead of creating/patching loop.DEV_PATH but it seems slightly
nicer to test the flow without a custom dir_path as this is what
the real code that creates a loop device is also using.
2023-11-24 16:05:52 +01:00
..
formats tox: add tox 2023-08-01 15:01:13 +02:00
testutil osbuild: testutil provides has_executable 2023-11-10 12:03:23 +01:00
util util: tweak _calculate_size() to _calculate_space() 2023-11-22 10:28:08 +01:00
__init__.py Post release version bump 2023-11-22 08:16:02 +00:00
__main__.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
api.py Fix errors reported by new version of mypy 2023-04-12 11:57:18 +02:00
buildroot.py tox: add tox 2023-08-01 15:01:13 +02:00
devices.py devices: new helper to ensure a device node exists 2022-11-22 18:28:38 +01:00
host.py tox: add tox 2023-08-01 15:01:13 +02:00
inputs.py inputs: Move arguments for InputService.map to a temporary file 2023-06-27 10:56:10 +02:00
loop.py osbuild: ensure loop.Loop() has the required device node 2023-11-24 16:05:52 +01:00
main_cli.py autopep8: Update with changes to make autopep8 -a -a -a happy 2023-08-10 13:04:14 +02:00
meta.py osbuild. add comment why AST is used and not importlib 2023-11-22 09:52:47 +01:00
monitor.py monitor: show pipeline's source epoch 2022-12-15 13:10:35 +00:00
mounts.py mounts/org.osbuild.btrfs: add support for compression 2023-08-25 12:35:56 +02:00
objectstore.py objectstore: also mount /etc/containers for "host" buildroot 2023-10-25 22:05:54 +02:00
pipeline.py osbuild: --checkpoint can now use globs 2023-08-04 19:59:11 +02:00
remoteloop.py loop: use LOOP_CONFIGURE instead of LOOP_SET_FD 2023-05-05 15:42:47 +02:00
sources.py Fix errors reported by new version of mypy 2023-04-12 11:57:18 +02:00