|
@@ -2,11 +2,13 @@ import errno
|
|
|
import os
|
|
import os
|
|
|
import shutil
|
|
import shutil
|
|
|
import time
|
|
import time
|
|
|
|
|
+import stat
|
|
|
from unittest.mock import patch
|
|
from unittest.mock import patch
|
|
|
|
|
|
|
|
import pytest
|
|
import pytest
|
|
|
|
|
|
|
|
from ... import xattr
|
|
from ... import xattr
|
|
|
|
|
+from ... import platform
|
|
|
from ...chunkers import has_seek_hole
|
|
from ...chunkers import has_seek_hole
|
|
|
from ...constants import * # NOQA
|
|
from ...constants import * # NOQA
|
|
|
from ...helpers import EXIT_WARNING, BackupPermissionError, bin_to_hex
|
|
from ...helpers import EXIT_WARNING, BackupPermissionError, bin_to_hex
|
|
@@ -606,6 +608,33 @@ def test_extract_xattrs_resourcefork(archivers, request):
|
|
|
# assert atime_extracted == atime_expected # still broken, but not really important.
|
|
# assert atime_extracted == atime_expected # still broken, but not really important.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+@pytest.mark.skipif(not is_darwin, reason="only for macOS")
|
|
|
|
|
+def test_extract_restores_append_flag(archivers, request):
|
|
|
|
|
+ archiver = request.getfixturevalue(archivers)
|
|
|
|
|
+ # create a file and set the append flag on it
|
|
|
|
|
+ create_regular_file(archiver.input_path, "appendflag", size=1)
|
|
|
|
|
+ src_path = os.path.abspath("input/appendflag")
|
|
|
|
|
+ if not hasattr(stat, "UF_APPEND"):
|
|
|
|
|
+ pytest.skip("UF_APPEND not available on this platform")
|
|
|
|
|
+ try:
|
|
|
|
|
+ platform.set_flags(src_path, stat.UF_APPEND)
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ pytest.skip("setting UF_APPEND not supported on this filesystem")
|
|
|
|
|
+ # Verify the flag actually got set; otherwise skip (filesystem may not support it)
|
|
|
|
|
+ st = os.lstat(src_path)
|
|
|
|
|
+ if (platform.get_flags(src_path, st) & stat.UF_APPEND) == 0:
|
|
|
|
|
+ pytest.skip("UF_APPEND not settable on this filesystem")
|
|
|
|
|
+ # archive and extract
|
|
|
|
|
+ cmd(archiver, "repo-create", "-e" "none")
|
|
|
|
|
+ cmd(archiver, "create", "test", "input")
|
|
|
|
|
+ with changedir("output"):
|
|
|
|
|
+ cmd(archiver, "extract", "test")
|
|
|
|
|
+ out_path = os.path.abspath("input/appendflag")
|
|
|
|
|
+ st2 = os.lstat(out_path)
|
|
|
|
|
+ flags = platform.get_flags(out_path, st2)
|
|
|
|
|
+ assert (flags & stat.UF_APPEND) == stat.UF_APPEND
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def test_overwrite(archivers, request):
|
|
def test_overwrite(archivers, request):
|
|
|
archiver = request.getfixturevalue(archivers)
|
|
archiver = request.getfixturevalue(archivers)
|
|
|
if archiver.EXE:
|
|
if archiver.EXE:
|