From 7754fd8e78c3f3ee5cd5d3d27a875e34e940b579 Mon Sep 17 00:00:00 2001 From: Lars Karlitski Date: Thu, 28 Nov 2019 23:34:08 +0100 Subject: [PATCH] treesum: don't use `dir_fd` parameter in `os.scandir()` This parameter was added in python 3.7, but we're only depending on 3.6 for RHEL. Pass a path to `/proc/self/fd/...` instead. --- osbuild/treesum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osbuild/treesum.py b/osbuild/treesum.py index 9902e298..7ef7aa11 100644 --- a/osbuild/treesum.py +++ b/osbuild/treesum.py @@ -19,7 +19,7 @@ def treesum(m, dir_fd): The file, symlink and directory names and contents are recursively hashed, together with security-relevant metadata.""" - with os.scandir(dir_fd) as it: + with os.scandir(f"/proc/self/fd/{dir_fd}") as it: for dirent in sorted(it, key=(lambda d: d.name)): stat_result = dirent.stat(follow_symlinks=False) metadata = {}