Skip to content

Commit 1b76992

Browse files
New ign_xattrdir flag for get_diffs()
New ign_xattrdir flag for get_diffs() and fix \\0040 issue for path_new as well as path.
1 parent a5f1fd5 commit 1b76992

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "zfslib"
3-
version = "0.13.0"
3+
version = "0.13.2"
44
description = "ZFS Utilities For Python3"
55
license = "MIT"
66
authors = ["Timothy C. Quinn"]

src/zfslib/zfslib.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,8 @@ def __init__(self, pool, name, parent=None):
579579
# - M The path has been modified
580580
# - R The path has been renamed
581581
# - V The path has been moved
582-
def get_diffs(self, snap_from, snap_to=None, include=None, exclude=None, file_type=None, chg_type=None, get_move:bool=False):
582+
# ign_xattrdir - Filter out <xattrdir> entries
583+
def get_diffs(self, snap_from, snap_to=None, include=None, exclude=None, file_type=None, chg_type=None, get_move:bool=False, ign_xattrdir:bool=False):
583584
self.assertHaveMounts()
584585
assert self.mounted, "Cannot get diffs for Unmounted Dataset. Verify mounted flag on Dataset before calling"
585586

@@ -631,6 +632,10 @@ def __row(s):
631632
rows = list(map(lambda s: __row(s), stdout.splitlines()))
632633
diffs = []
633634
for i, row in enumerate(rows):
635+
636+
if ign_xattrdir and row[3].find('/<xattrdir>') > -1:
637+
continue
638+
634639
# if i == 429:
635640
# print("HERE")
636641
d = Diff(row, snap_left, snap_right, get_move=get_move)
@@ -832,14 +837,16 @@ def __init__(self, row, snap_left, snap_right, get_move:bool=False):
832837
else:
833838
raise Exception(f"Unexpected len: {len(row)}. Row = {row}")
834839

840+
# Fix issue related to https://github.com/openzfs/zfs/issues/6318
841+
path = path.replace("\\0040", " ")
842+
if path_new:
843+
path_new = path_new.replace("\\0040", " ")
844+
835845
# Derrive Move change type
836846
if get_move and file_type == 'F' and chg_type == 'R':
837847
if splitPath(path)[1] != splitPath(path_new)[1]:
838848
chg_type = 'V'
839849

840-
# Fix issue related to https://github.com/openzfs/zfs/issues/6318
841-
path = path.replace("\\0040", " ")
842-
843850
chg_time = datetime.fromtimestamp(int(inode_ts[:inode_ts.find('.')]))
844851
self.chg_ts = inode_ts
845852
self.chg_time = chg_time

0 commit comments

Comments
 (0)