]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Ignore ENOTTY in copy_file_object() and copy_fd() 1027/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 27 Jun 2022 12:29:27 +0000 (14:29 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 27 Jun 2022 12:30:46 +0000 (14:30 +0200)
This is another possible error that can be returned when FICLONE is
not supported.

mkosi/__init__.py

index 3aab454bc833854dd1c79a7a2044282e72376bc8..321636520dd850283622913b30cce97d1f7b15d4 100644 (file)
@@ -583,7 +583,7 @@ def copy_fd(oldfd: int, newfd: int) -> None:
     try:
         _reflink(oldfd, newfd)
     except OSError as e:
-        if e.errno not in {errno.EXDEV, errno.EOPNOTSUPP}:
+        if e.errno not in {errno.EXDEV, errno.EOPNOTSUPP, errno.ENOTTY}:
             raise
         # While mypy handles this correctly, Pyright doesn't yet.
         shutil.copyfileobj(open(oldfd, "rb", closefd=False), cast(Any, open(newfd, "wb", closefd=False)))
@@ -593,7 +593,7 @@ def copy_file_object(oldobject: BinaryIO, newobject: BinaryIO) -> None:
     try:
         _reflink(oldobject.fileno(), newobject.fileno())
     except OSError as e:
-        if e.errno not in {errno.EXDEV, errno.EOPNOTSUPP}:
+        if e.errno not in {errno.EXDEV, errno.EOPNOTSUPP, errno.ENOTTY}:
             raise
         shutil.copyfileobj(oldobject, newobject)