Created attachment 15979 [details]
With libsmbclient 4.12.2 a stat after/during a readdir(plus2) seems to regularly get confused and return a previously queried path rather than the current one. Only when the server and client are in NT1 mode though. Seems to work fine on smbclient 4.7.6, so I guess this regressed at some point.
We are seeing this downstream in KIO: https://bugs.kde.org/show_bug.cgi?id=421228
I'm attaching an example for this. It is a slightly modified testbrowse.c that displays the mode of the stat. The tar also includes a bare bones smb.conf as well as an example dir to reproduce this with.
Sample output running against smbd 4.12.2:
-- smbclient 4.12.2 (broken - S_ISDIR is true; size is 0)
file FILE S_ISDIR 1 S_ISREG 0 mode 16877 size 0
-- smbclient 4.7.6 (working - S_ISDIR is false)
file FILE S_ISDIR 0 S_ISREG 1 mode 33188 size 4
Is it possible that this also depends on "unix extensions = yes"? Can you reproduce this behaviour also if you explicitly set "unix extensions = no"? If so, can you try patch
That indeed seems to be the same issue. Disabling the unix extension makes the client behave correctly and the patch fixes it even with extensions enabled.
Sorry for the noise.
*** This bug has been marked as a duplicate of bug 14101 ***