Needs to store the $cwd in order to correctly do the sort. Patch to follow.
Created attachment 12802 [details] git-am fix for master.
LGTM, for the specific case it fixes. There can probably be a more generic fix for other cases where the opendir and readdir are off different cwd's, perhaps using realpath(), and the most elegant thing would have been for VFS to support dirfd and fstat that, or some API that returns the stat from DIR *.
Yes, it's a little narrow, but right now we only ever call opendir from either the given path relative to the share, or "." when we're walking a path in privilege specific code. I'll push to master, thanks !
Created attachment 12807 [details] git-am fix for 4.5.next, 4.4.next. Cherry-picked from master. Applies cleanly to 4.5.next, 4.4.next.
Karolin, patch applies cleanly to 4.6.0rc, 4.5.next, 4.4.next. Thanks ! Jeremy.
user@host:/data/git/samba/v4-6-test$ git am 0001-s3-vfs-dirsort-doesn-t-handle-opendir-of-.-correctly.patch Applying: s3: vfs: dirsort doesn't handle opendir of "." correctly. error: patch failed: source3/modules/vfs_dirsort.c:137 error: source3/modules/vfs_dirsort.c: patch does not apply Patch failed at 0001 s3: vfs: dirsort doesn't handle opendir of "." correctly. Same for v4-5-test.
Sorry Karolin, I'll fix this asap.
Created attachment 12858 [details] git-am fix for 4.6.next, 4.5.next Direct cherry pick from master.
Created attachment 12859 [details] git-am fix for 4.4.next. Back-port from master.
Verified patches apply to v4-4-stable, v4-5-stable, v4-6-stable. Assigning to Karolin for inclusion in 4.4.next, 4.5.next, 4.6.next. Thanks, Uri.
Pushed to autobuild-v4-{6,5,4}-test.
(In reply to Karolin Seeger from comment #11) Pushed to all branches. Closing out bug report. Thanks!