changeset 156:481cc9b26861

Calculate "stat()" for directories also in a WalkDirEntry
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 06 Jan 2025 14:38:07 +0100
parents bf74ce3c968d
children 27d1aaf5fe39
files cutils/treesum.py cutils/util/walk.py
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cutils/treesum.py	Mon Jan 06 13:39:12 2025 +0100
+++ b/cutils/treesum.py	Mon Jan 06 14:38:07 2025 +0100
@@ -312,6 +312,8 @@
             follow_symlinks=follow_directory_symlinks):
         dir_dgst = algorithm[0]()
         for fso in fsobjects:
+            # print("NNNNNNNN", fso.name, fso.stat,
+            # "%o (%o)" % (fso.stat.st_mode, stat.S_IMODE(fso.stat.st_mode)))
             if fso.is_dir:
                 if fso.is_symlink and not follow_directory_symlinks:
                     linktgt = util.fsencode(os.readlink(fso.path))
--- a/cutils/util/walk.py	Mon Jan 06 13:39:12 2025 +0100
+++ b/cutils/util/walk.py	Mon Jan 06 14:38:07 2025 +0100
@@ -109,9 +109,8 @@
             # is not a symbolic link, same behaviour than os.path.islink().
             #
             w._is_symlink = False
-        if not w._is_dir:
-            # Do not supress errors here and (consistently) follow symlinks
-            w._stat_result = entry.stat(follow_symlinks=True)
+        # Do not supress errors here and (consistently) follow symlinks
+        w._stat_result = entry.stat(follow_symlinks=True)
         return w
 
     @staticmethod