summaryrefslogtreecommitdiff
path: root/src/buildstream/utils.py
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-11-25 18:05:17 +0100
committerJürg Billeter <j@bitron.ch>2019-12-03 12:06:31 +0000
commit27ec82e3bc00e06800249deca61c7b2df620596c (patch)
tree5ffc5c0a3aa989319a984da372d4cfbfa5471ef4 /src/buildstream/utils.py
parentf553fc8c626d06f5993ecef55a027a28123f0cf9 (diff)
downloadbuildstream-27ec82e3bc00e06800249deca61c7b2df620596c.tar.gz
utils.py: safe_link(): Copy if hardlink creation is not permitted
By default, Linux doesn't allow creating hardlinks to read-only files of other users since Linux 3.6 (see /proc/sys/fs/protected_hardlinks). This fixes staging when buildbox-casd is running as a separate user and the traditional bubblewrap sandboxing backend is used. This combination is not recommended, however, it's triggered in CI by docker images that run buildbox-casd as a separate user and a few test cases that override BST_FORCE_SANDBOX.
Diffstat (limited to 'src/buildstream/utils.py')
-rw-r--r--src/buildstream/utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py
index 5009be338..b6716a29d 100644
--- a/src/buildstream/utils.py
+++ b/src/buildstream/utils.py
@@ -326,7 +326,7 @@ def safe_link(src: str, dest: str, *, result: Optional[FileListResult] = None, _
if e.errno == errno.EEXIST and not _unlink:
# Target exists already, unlink and try again
safe_link(src, dest, result=result, _unlink=True)
- elif e.errno == errno.EXDEV:
+ elif e.errno == errno.EXDEV or e.errno == errno.EPERM:
safe_copy(src, dest)
else:
raise UtilError("Failed to link '{} -> {}': {}".format(src, dest, e)) from e