Error when staging ostree sources when /tmp is mounted as a tmpfs on the host system - "Invalid cross-device link"
Summary
When staging OSTree sources, buildstream will attempt a rename between $XDG_CACHE_HOME/buildstream/sources/ostree and /tmp. If /tmp and $XDG_CACHE_HOME are not on the same block device (if /tmp is mounted as a tmpfs), this will fail.
Steps to reproduce
- Mount /tmp as a tmpfs ('systemctl enable tmp.mount && systemctl reboot' should work on most systems)
- Attempt to stage an OSTree source
What is the current bug behavior?
See summary
What is the expected correct behavior?
Staging of sources is not affected by host block device configuration.
Relevant logs and/or screenshots
Backtrace:
An unhandled exception occured:
Traceback (most recent call last):
File "/usr/lib64/python3.6/shutil.py", line 544, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/home/matthew/.cache/buildstream/sources/ostree/tmprk3jdzl0/checkout/usr' -> '/tmp/tmppqsog1z8/usr'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/buildstream/plugins/sources/ostree.py", line 160, in stage
shutil.move(source_path, directory)
File "/usr/lib64/python3.6/shutil.py", line 556, in move
rmtree(src)
File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'find'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/buildstream/utils.py", line 986, in _tempdir
yield tempdir
File "/usr/local/lib/python3.6/site-packages/buildstream/source.py", line 624, in tempdir
yield tempdir
File "/usr/local/lib/python3.6/site-packages/buildstream/plugins/sources/ostree.py", line 163, in stage
.format(self, self.url, tmpdir, directory, e)) from e
buildstream.source.SourceError: ostree source at sdk.bst [line 4 column 2]: Failed to move ostree checkout http://d2dfs.uk.rdlabs.hpecorp.net/ostree/repo from '/home/matthew/.cache/buildstream/sources/ostree/tmprk3jdzl0' to '/tmp/tmppqsog1z8'
[Errno 13] Permission denied: 'find'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/buildstream/element.py", line 1562, in _assemble
collect = self.assemble(sandbox)
File "/usr/local/lib/python3.6/site-packages/buildstream/plugins/elements/import.py", line 71, in assemble
self._stage_sources_in_sandbox(sandbox, 'input', mount_workspaces=False)
File "/usr/local/lib/python3.6/site-packages/buildstream/element.py", line 1364, in _stage_sources_in_sandbox
self._stage_sources_at(host_vdirectory, mount_workspaces=mount_workspaces)
File "/usr/local/lib/python3.6/site-packages/buildstream/element.py", line 1399, in _stage_sources_at
source._stage(temp_staging_directory)
File "/usr/local/lib/python3.6/site-packages/buildstream/source.py", line 680, in _stage
self.stage(staging_directory)
File "/usr/local/lib/python3.6/site-packages/buildstream/plugins/sources/ostree.py", line 163, in stage
.format(self, self.url, tmpdir, directory, e)) from e
File "/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.6/site-packages/buildstream/source.py", line 624, in tempdir
yield tempdir
File "/usr/lib64/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.6/site-packages/buildstream/utils.py", line 988, in _tempdir
cleanup_tempdir()
File "/usr/local/lib/python3.6/site-packages/buildstream/utils.py", line 982, in cleanup_tempdir
shutil.rmtree(tempdir)
File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'find'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/buildstream/_scheduler/jobs/job.py", line 409, in _child_action
result = self.child_process()
File "/usr/local/lib/python3.6/site-packages/buildstream/_scheduler/jobs/elementjob.py", line 94, in child_process
return self._action_cb(self._element)
File "/usr/local/lib/python3.6/site-packages/buildstream/_scheduler/queues/buildqueue.py", line 71, in process
return element._assemble()
File "/usr/local/lib/python3.6/site-packages/buildstream/element.py", line 1640, in _assemble
build_result_dict = {"success": self.__build_result[0], "description": self.__build_result[1]}
TypeError: 'NoneType' object is not subscriptable
Possible fixes
Other relevant information
- BuildStream version affected: /milestone %BuildStream_v1.3
- commit 44da8175