]> git.ipfire.org Git - thirdparty/samba.git/commit
s4:torture: Fix samba3.smb2.name-mangling on btrfs
authorAndreas Schneider <asn@samba.org>
Thu, 28 Nov 2024 14:52:03 +0000 (15:52 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 29 Nov 2024 14:09:35 +0000 (14:09 +0000)
commit38b8a4f2232ca3e8dc4596c080df770f07fa49a8
treece7abdfa46634c6085984d16e5987ed878272656
parentbb92c70f0ee126981a4ffeea28bf7059ab0b08d0
s4:torture: Fix samba3.smb2.name-mangling on btrfs

If a file is removed from or added to the directory after the most recent call
to opendir() or rewinddir(), whether a subsequent call to readdir() returns
an entry for that file is unspecified."
https://pubs.opengroup.org/onlinepubs/009604599/functions/readdir.html

As it is unspecified, the different filesystems on Linux implement this
differently:

ext4:

./a.out
opendir(foo)
creat(foo/bar)
readdir() loop
  readdir entry: bar
  readdir entry: ..
  readdir entry: .
readdir() detected the newly created file `foo`

btrfs:

./a.out
opendir(foo)
creat(foo/bar)
readdir() loop
  readdir entry: .
  readdir entry: ..
readdir() did not detect the newly created file `foo`

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source4/torture/smb2/mangle.c