[SCM] Samba Shared Repository - branch master updated

Pavel Filipensky pfilipensky at samba.org
Tue May 14 13:38:01 UTC 2024


The branch, master has been updated
       via  833c3f26b47 python/tests: Fix nlink test in smb3unix on btrfs filesystem
      from  1ca6fb563b0 lib/replace: make sure krb5_cc_default[_name]() is no longer used directly

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 833c3f26b476c5f27d8dd000cfa423f0726cef1a
Author: Pavel Filipenský <pfilipensky at samba.org>
Date:   Mon May 13 12:13:38 2024 +0200

    python/tests: Fix nlink test in smb3unix on btrfs filesystem
    
    Signed-off-by: Pavel Filipenský <pfilipensky at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Pavel Filipensky <pfilipensky at samba.org>
    Autobuild-Date(master): Tue May 14 13:37:53 UTC 2024 on atb-devel-224

-----------------------------------------------------------------------

Summary of changes:
 python/samba/tests/smb3unix.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py
index d88bd432239..1962852349c 100644
--- a/python/samba/tests/smb3unix.py
+++ b/python/samba/tests/smb3unix.py
@@ -24,6 +24,7 @@ from samba.dcerpc import smb3posix
 from samba.ndr import ndr_unpack
 from samba.dcerpc.security import dom_sid
 import os
+import subprocess
 
 def posix_context(mode):
     return (libsmb.SMB2_CREATE_TAG_POSIX, mode.to_bytes(4, 'little'))
@@ -34,6 +35,9 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
         super().setUp()
 
         self.samsid = os.environ["SAMSID"]
+        prefix_abs = os.environ["PREFIX_ABS"]
+        p = subprocess.run(['stat', '-f', '-c', '%T', prefix_abs], capture_output=True, text=True)
+        self.fstype = p.stdout.strip().lower()
 
     def connections(self, share1=None, posix1=False, share2=None, posix2=True):
         if not share1:
@@ -303,7 +307,11 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
                     self.assertEqual(found_files[fname]['attrib'],
                                      libsmb.FILE_ATTRIBUTE_ARCHIVE)
                 else:
-                    self.assertEqual(found_files[fname]['nlink'], 2)
+                    # Note: btrfs always reports the link count of directories as one.
+                    if self.fstype == "btrfs":
+                        self.assertEqual(found_files[fname]['nlink'], 1)
+                    else:
+                        self.assertEqual(found_files[fname]['nlink'], 2)
                     self.assertEqual(found_files[fname]['attrib'],
                                      libsmb.FILE_ATTRIBUTE_DIRECTORY)
 
@@ -368,9 +376,11 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
 
             cc = ndr_unpack(smb3posix.smb3_posix_cc_info, cc_out[0][1])
 
-            # Note: this fails on btrfs which always reports the link
-            # count of directories as one.
-            self.assertEqual(cc.nlinks, 2)
+            # Note: btrfs always reports the link count of directories as one.
+            if self.fstype == "btrfs":
+                self.assertEqual(cc.nlinks, 1)
+            else:
+                self.assertEqual(cc.nlinks, 2)
 
             self.assertEqual(cc.reparse_tag, libsmb.IO_REPARSE_TAG_RESERVED_ZERO)
             self.assertEqual(cc.posix_perms, 0o700)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list